From 806545f2bae18fadcb5ed251ec57192d1d8c826e Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sat, 21 Feb 2026 22:37:10 -0500 Subject: [PATCH] format --- tests/bin/emit1_eio.ml | 3 ++- tests/core/t_histogram.ml | 34 ++++++++++++++++++++-------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/tests/bin/emit1_eio.ml b/tests/bin/emit1_eio.ml index 6185f858..469dcdcf 100644 --- a/tests/bin/emit1_eio.ml +++ b/tests/bin/emit1_eio.ml @@ -78,7 +78,8 @@ let run env proc iterations () : unit = sum ~name:"num-sleep" ~is_monotonic:true [ int ~now (Atomic.get num_sleep) ]; ]); - OT.Meter.add_to_main_exporter ~min_interval:Mtime.Span.(10 * ms) + OT.Meter.add_to_main_exporter + ~min_interval:Mtime.Span.(10 * ms) OT.Meter.default; let n_jobs = max 1 !n_jobs in diff --git a/tests/core/t_histogram.ml b/tests/core/t_histogram.ml index 70d736e1..81ba42c3 100644 --- a/tests/core/t_histogram.ml +++ b/tests/core/t_histogram.ml @@ -5,8 +5,7 @@ let dummy_clock : Clock.t = { Clock.now = (fun () -> 0L) } let emit h = h.Instrument.emit ~clock:dummy_clock () -let pp_metrics metrics = - List.iter (Format.printf "%a@." Metrics.pp) metrics +let pp_metrics metrics = List.iter (Format.printf "%a@." Metrics.pp) metrics (* ------------------------------------------------------------------ *) (* Test 1: one value per bucket, plus one in the overflow bucket *) @@ -16,23 +15,27 @@ let () = Instrument.Histogram.create ~name:"test.latency" ~description:"test histogram" ~bounds:[ 1.; 2.; 5. ] () in - Instrument.Histogram.record h 0.5; (* bucket 0: ≤1 *) - Instrument.Histogram.record h 1.5; (* bucket 1: ≤2 *) - Instrument.Histogram.record h 3.0; (* bucket 2: ≤5 *) - Instrument.Histogram.record h 10.; (* bucket 3: >5 *) + Instrument.Histogram.record h 0.5; + (* bucket 0: ≤1 *) + Instrument.Histogram.record h 1.5; + (* bucket 1: ≤2 *) + Instrument.Histogram.record h 3.0; + (* bucket 2: ≤5 *) + Instrument.Histogram.record h 10.; + (* bucket 3: >5 *) (* count=4 sum=15.0 bucket_counts=[1;1;1;1] *) pp_metrics (emit h) (* ------------------------------------------------------------------ *) (* Test 2: multiple values pile into the same bucket *) let () = - let h = - Instrument.Histogram.create ~name:"test.size" ~bounds:[ 1.; 5. ] () - in + let h = Instrument.Histogram.create ~name:"test.size" ~bounds:[ 1.; 5. ] () in Instrument.Histogram.record h 0.1; Instrument.Histogram.record h 0.2; - Instrument.Histogram.record h 0.3; (* 3 values in bucket 0 *) - Instrument.Histogram.record h 2.0; (* 1 value in bucket 1 *) + Instrument.Histogram.record h 0.3; + (* 3 values in bucket 0 *) + Instrument.Histogram.record h 2.0; + (* 1 value in bucket 1 *) (* count=4 sum=2.6 bucket_counts=[3;1;0] *) pp_metrics (emit h) @@ -51,8 +54,11 @@ let () = let h = Instrument.Histogram.create ~name:"test.boundary" ~bounds:[ 1.; 2.; 5. ] () in - Instrument.Histogram.record h 1.0; (* exactly on bound → bucket 0 *) - Instrument.Histogram.record h 2.0; (* exactly on bound → bucket 1 *) - Instrument.Histogram.record h 5.0; (* exactly on bound → bucket 2 *) + Instrument.Histogram.record h 1.0; + (* exactly on bound → bucket 0 *) + Instrument.Histogram.record h 2.0; + (* exactly on bound → bucket 1 *) + Instrument.Histogram.record h 5.0; + (* exactly on bound → bucket 2 *) (* count=3 sum=8.0 bucket_counts=[1;1;1;0] *) pp_metrics (emit h)