From ed77591aa94200eeab844dfea53d6ffb272c9525 Mon Sep 17 00:00:00 2001 From: Serge Tupchii Date: Fri, 10 Nov 2023 21:04:29 +0200 Subject: [PATCH] fix(otel_otlp_metrics): convert histogram timestamps and fix 'unix_nano' field names --- .../opentelemetry_experimental/src/otel_otlp_metrics.erl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/opentelemetry_experimental/src/otel_otlp_metrics.erl b/apps/opentelemetry_experimental/src/otel_otlp_metrics.erl index 1115010c..8da7bdbe 100644 --- a/apps/opentelemetry_experimental/src/otel_otlp_metrics.erl +++ b/apps/opentelemetry_experimental/src/otel_otlp_metrics.erl @@ -85,9 +85,10 @@ to_data_points(#datapoint{attributes=Attributes, exemplars=Exemplars, flags=Flags }) -> + #{attributes => otel_otlp_common:to_attributes(Attributes), - start_time => opentelemetry:timestamp_to_nano(StartTime), - time => opentelemetry:timestamp_to_nano(CollectionStartTime), + start_time_unix_nano => opentelemetry:timestamp_to_nano(StartTime), + time_unix_nano => opentelemetry:timestamp_to_nano(CollectionStartTime), value => to_datapoint_value(Value), exemplars => Exemplars, flags => Flags @@ -107,8 +108,8 @@ to_histogram_data_points(#histogram_datapoint{ max=Max }) -> #{attributes => otel_otlp_common:to_attributes(Attributes), - start_time => StartTime, - time => CollectionStartTime, + start_time_unix_nano => opentelemetry:timestamp_to_nano(StartTime), + time_unix_nano => opentelemetry:timestamp_to_nano(CollectionStartTime), count => Count, sum => Sum, bucket_counts => Buckets,