From 4a61ab44d9af59fe8f197c90e495a953bb07b788 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 9 Dec 2025 22:36:00 -0500 Subject: [PATCH] metrics: do not add a default `start_time_unix_nano` --- src/core/metrics.ml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/core/metrics.ml b/src/core/metrics.ml index dcf9efa3..988b7bd6 100644 --- a/src/core/metrics.ml +++ b/src/core/metrics.ml @@ -20,19 +20,17 @@ open struct end (** Number data point, as a float *) -let float ?(start_time_unix_nano = _program_start) - ?(now = Timestamp_ns.now_unix_ns ()) ?(attrs = []) (d : float) : - number_data_point = +let float ?start_time_unix_nano ?(now = Timestamp_ns.now_unix_ns ()) + ?(attrs = []) (d : float) : number_data_point = let attributes = attrs |> List.map Key_value.conv in - make_number_data_point ~start_time_unix_nano ~time_unix_nano:now ~attributes + make_number_data_point ?start_time_unix_nano ~time_unix_nano:now ~attributes ~value:(As_double d) () (** Number data point, as an int *) -let int ?(start_time_unix_nano = _program_start) - ?(now = Timestamp_ns.now_unix_ns ()) ?(attrs = []) (i : int) : - number_data_point = +let int ?start_time_unix_nano ?(now = Timestamp_ns.now_unix_ns ()) ?(attrs = []) + (i : int) : number_data_point = let attributes = attrs |> List.map Key_value.conv in - make_number_data_point ~start_time_unix_nano ~time_unix_nano:now ~attributes + make_number_data_point ?start_time_unix_nano ~time_unix_nano:now ~attributes ~value:(As_int (Int64.of_int i)) () @@ -62,12 +60,12 @@ let sum ~name ?description ?unit_ count value of histogram for each bucket. Sum of the counts must be equal to [count]. length must be [1+length explicit_bounds] @param explicit_bounds strictly increasing list of bounds for the buckets *) -let histogram_data_point ?(start_time_unix_nano = _program_start) +let histogram_data_point ?start_time_unix_nano ?(now = Timestamp_ns.now_unix_ns ()) ?(attrs = []) ?(exemplars = []) ?(explicit_bounds = []) ?sum ~bucket_counts ~count () : histogram_data_point = let attributes = attrs |> List.map Key_value.conv in - make_histogram_data_point ~start_time_unix_nano ~time_unix_nano:now + make_histogram_data_point ?start_time_unix_nano ~time_unix_nano:now ~attributes ~exemplars ~bucket_counts ~explicit_bounds ~count ?sum () let histogram ~name ?description ?unit_ ?aggregation_temporality