Skip to content

Commit 8eda486

Browse files
authored
Use transaction root attribute name (#71)
1 parent 3a9ee65 commit 8eda486

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

enrichments/trace/config/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type ResourceConfig struct {
3333
// ElasticTransactionConfig configures the enrichment attributes for the
3434
// spans which are identified as elastic transaction.
3535
type ElasticTransactionConfig struct {
36-
TraceRoot AttributeConfig `mapstructure:"trace_root"`
36+
Root AttributeConfig `mapstructure:"root"`
3737
Name AttributeConfig `mapstructure:"name"`
3838
Type AttributeConfig `mapstructure:"type"`
3939
Result AttributeConfig `mapstructure:"result"`
@@ -61,7 +61,7 @@ func Enabled() Config {
6161
AgentVersion: AttributeConfig{Enabled: true},
6262
},
6363
Transaction: ElasticTransactionConfig{
64-
TraceRoot: AttributeConfig{Enabled: true},
64+
Root: AttributeConfig{Enabled: true},
6565
Name: AttributeConfig{Enabled: true},
6666
Type: AttributeConfig{Enabled: true},
6767
Result: AttributeConfig{Enabled: true},

enrichments/trace/internal/elastic/attributes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const (
2323
AttributeAgentVersion = "agent.version"
2424

2525
// span attributes
26-
AttributeTraceRoot = "trace.root"
26+
AttributeTransactionRoot = "transaction.root"
2727
AttributeTransactionName = "transaction.name"
2828
AttributeTransactionType = "transaction.type"
2929
AttributeTransactionResult = "transaction.result"

enrichments/trace/internal/elastic/span.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ func (s *spanEnrichmentContext) enrichTransaction(
161161
span ptrace.Span,
162162
cfg config.ElasticTransactionConfig,
163163
) {
164-
if cfg.TraceRoot.Enabled {
165-
span.Attributes().PutBool(AttributeTraceRoot, isTraceRoot(span))
164+
if cfg.Root.Enabled {
165+
span.Attributes().PutBool(AttributeTransactionRoot, isTraceRoot(span))
166166
}
167167
if cfg.Name.Enabled {
168168
span.Attributes().PutStr(AttributeTransactionName, span.Name())

enrichments/trace/internal/elastic/span_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func TestElasticTransactionEnrich(t *testing.T) {
4343
input: ptrace.NewSpan(),
4444
config: config.Enabled().Transaction,
4545
enrichedAttrs: map[string]any{
46-
AttributeTraceRoot: true,
46+
AttributeTransactionRoot: true,
4747
AttributeTransactionName: "",
4848
AttributeEventOutcome: "success",
4949
AttributeTransactionResult: "Success",
@@ -65,7 +65,7 @@ func TestElasticTransactionEnrich(t *testing.T) {
6565
}(),
6666
config: config.Enabled().Transaction,
6767
enrichedAttrs: map[string]any{
68-
AttributeTraceRoot: true,
68+
AttributeTransactionRoot: true,
6969
AttributeTransactionName: "testtxn",
7070
AttributeEventOutcome: "success",
7171
AttributeTransactionResult: "HTTP 2xx",
@@ -87,7 +87,7 @@ func TestElasticTransactionEnrich(t *testing.T) {
8787
}(),
8888
config: config.Enabled().Transaction,
8989
enrichedAttrs: map[string]any{
90-
AttributeTraceRoot: true,
90+
AttributeTransactionRoot: true,
9191
AttributeTransactionName: "testtxn",
9292
AttributeEventOutcome: "success",
9393
AttributeTransactionResult: "HTTP 1xx",
@@ -108,7 +108,7 @@ func TestElasticTransactionEnrich(t *testing.T) {
108108
}(),
109109
config: config.Enabled().Transaction,
110110
enrichedAttrs: map[string]any{
111-
AttributeTraceRoot: true,
111+
AttributeTransactionRoot: true,
112112
AttributeTransactionName: "testtxn",
113113
AttributeEventOutcome: "success",
114114
AttributeTransactionResult: "HTTP 5xx",
@@ -130,7 +130,7 @@ func TestElasticTransactionEnrich(t *testing.T) {
130130
}(),
131131
config: config.Enabled().Transaction,
132132
enrichedAttrs: map[string]any{
133-
AttributeTraceRoot: true,
133+
AttributeTransactionRoot: true,
134134
AttributeTransactionName: "testtxn",
135135
AttributeEventOutcome: "success",
136136
AttributeTransactionResult: "OK",
@@ -152,7 +152,7 @@ func TestElasticTransactionEnrich(t *testing.T) {
152152
}(),
153153
config: config.Enabled().Transaction,
154154
enrichedAttrs: map[string]any{
155-
AttributeTraceRoot: true,
155+
AttributeTransactionRoot: true,
156156
AttributeTransactionName: "testtxn",
157157
AttributeEventOutcome: "success",
158158
AttributeTransactionResult: "Internal",
@@ -169,7 +169,7 @@ func TestElasticTransactionEnrich(t *testing.T) {
169169
}(),
170170
config: config.Enabled().Transaction,
171171
enrichedAttrs: map[string]any{
172-
AttributeTraceRoot: true,
172+
AttributeTransactionRoot: true,
173173
AttributeTransactionName: "testtxn",
174174
AttributeEventOutcome: "success",
175175
AttributeTransactionResult: "Success",
@@ -186,7 +186,7 @@ func TestElasticTransactionEnrich(t *testing.T) {
186186
}(),
187187
config: config.Enabled().Transaction,
188188
enrichedAttrs: map[string]any{
189-
AttributeTraceRoot: true,
189+
AttributeTransactionRoot: true,
190190
AttributeTransactionName: "testtxn",
191191
AttributeEventOutcome: "failure",
192192
AttributeTransactionResult: "Error",
@@ -203,7 +203,7 @@ func TestElasticTransactionEnrich(t *testing.T) {
203203
}(),
204204
config: config.Enabled().Transaction,
205205
enrichedAttrs: map[string]any{
206-
AttributeTraceRoot: true,
206+
AttributeTransactionRoot: true,
207207
AttributeTransactionName: "testtxn",
208208
AttributeEventOutcome: "success",
209209
AttributeTransactionResult: "Success",

0 commit comments

Comments
 (0)