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

fix otlp database span resource #241

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion input/otlp/test_approved/span_jaeger_db.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"destination": {
"service": {
"name": "sql",
"resource": "mysql://db:3306",
"resource": "mysql/db01",
"type": "db"
}
},
Expand Down
3 changes: 1 addition & 2 deletions input/otlp/traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -912,14 +912,13 @@ func TranslateSpan(spanKind ptrace.SpanKind, attributes pcommon.Map, event *mode
if event.Span.Subtype != "" {
serviceTarget.Type = event.Span.Subtype
if destinationService.Name == "" {
// For database requests, we currently just identify
// the destination service by db.system.
destinationService.Name = event.Span.Subtype
destinationService.Resource = event.Span.Subtype
}
}
if db.Instance != "" {
serviceTarget.Name = db.Instance
destinationService.Resource = serviceTarget.Type + "/" + db.Instance
}
case isMessaging:
event.Span.Type = "messaging"
Expand Down
2 changes: 1 addition & 1 deletion input/otlp/traces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ func TestDatabaseSpan(t *testing.T) {
assert.Empty(t, cmp.Diff(&modelpb.DestinationService{
Type: "db",
Name: "mysql",
Resource: "mysql",
Resource: "mysql/ShopDb",
}, event.Span.DestinationService, protocmp.Transform()))
}

Expand Down
Loading