From 6eeb0b9b082534724e84162a5cd8e40f8fe9de1c Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Fri, 5 Dec 2025 23:33:32 -0500 Subject: [PATCH] todo --- src/client/generic_http_consumer.ml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/client/generic_http_consumer.ml b/src/client/generic_http_consumer.ml index f9c3ba84..76823810 100644 --- a/src/client/generic_http_consumer.ml +++ b/src/client/generic_http_consumer.ml @@ -5,6 +5,34 @@ type error = Export_error.t (** Number of errors met during export *) let n_errors = Atomic.make 0 +(* TODO: put this somewhere with an interval limiter to 30s + + (* there is a possible race condition here, as several threads might update + metrics at the same time. But that's harmless. *) + if add_own_metrics then ( + Atomic.set last_sent_metrics now; + let open OT.Metrics in + [ + make_resource_metrics + [ + sum ~name:"otel.export.dropped" ~is_monotonic:true + [ + int + ~start_time_unix_nano:(Mtime.to_uint64_ns last_emit) + ~now:(Mtime.to_uint64_ns now) (Atomic.get n_dropped); + ]; + sum ~name:"otel.export.errors" ~is_monotonic:true + [ + int + ~start_time_unix_nano:(Mtime.to_uint64_ns last_emit) + ~now:(Mtime.to_uint64_ns now) (Atomic.get n_errors); + ]; + ]; + ] + ) else + [] +*) + module type IO = Generic_io.S_WITH_CONCURRENCY module type HTTPC = sig