-
Notifications
You must be signed in to change notification settings - Fork 603
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
CLIENT spans should update their parent span's kind to INTERNAL #456
Comments
Wouldn't this only make sense for the specific use case that was outlined above? (instrumented with multiple libraries that have the same code path). |
Yes, but as a rule it sounds much simpler to just always update parent to INTERNAL if the generated span is being set to CLIENT. This simple rule takes care of all cases. If we force the code to first check the kind of parent span, both the rule and implementations might get more complicated for no apparent benefit. Not to mention some span implementations may be write only and not even allow ready the any values like kind. |
@owais |
I didn't mean that SDK Span should do it automatically. I was suggesting that every instrumentation does it independently. Each instrumentation can fetch the current local span (it's eventual parent span) with |
@owais
Is this true? Aren't there valid use cases where the parent span of a (to be) generated CLIENT span shouldn't be INTERNAL> For example, if a user has a flask application instrumented with flask instrumentation and requests instrumentation. They hit an endpoint whose logic makes an http request call to some other endpoint. A SERVER span is generated for hitting the flask endpoint, and it's child, a CLIENT span is generated in the logic that results from hitting the flask endpoint. In the requests instrumentation, it doesn't make sense to automatically change the parent span (current span) 's kind to INTERNAL right? As well, span kinds cannot be changed after creation, so in instrumentations, we would actually have to copy the span and create a new one. After this, we would have to replace it in the current context. Not only that, if users copied/used the original copy of the span in their code somewhere via Unless if I am misunderstanding something, this seems quite complex for this automatic "magic" logic. |
You're right. There is the use case where SERVER's spans immediate child is a CLIENT span and such a CLIENT span shouldn't change it's parent's kind.
yea, that would be complex but if we agree with the solution, we can try adding an |
Today all instrumentations that trace outgoing network calls generate spans with kind set to CLIENT. Most higher level libraries internally use lower level code to make such calls. If a user uses instrumentations for both of the libraries, they'll end up with two (or more) parent - child spans both with kind set to CLIENT. For example, requests may internally use urllib or a database client such as etcd may internally use requests, etc.
To remedy such cases, I propose all instrumentations that generate such client spans should always update their parent span's kind to INTERNAL. This way instrumentations do not need to be aware of each other and do not need to communicate with each other via context or any other mechanism.
Depends on: open-telemetry/opentelemetry-python#1774
The text was updated successfully, but these errors were encountered: