-
Notifications
You must be signed in to change notification settings - Fork 200
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
OpenTelemetry tracing bridge #1410
Conversation
Some areas are unfortunately impossible to test (setting tags on spans/transactions for example), because the data isn't readable within the test. |
I may have missed some things, but it's hard to say without real world usage. So I am marking this PR as ready for review. |
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.
just a quick review, haven't dived into all the details
module/apmotel/span.go
Outdated
haveHTTPContext = true | ||
haveHTTPHostTag = true | ||
httpHost = v.Value.Emit() | ||
|
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 previous attempt at the Otel bridge used a lot more attribute settings, maybe that's useful? https://github.com/elastic/apm-agent-go/pull/1203/files#diff-4bd41254646c6c5baf269f5e8128d6f7d327bd52ee17256ccedfe075bd5de1fdR70-R167
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.
It seems trickier than that. The logic between the one here (from apmot) and in that branch are quite different.
Some attributes are added, and others are removed.
I wonder if we need a spec to have a consistent behavior, as every language implementation is going to have this problem.
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 wonder too. @felixbarny would you happen to know?
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.
We don't have to map all attributes but we have to map some. We have a cross-agent spec for that: https://github.com/elastic/apm/blob/main/specs/agents/tracing-api-otel.md#attributes-mapping
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 have updated the attributes based on the mentioned spec, while also keeping the http and db context, which aren't specified.
Co-authored-by: Marc Lopez Rubio <[email protected]>
Co-authored-by: Marc Lopez Rubio <[email protected]>
Co-authored-by: Marc Lopez Rubio <[email protected]>
Co-authored-by: Marc Lopez Rubio <[email protected]>
Co-authored-by: Marc Lopez Rubio <[email protected]>
5c0aff6
to
d9803ed
Compare
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.
Looks mostly good, just a few questions. I haven't looked at the tests in detail yet.
case "messaging.system": | ||
s.span.Type = "messaging" | ||
s.span.Subtype = v.Value.Emit() | ||
serviceTargetType = v.Value.Emit() |
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.
Looking at the spec, looks like we're not handling the messaging.url
attribute:
type = 'messaging';
subtype = a['messaging.system'];
if (!netName && a['messaging.url']) {
netName = parseNetName(a['messaging.url']);
}
serviceTargetType = subtype;
serviceTargetName = a['messaging.destination'] || null;
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.
Yeah. The spec is weird about that. netName
is never used with messaging. And with an if/else
case as they have the net case would never run if the messaging one does.
This section therefore seems like dead code. I've written a note to follow up on figuring out if the spec should be fixed, but didn't get to it yet.
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.
thanks!
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.
After talking with @SylvainJuge about it, I have opened a spec fix: elastic/apm#787
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.
Looks good! Thanks for bearing with me with all the comments. It was a pretty big PR to review.
This setups a bridge (our own SDK actually) which allows us to use the OpenTelemetry APIs alongside our agent.