From 3a9ee65f477586676176db798c8d43ada7ea6bc1 Mon Sep 17 00:00:00 2001 From: Vishal Raj Date: Tue, 6 Aug 2024 16:59:03 +0100 Subject: [PATCH] Fix incorrect attribute name for trace.root (#69) --- .../trace/internal/elastic/attributes.go | 2 +- enrichments/trace/internal/elastic/span.go | 2 +- .../trace/internal/elastic/span_test.go | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/enrichments/trace/internal/elastic/attributes.go b/enrichments/trace/internal/elastic/attributes.go index ee4db48..f232845 100644 --- a/enrichments/trace/internal/elastic/attributes.go +++ b/enrichments/trace/internal/elastic/attributes.go @@ -23,7 +23,7 @@ const ( AttributeAgentVersion = "agent.version" // span attributes - AttributeTransactionRoot = "transaction.root" + AttributeTraceRoot = "trace.root" AttributeTransactionName = "transaction.name" AttributeTransactionType = "transaction.type" AttributeTransactionResult = "transaction.result" diff --git a/enrichments/trace/internal/elastic/span.go b/enrichments/trace/internal/elastic/span.go index 01f407d..19e7c6c 100644 --- a/enrichments/trace/internal/elastic/span.go +++ b/enrichments/trace/internal/elastic/span.go @@ -162,7 +162,7 @@ func (s *spanEnrichmentContext) enrichTransaction( cfg config.ElasticTransactionConfig, ) { if cfg.TraceRoot.Enabled { - span.Attributes().PutBool(AttributeTransactionRoot, isTraceRoot(span)) + span.Attributes().PutBool(AttributeTraceRoot, isTraceRoot(span)) } if cfg.Name.Enabled { span.Attributes().PutStr(AttributeTransactionName, span.Name()) diff --git a/enrichments/trace/internal/elastic/span_test.go b/enrichments/trace/internal/elastic/span_test.go index 412ea76..d619c8b 100644 --- a/enrichments/trace/internal/elastic/span_test.go +++ b/enrichments/trace/internal/elastic/span_test.go @@ -43,7 +43,7 @@ func TestElasticTransactionEnrich(t *testing.T) { input: ptrace.NewSpan(), config: config.Enabled().Transaction, enrichedAttrs: map[string]any{ - AttributeTransactionRoot: true, + AttributeTraceRoot: true, AttributeTransactionName: "", AttributeEventOutcome: "success", AttributeTransactionResult: "Success", @@ -65,7 +65,7 @@ func TestElasticTransactionEnrich(t *testing.T) { }(), config: config.Enabled().Transaction, enrichedAttrs: map[string]any{ - AttributeTransactionRoot: true, + AttributeTraceRoot: true, AttributeTransactionName: "testtxn", AttributeEventOutcome: "success", AttributeTransactionResult: "HTTP 2xx", @@ -87,7 +87,7 @@ func TestElasticTransactionEnrich(t *testing.T) { }(), config: config.Enabled().Transaction, enrichedAttrs: map[string]any{ - AttributeTransactionRoot: true, + AttributeTraceRoot: true, AttributeTransactionName: "testtxn", AttributeEventOutcome: "success", AttributeTransactionResult: "HTTP 1xx", @@ -108,7 +108,7 @@ func TestElasticTransactionEnrich(t *testing.T) { }(), config: config.Enabled().Transaction, enrichedAttrs: map[string]any{ - AttributeTransactionRoot: true, + AttributeTraceRoot: true, AttributeTransactionName: "testtxn", AttributeEventOutcome: "success", AttributeTransactionResult: "HTTP 5xx", @@ -130,7 +130,7 @@ func TestElasticTransactionEnrich(t *testing.T) { }(), config: config.Enabled().Transaction, enrichedAttrs: map[string]any{ - AttributeTransactionRoot: true, + AttributeTraceRoot: true, AttributeTransactionName: "testtxn", AttributeEventOutcome: "success", AttributeTransactionResult: "OK", @@ -152,7 +152,7 @@ func TestElasticTransactionEnrich(t *testing.T) { }(), config: config.Enabled().Transaction, enrichedAttrs: map[string]any{ - AttributeTransactionRoot: true, + AttributeTraceRoot: true, AttributeTransactionName: "testtxn", AttributeEventOutcome: "success", AttributeTransactionResult: "Internal", @@ -169,7 +169,7 @@ func TestElasticTransactionEnrich(t *testing.T) { }(), config: config.Enabled().Transaction, enrichedAttrs: map[string]any{ - AttributeTransactionRoot: true, + AttributeTraceRoot: true, AttributeTransactionName: "testtxn", AttributeEventOutcome: "success", AttributeTransactionResult: "Success", @@ -186,7 +186,7 @@ func TestElasticTransactionEnrich(t *testing.T) { }(), config: config.Enabled().Transaction, enrichedAttrs: map[string]any{ - AttributeTransactionRoot: true, + AttributeTraceRoot: true, AttributeTransactionName: "testtxn", AttributeEventOutcome: "failure", AttributeTransactionResult: "Error", @@ -203,7 +203,7 @@ func TestElasticTransactionEnrich(t *testing.T) { }(), config: config.Enabled().Transaction, enrichedAttrs: map[string]any{ - AttributeTransactionRoot: true, + AttributeTraceRoot: true, AttributeTransactionName: "testtxn", AttributeEventOutcome: "success", AttributeTransactionResult: "Success",