Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use transaction root attribute name #71

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions enrichments/trace/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type ResourceConfig struct {
// ElasticTransactionConfig configures the enrichment attributes for the
// spans which are identified as elastic transaction.
type ElasticTransactionConfig struct {
TraceRoot AttributeConfig `mapstructure:"trace_root"`
Root AttributeConfig `mapstructure:"root"`
Name AttributeConfig `mapstructure:"name"`
Type AttributeConfig `mapstructure:"type"`
Result AttributeConfig `mapstructure:"result"`
Expand Down Expand Up @@ -61,7 +61,7 @@ func Enabled() Config {
AgentVersion: AttributeConfig{Enabled: true},
},
Transaction: ElasticTransactionConfig{
TraceRoot: AttributeConfig{Enabled: true},
Root: AttributeConfig{Enabled: true},
Name: AttributeConfig{Enabled: true},
Type: AttributeConfig{Enabled: true},
Result: AttributeConfig{Enabled: true},
Expand Down
2 changes: 1 addition & 1 deletion enrichments/trace/internal/elastic/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const (
AttributeAgentVersion = "agent.version"

// span attributes
AttributeTraceRoot = "trace.root"
AttributeTransactionRoot = "transaction.root"
AttributeTransactionName = "transaction.name"
AttributeTransactionType = "transaction.type"
AttributeTransactionResult = "transaction.result"
Expand Down
4 changes: 2 additions & 2 deletions enrichments/trace/internal/elastic/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ func (s *spanEnrichmentContext) enrichTransaction(
span ptrace.Span,
cfg config.ElasticTransactionConfig,
) {
if cfg.TraceRoot.Enabled {
span.Attributes().PutBool(AttributeTraceRoot, isTraceRoot(span))
if cfg.Root.Enabled {
span.Attributes().PutBool(AttributeTransactionRoot, isTraceRoot(span))
}
if cfg.Name.Enabled {
span.Attributes().PutStr(AttributeTransactionName, span.Name())
Expand Down
18 changes: 9 additions & 9 deletions enrichments/trace/internal/elastic/span_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestElasticTransactionEnrich(t *testing.T) {
input: ptrace.NewSpan(),
config: config.Enabled().Transaction,
enrichedAttrs: map[string]any{
AttributeTraceRoot: true,
AttributeTransactionRoot: true,
AttributeTransactionName: "",
AttributeEventOutcome: "success",
AttributeTransactionResult: "Success",
Expand All @@ -65,7 +65,7 @@ func TestElasticTransactionEnrich(t *testing.T) {
}(),
config: config.Enabled().Transaction,
enrichedAttrs: map[string]any{
AttributeTraceRoot: true,
AttributeTransactionRoot: true,
AttributeTransactionName: "testtxn",
AttributeEventOutcome: "success",
AttributeTransactionResult: "HTTP 2xx",
Expand All @@ -87,7 +87,7 @@ func TestElasticTransactionEnrich(t *testing.T) {
}(),
config: config.Enabled().Transaction,
enrichedAttrs: map[string]any{
AttributeTraceRoot: true,
AttributeTransactionRoot: true,
AttributeTransactionName: "testtxn",
AttributeEventOutcome: "success",
AttributeTransactionResult: "HTTP 1xx",
Expand All @@ -108,7 +108,7 @@ func TestElasticTransactionEnrich(t *testing.T) {
}(),
config: config.Enabled().Transaction,
enrichedAttrs: map[string]any{
AttributeTraceRoot: true,
AttributeTransactionRoot: true,
AttributeTransactionName: "testtxn",
AttributeEventOutcome: "success",
AttributeTransactionResult: "HTTP 5xx",
Expand All @@ -130,7 +130,7 @@ func TestElasticTransactionEnrich(t *testing.T) {
}(),
config: config.Enabled().Transaction,
enrichedAttrs: map[string]any{
AttributeTraceRoot: true,
AttributeTransactionRoot: true,
AttributeTransactionName: "testtxn",
AttributeEventOutcome: "success",
AttributeTransactionResult: "OK",
Expand All @@ -152,7 +152,7 @@ func TestElasticTransactionEnrich(t *testing.T) {
}(),
config: config.Enabled().Transaction,
enrichedAttrs: map[string]any{
AttributeTraceRoot: true,
AttributeTransactionRoot: true,
AttributeTransactionName: "testtxn",
AttributeEventOutcome: "success",
AttributeTransactionResult: "Internal",
Expand All @@ -169,7 +169,7 @@ func TestElasticTransactionEnrich(t *testing.T) {
}(),
config: config.Enabled().Transaction,
enrichedAttrs: map[string]any{
AttributeTraceRoot: true,
AttributeTransactionRoot: true,
AttributeTransactionName: "testtxn",
AttributeEventOutcome: "success",
AttributeTransactionResult: "Success",
Expand All @@ -186,7 +186,7 @@ func TestElasticTransactionEnrich(t *testing.T) {
}(),
config: config.Enabled().Transaction,
enrichedAttrs: map[string]any{
AttributeTraceRoot: true,
AttributeTransactionRoot: true,
AttributeTransactionName: "testtxn",
AttributeEventOutcome: "failure",
AttributeTransactionResult: "Error",
Expand All @@ -203,7 +203,7 @@ func TestElasticTransactionEnrich(t *testing.T) {
}(),
config: config.Enabled().Transaction,
enrichedAttrs: map[string]any{
AttributeTraceRoot: true,
AttributeTransactionRoot: true,
AttributeTransactionName: "testtxn",
AttributeEventOutcome: "success",
AttributeTransactionResult: "Success",
Expand Down