From 9cd95eacca3af037320936bb3533ea01e239a54d Mon Sep 17 00:00:00 2001 From: Jared Harper <129781402+swi-jared@users.noreply.github.com> Date: Fri, 19 Apr 2024 15:00:10 -0700 Subject: [PATCH] Make span kind prefix uppercase (#76) --- internal/exporter/exporter.go | 3 ++- internal/exporter/exporter_test.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/exporter/exporter.go b/internal/exporter/exporter.go index 5ede92b3..5956a99f 100644 --- a/internal/exporter/exporter.go +++ b/internal/exporter/exporter.go @@ -26,6 +26,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" sdktrace "go.opentelemetry.io/otel/sdk/trace" + "strings" ) type exporter struct { @@ -33,7 +34,7 @@ type exporter struct { func exportSpan(_ context.Context, s sdktrace.ReadOnlySpan) { evt := reporter.CreateEntryEvent(s.SpanContext(), s.StartTime(), s.Parent()) - layer := fmt.Sprintf("%s:%s", s.SpanKind().String(), s.Name()) + layer := fmt.Sprintf("%s:%s", strings.ToUpper(s.SpanKind().String()), s.Name()) evt.SetLayer(layer) evt.AddKVs([]attribute.KeyValue{ attribute.String("sw.span_name", s.Name()), diff --git a/internal/exporter/exporter_test.go b/internal/exporter/exporter_test.go index 9e2a873d..e4093da1 100644 --- a/internal/exporter/exporter_test.go +++ b/internal/exporter/exporter_test.go @@ -80,7 +80,7 @@ func TestExportSpan(t *testing.T) { "Hostname": host.Hostname(), "Label": "entry", "Language": "Go", - "Layer": "internal:foo", + "Layer": "INTERNAL:foo", "PID": host.PID(), "Timestamp_u": start.UnixMicro(), "TransactionName": "foo", @@ -145,7 +145,7 @@ func TestExportSpan(t *testing.T) { "sw.parent_span_id": spanId, "Hostname": host.Hostname(), "Label": "exit", - "Layer": "internal:foo", + "Layer": "INTERNAL:foo", "PID": host.PID(), "Timestamp_u": end.UnixMicro(), "X-Trace": exit.GetXTrace(),