-
Notifications
You must be signed in to change notification settings - Fork 246
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
refactor: context only parenting #398
refactor: context only parenting #398
Conversation
0e6e622
to
a7dbe52
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.
I realize this is just a prototype, but it looks like a good improvement to me 👍
open-telemetry/opentelemetry-specification#875 also requires |
a7dbe52
to
301c4ae
Compare
This is ready for review and can merge when folks are comfortable with it. The corresponding spec changes merged earlier today: open-telemetry/opentelemetry-specification#875. |
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 makes sense to me.
This PR is a draft showing what changes would be required to restrict explicit span parenting to context only (rather than allowing a span, or context). This is an effort towards validating that: open-telemetry/opentelemetry-specification#510 is viable in Ruby.
There were two options to provide an explicit parent to
start_span
and friends. One was namedwith_parent
and expected an argument to be a span. The other was namedwith_parent_context
where the argument was a context. In this PR we removedwith_parent_context
and updatedwith_parent
to accept a context rather than a span.I also added a
Tracer#context_with_span
convenience method which is the equivalent ofctx = tracer.with_span(span) { |_, c| c }
, which was something I found myself doing in tests when I removed explicit span based parenting.The original
with_parent
option was only used in tests. Instrumentation usedwith_parent_context
, further validating context based parenting want we want.