From b7a36bd37a72441aeeb01a1661112849fbdaf421 Mon Sep 17 00:00:00 2001 From: Vera Reynolds Date: Mon, 21 Aug 2023 13:30:53 -0400 Subject: [PATCH] fix: time units in telemetry (#95) ## Which problem is this PR solving? - Closes #92 ## Short description of the changes - use explicit time units in telemetry name - use ms for time data ## How to verify that this has the expected result - build & run - explore latency and duration telemetry --- main.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 000bf50c..589de9fa 100644 --- a/main.go +++ b/main.go @@ -16,9 +16,10 @@ import ( "github.com/honeycombio/libhoney-go" "github.com/rs/zerolog" "github.com/rs/zerolog/log" - semconv "go.opentelemetry.io/otel/semconv/v1.20.0" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" + + semconv "go.opentelemetry.io/otel/semconv/v1.20.0" ) const Version string = "0.0.3-alpha" @@ -136,9 +137,9 @@ func sendHttpEventToHoneycomb(event assemblers.HttpEvent, k8sClient *utils.Cache // common attributes ev.Timestamp = event.Timestamp ev.AddField("httpEvent_handled_at", time.Now()) - ev.AddField("httpEvent_handled_latency", time.Now().Sub(event.Timestamp)) + ev.AddField("httpEvent_handled_latency_ms", time.Now().Sub(event.Timestamp).Milliseconds()) ev.AddField("goroutine_count", runtime.NumGoroutine()) - ev.AddField("duration_ms", event.Duration.Microseconds()) + ev.AddField("duration_ms", event.Duration.Milliseconds()) ev.AddField(string(semconv.NetSockHostAddrKey), event.SrcIp) ev.AddField("destination.address", event.DstIp)