Skip to content
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
6 changes: 2 additions & 4 deletions enrichments/trace/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ type SpanEventConfig struct {
ErrorID AttributeConfig `mapstructure:"error_id"`
ErrorExceptionHandled AttributeConfig `mapstructure:"error_exception_handled"`
ErrorGroupingKey AttributeConfig `mapstructure:"error_grouping_key"`

// For no exceptions/errors
EventKind AttributeConfig `mapstructure:"event_kind"`
ErrorGroupingName AttributeConfig `mapstructure:"error_grouping_name"`
}

// AttributeConfig is the configuration options for each attribute.
Expand Down Expand Up @@ -141,7 +139,7 @@ func Enabled() Config {
ErrorID: AttributeConfig{Enabled: true},
ErrorExceptionHandled: AttributeConfig{Enabled: true},
ErrorGroupingKey: AttributeConfig{Enabled: true},
EventKind: AttributeConfig{Enabled: true},
ErrorGroupingName: AttributeConfig{Enabled: true},
},
}
}
1 change: 1 addition & 0 deletions enrichments/trace/internal/elastic/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ const (
AttributeErrorID = "error.id"
AttributeErrorExceptionHandled = "error.exception.handled"
AttributeErrorGroupingKey = "error.grouping_key"
AttributeErrorGroupingName = "error.grouping_name"
)
5 changes: 5 additions & 0 deletions enrichments/trace/internal/elastic/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,11 @@ func (s *spanEventEnrichmentContext) enrich(
}
se.Attributes().PutStr(AttributeErrorGroupingKey, hex.EncodeToString(hash.Sum(nil)))
}
if cfg.ErrorGroupingName.Enabled {
if s.exceptionMessage != "" {
se.Attributes().PutStr(AttributeErrorGroupingName, s.exceptionMessage)
}
}

// Transaction type and sampled are added as span event enrichment only for errors
if parentCtx.isTransaction && s.exception {
Expand Down
2 changes: 2 additions & 0 deletions enrichments/trace/internal/elastic/span_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@ func TestSpanEventEnrich(t *testing.T) {
hash.Write([]byte("java.net.ConnectionError"))
return hex.EncodeToString(hash.Sum(nil))
}(),
AttributeErrorGroupingName: "something is wrong",
AttributeTransactionSampled: true,
AttributeTransactionType: "unknown",
},
Expand Down Expand Up @@ -843,6 +844,7 @@ func TestSpanEventEnrich(t *testing.T) {
hash.Write([]byte("java.net.ConnectionError"))
return hex.EncodeToString(hash.Sum(nil))
}(),
AttributeErrorGroupingName: "something is wrong",
},
},
} {
Expand Down