-
Notifications
You must be signed in to change notification settings - Fork 197
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
feat: add service target fields support to http and grpc requests #1287
Changes from 5 commits
21bb1e5
e0928c4
25194f0
dc3b973
39b7b00
c644584
b20d91c
df30354
1a40227
6f0b1e4
b71201f
bea474e
8bddb28
77a8519
eafcc60
bc60085
3637393
1fe6fc5
f5b75a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,6 +218,10 @@ func (c *SpanContext) SetHTTPRequest(req *http.Request) { | |
Name: destinationServiceURL.String(), | ||
Resource: destinationServiceResource, | ||
}) | ||
c.SetServiceTarget(ServiceTargetSpanContext{ | ||
Type: "http", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to https://github.com/elastic/apm/blob/main/specs/agents/tracing-spans-service-target.md#field-values:
This would mean, for example, Elasticsearch spans would have What I'd suggest is we leave it empty here, and then set the default in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: I was planning to do the fallback mechanism in a separate PR: #1294
The current approach was mostly based on what
I think this approach won't work: WDYT ?
kruskall marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Name: destinationServiceResource, | ||
}) | ||
} | ||
|
||
// SetHTTPStatusCode records the HTTP response status code. | ||
|
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.
Same issue, test is failing because it's not an exit span. Should we update this in the issue to omit
service.target
for non-exit spans?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.
Ah, and we don't have a way to mark some gRPC spans as exit spans yet...
Yes, let's just update this PR to omit for non-exit spans.
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 span context doesn't know if the parent span is an exit span. I'm not sure how to proceed, should we add a field to the span context ? I'd prefer to avoid that as it feels like coupling different components
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 also don't think we add the exit flag as a field. Here's a couple of options that come to mind:
Span.End
to do something like this:Maybe like this:
span.exit
intoSpanContext.build()
inbuildModelSpan
:apm-agent-go/modelwriter.go
Line 156 in 99546a3
And
build()
would clear themodel.SpanContext.Service
field for non-exit spans.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 help! 🙇
Quick question before pushing more changes: do we have a way to mark grpc/http requests as exit spans ? The latest change is going to reduce coverage of this feature because the spans used in testing are not exit spans.
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.
Not at the moment. For gRPC, we always assume that the target service is instrumented and pass trace context. Thus it should not be considered an "exit" span. I think we should make this configurable. I opened an issue about doing this for
apmhttp
spans recently, and have just updated it to also takeapmgrpc
client spans into account: #1304There 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.
@kruskall sorry, I led you astray due to my own confusion around exit spans and trace-context propagation. We should be marking HTTP, gRPC, Elasticsearch, and some other spans as "exit spans" by default. See #1315
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.
No worries 😄
I think this PR grew in scope quite a lot, I've spli the fix in a separate PR: #1317