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

Add standard tags for internal warnings and span format #6524

Merged
merged 6 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion cmd/collector/app/span_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func (sp *spanProcessor) enqueueSpan(span *model.Span, originalFormat processor.
}

// add format tag
span.Tags = append(span.Tags, model.String("internal.span.format", string(originalFormat)))
span.Tags = append(span.Tags, model.String("@jaeger@format", string(originalFormat)))

item := queueItem{
queuedTime: time.Now(),
Expand Down
2 changes: 1 addition & 1 deletion internal/jptrace/warning.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const (
// store various warnings produced from transformations,
// such as inbound sanitizers and outbound adjusters.
// The value type of the attribute is a string slice.
WarningsAttribute = "jaeger.internal.warnings"
yurishkuro marked this conversation as resolved.
Show resolved Hide resolved
WarningsAttribute = "@jaeger@warnings"
)

func AddWarnings(span ptrace.Span, warnings ...string) {
Expand Down
8 changes: 4 additions & 4 deletions internal/jptrace/warning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ func TestAddWarning(t *testing.T) {
span := ptrace.NewSpan()
attrs := span.Attributes()
if test.existing != nil {
warnings := attrs.PutEmptySlice("jaeger.internal.warnings")
warnings := attrs.PutEmptySlice("@jaeger@warnings")
for _, warn := range test.existing {
warnings.AppendEmpty().SetStr(warn)
}
}
AddWarnings(span, test.newWarn)
warnings, ok := attrs.Get("jaeger.internal.warnings")
warnings, ok := attrs.Get("@jaeger@warnings")
assert.True(t, ok)
assert.Equal(t, len(test.expected), warnings.Slice().Len())
for i, expectedWarn := range test.expected {
Expand All @@ -61,7 +61,7 @@ func TestAddWarning(t *testing.T) {
func TestAddWarning_MultipleWarnings(t *testing.T) {
span := ptrace.NewSpan()
AddWarnings(span, "warning-1", "warning-2")
warnings, ok := span.Attributes().Get("jaeger.internal.warnings")
warnings, ok := span.Attributes().Get("@jaeger@warnings")
require.True(t, ok)
require.Equal(t, "warning-1", warnings.Slice().At(0).Str())
require.Equal(t, "warning-2", warnings.Slice().At(1).Str())
Expand Down Expand Up @@ -94,7 +94,7 @@ func TestGetWarnings(t *testing.T) {
span := ptrace.NewSpan()
attrs := span.Attributes()
if test.existing != nil {
warnings := attrs.PutEmptySlice("jaeger.internal.warnings")
warnings := attrs.PutEmptySlice("@jaeger@warnings")
for _, warn := range test.existing {
warnings.AppendEmpty().SetStr(warn)
}
Expand Down