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

[servicegraphprocessor] Edge loss attributes from client-side or server-side #16002

Closed
Frapschen opened this issue Nov 1, 2022 · 2 comments · Fixed by #16003
Closed

[servicegraphprocessor] Edge loss attributes from client-side or server-side #16002

Frapschen opened this issue Nov 1, 2022 · 2 comments · Fixed by #16003
Assignees
Labels
bug Something isn't working priority:p2 Medium processor/servicegraph Service graph processor

Comments

@Frapschen
Copy link
Contributor

Describe the issue you're reporting

Edge attributes are set by p.upsertDimensions() whatever span.kind is client or server:

case ptrace.SpanKindClient:
traceID := span.TraceID()
key := buildEdgeKey(traceID.HexString(), span.SpanID().HexString())
isNew, err = p.store.UpsertEdge(key, func(e *store.Edge) {
e.TraceID = traceID
e.ConnectionType = connectionType
e.ClientService = serviceName
e.ClientLatencySec = float64(span.EndTimestamp()-span.StartTimestamp()) / float64(time.Millisecond.Nanoseconds())
e.Failed = e.Failed || span.Status().Code() == ptrace.StatusCodeError
p.upsertDimensions(e.Dimensions, rAttributes, span.Attributes())
// A database request will only have one span, we don't wait for the server
// span but just copy details from the client span
if dbName, ok := findAttributeValue(semconv.AttributeDBName, rAttributes, span.Attributes()); ok {
e.ConnectionType = store.Database
e.ServerService = dbName
e.ServerLatencySec = float64(span.EndTimestamp()-span.StartTimestamp()) / float64(time.Millisecond.Nanoseconds())
}
})
case ptrace.SpanKindConsumer:
// override connection type and continue processing as span kind server
connectionType = store.MessagingSystem
fallthrough
case ptrace.SpanKindServer:
traceID := span.TraceID()
key := buildEdgeKey(traceID.HexString(), span.ParentSpanID().HexString())
isNew, err = p.store.UpsertEdge(key, func(e *store.Edge) {
e.TraceID = traceID
e.ConnectionType = connectionType
e.ServerService = serviceName
e.ServerLatencySec = float64(span.EndTimestamp()-span.StartTimestamp()) / float64(time.Millisecond.Nanoseconds())
e.Failed = e.Failed || span.Status().Code() == ptrace.StatusCodeError
p.upsertDimensions(e.Dimensions, rAttributes, span.Attributes())
})

it does't handle a sense that the two spans have a attribute with same name but different value, like client span have attribute of cluster: A but server span have attribute of cluster: B

we can add prefix to distinguish them:
client_cluster: A
server_cluster: B

@JaredTan95
Copy link
Member

make sense.

@evan-bradley evan-bradley added bug Something isn't working priority:p2 Medium processor/servicegraph Service graph processor and removed needs triage New item requiring triage labels Nov 1, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2022

Pinging code owners: @jpkrohling @mapno. See Adding Labels via Comments if you do not have permissions to add labels yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority:p2 Medium processor/servicegraph Service graph processor
Projects
None yet
3 participants