metrics: do not add a default start_time_unix_nano

This commit is contained in:
Simon Cruanes 2025-12-09 22:36:00 -05:00
parent 3eba3df59d
commit 4a61ab44d9
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -20,19 +20,17 @@ open struct
end end
(** Number data point, as a float *) (** Number data point, as a float *)
let float ?(start_time_unix_nano = _program_start) let float ?start_time_unix_nano ?(now = Timestamp_ns.now_unix_ns ())
?(now = Timestamp_ns.now_unix_ns ()) ?(attrs = []) (d : float) : ?(attrs = []) (d : float) : number_data_point =
number_data_point =
let attributes = attrs |> List.map Key_value.conv in 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) () ~value:(As_double d) ()
(** Number data point, as an int *) (** Number data point, as an int *)
let int ?(start_time_unix_nano = _program_start) let int ?start_time_unix_nano ?(now = Timestamp_ns.now_unix_ns ()) ?(attrs = [])
?(now = Timestamp_ns.now_unix_ns ()) ?(attrs = []) (i : int) : (i : int) : number_data_point =
number_data_point =
let attributes = attrs |> List.map Key_value.conv in 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)) ~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 count value of histogram for each bucket. Sum of the counts must be equal
to [count]. length must be [1+length explicit_bounds] to [count]. length must be [1+length explicit_bounds]
@param explicit_bounds strictly increasing list of bounds for the buckets *) @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 = []) ?(now = Timestamp_ns.now_unix_ns ()) ?(attrs = []) ?(exemplars = [])
?(explicit_bounds = []) ?sum ~bucket_counts ~count () : histogram_data_point ?(explicit_bounds = []) ?sum ~bucket_counts ~count () : histogram_data_point
= =
let attributes = attrs |> List.map Key_value.conv in 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 () ~attributes ~exemplars ~bucket_counts ~explicit_bounds ~count ?sum ()
let histogram ~name ?description ?unit_ ?aggregation_temporality let histogram ~name ?description ?unit_ ?aggregation_temporality