-
Notifications
You must be signed in to change notification settings - Fork 624
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
sdk: span parents are now always spancontext #548
sdk: span parents are now always spancontext #548
Conversation
Exporter and span handling complexity was increasing due to the Span.parent attribute being either a Span or a SpanContext. As there is no requirement in the specification to have the parent attribute be a Span, removing this complexity and handling.
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.
LGTM. FWIW it looks like we got to the current design because the spec used to require different args for remote (SpanContext) and local (Span) parents: #33 (comment), open-telemetry/opentelemetry-specification#136 (comment).
Yeah, that makes sense: there's limited data to construct a full span in the remote scenario. But just to confirm, there's no rationale for the Span inheriting that complexity, correct? The only caveat I can see here is that exporters will not be able to provide more information around the parent span if it's local, but considering the exporter should have also seen the parent span, I feel like that's not a big issue. |
The parent usually ends after the child, so that can be a big issue, if the exporter really relied on that feature. |
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.
This is a great cleanup! Just added some questions to make sure I understand what this change is doing. There seems to be some parts of the code that still expect either a Span or a SpanContext, but the change name specifically suggests removing that. Is the expectation that in the case of a remote span, the object will still be a Span and not a SpanContext?
I'll ask again: Over a simple (API-implemented) method like: def get_parent_context(self):
if isinstance(self.parent, Span): return self.parent.get_context()
else: return self.parent does this add any significant improvements to combat
? I feel not. There may still be a merit to this PR but IMHO it needs to be justified better. Exporter and span handling complexity should decrease just the same, but we still give exporters more info about the parent if it is local (I thin we should also recommend passing a local : As said, exporters will often not have the parents available when they process the child. They may be in different batches, or even different export intervals if the child/parent end long before/after one another. There is no guarantee at all here. This topic is a bit of a pet peeve for me because of open-telemetry/opentelemetry-specification#525 (comment). |
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 for clarifying my questions.
@Oberon00 regarding your comment about providing a way to extract parent information from the context: I do see the two as providing equal functionality to an exporter. The reason I currently favor this approach is it's still compliant with the current spec as written. Reading through your links (and thank you for posting them!), I am convinced that your proposal would work fine, and that it would be good to eliminate either Span or SpanContext to do away with this complexity altogether. Happy to comment and help with moving the spec, but for the time being I feel like this PR is a good way to eliminate some boilerplate complexity that exists now. Thoughts with accepting this as an acceptable current solution? |
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.
@toumorokoshi I think the approach of this PR is indeed acceptable, and removing the storage of Span as parent does indeed reduce complexity even more than just providing a getter/property while still storing both. I just wanted to be sure that this is well-considered, which I'm now convinced it is. 😃
ext/opentelemetry-ext-docker-tests/tests/pymongo/test_pymongo_functional.py
Outdated
Show resolved
Hide resolved
ext/opentelemetry-ext-jaeger/src/opentelemetry/ext/jaeger/__init__.py
Outdated
Show resolved
Hide resolved
It looks like we might have a flaky integration test after #526?
|
Those errors are showing up during the startup check of mysql. I made a change to The failing tests should have been fixed in this change: 0740696 |
But 0740696 is in this branch already? |
Ah i see, the pymysql tests have the same tests I fixed in the other sql related tests in that change. |
Thanks @codeboten for fixing the branch! |
Exporter and span handling complexity was increasing due to the Span.parent attribute being either a Span or a SpanContext. As there is no requirement in the specification to have the parent attribute be a Span, removing this complexity and handling. Co-authored-by: Chris Kleinknecht <[email protected]> Co-authored-by: Alex Boten <[email protected]>
Exporter and span handling complexity was increasing due to the
Span.parent attribute being either a Span or a SpanContext.
As there is no requirement in the specification to have the parent
attribute be a Span, removing this complexity and handling.