-
Notifications
You must be signed in to change notification settings - Fork 530
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
Improve servicegraph handling of newer OTEL semantic conventions #3711
Conversation
) | ||
|
||
// Check for db.name first. The dbName is set initially to maintain backwards compatbility. | ||
if name, ok := processor_util.FindAttributeValue(string(semconv.DBNameKey), resourceAttr, span.Attributes); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pattern here loops over the span and resource attributes to find specific keys. This means that if you use the preferred attributes in the spans, then the generator has to do less work. I'd considered finding all available keys in one pass, but following the existing pattern elsewhere feels simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a GTM perspective, this is great, thank you Zach!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for updating the docs!
// Check for network.peer.address and network.peer.port. Use port if it is present. | ||
if host, ok := processor_util.FindAttributeValue(string(semconv.NetworkPeerAddressKey), resourceAttr, span.Attributes); ok { | ||
if port, ok := processor_util.FindAttributeValue(string(semconv.NetworkPeerPortKey), resourceAttr, span.Attributes); ok { | ||
e.ServerService = fmt.Sprintf("%s:%s", host, port) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about the carnality here too, but I think because this is server side information, we should be okay since I expect server name/port combos to be significantly less than the ephemeral ports in use by the client. Good thing to watch out for when we roll for sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 🙂
CHANGELOG.md
Outdated
@@ -49,6 +49,7 @@ | |||
* [ENHANCEMENT] TraceQL - Add support for scoped intrinsics using `:` [#3629](https://github.com/grafana/tempo/pull/3629) (@ie-pham) | |||
available scoped intrinsics: trace:duration, trace:rootName, trace:rootService, span:duration, span:kind, span:name, span:status, span:statusMessage | |||
* [ENHANCEMENT] Performance improvements on TraceQL and tag value search. [#3650](https://github.com/grafana/tempo/pull/3650),[#3667](https://github.com/grafana/tempo/pull/3667) (@joe-elliott) | |||
* [ENHANCEMENT] Improve use of OTEL semantic conventions on the service graph [#3711](https://github.com/grafana/tempo/pull/3711) (@zalegrala) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might have to move this back up the changelog, unless we backport this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thank you.
// if we have a server.address, use it as the database ServerService | ||
// if we have a network.peer.address, use it as the database ServerService. Include :port if network.peer.port is present | ||
// if we have a db.name, use it as the database ServerService, which is the backwards-compatible behavior | ||
func (p *Processor) upsertDatabaseRequest(e *store.Edge, resourceAttr []*v1_common.KeyValue, span *v1_trace.Span) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea to break this out in a separate function 👍
6211030
to
ca5189a
Compare
What this PR does:
Currently, the
db.name
attribute is used as the node identity on the service graph. This leads to situations where the name of the database may be reused between services, leading to a single node on the graph where more than one actual service is in use.This PR changes the node identity when newer OTEL semantic conventions are available as attributes on the span. The following attributes are considered in order:
peer.service
server.address
network.peer.address
-- additionallynetwork.peer.port
will be used if availabledb.name
Which issue(s) this PR fixes:
Fixes #3010
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]