Replies: 3 comments 2 replies
-
This is an interesting option - it leaves
Alternatively, we could move it to another convenience gem that does not have the same versioning and stability constraints as the API. |
Beta Was this translation helpful? Give feedback.
-
As I mentioned elsewhere, I didn't know about this behavior until today! Suffice it to say it surprised me. 😄 Regarding the options, my thoughts are:
🚫 The current behavior is pretty confusing, and it's not even clear that it's confusing until you find out the hard way. I don't think we should leave it as-is.
😐 I'm neutral on this. I think that if we keep the
✅ I think this is my preferred option. If we take this approach, then I think we must document to users what their alternatives are; since there are some people (me!) that are definitely mucking around with the
🚫 Perhaps it could be extracted to a gem, maybe. But I think we should support it somehow, somewhere - it's just so elegant and ruby-ish to me. I really, truly like it. 😆 As an aside - I know the "Convenience API" is an idea percolating about the community. I think we should take care to balance useful things in our library against an updated API that may not exist for a long time (if ever!). That is to say: we should find a way to support useful things like this and let that contribute back to the "Convenience API" discussion as it unfolds, so that our end-users have a better time of things. After all, the more traction that OpenTelemetry gets, the better the whole ecosystem gets for everyone! 😄 (I'd be willing to help out significantly on the convenience API front - that overlaps a lot with what I'm doing at $DAYJOB). |
Beta Was this translation helpful? Give feedback.
-
Follow-up from the SIG meeting... We discussed this extensively on today's call. The consensus was that we should leave this in the API but remove the explicit parent span option (since that's the contentious bit, and we can add it back later without breaking API compatibility). This bit of the Span Creation spec permits this addition:
|
Beta Was this translation helpful? Give feedback.
-
Behavior of Tracer#in_span
Tracer#in_span
is a non-spec'd convenience method that we've added to the Ruby OpenTelemetry implementation. It's widely used in our instrumentation and is pretty straightforward when used with an implicit context. However, when using an explicit context the behavior and expectations become a little more murky. Consider the following examples:With implicit context
If the current (implicit) context is:
then
Details
in_span
does the following when using an implicit context:With explicit context
If we have the same current (implicit) context:
and an explicit context, named
ctx
then
Details
in_span
does the following when using an explicit context:In this example, we derive a new context from the implicit context, but use the parent span from the explicit context. Any other entries in the explicit context, such as baggage, are not part of the newly created context. The resulting context is somewhat of a hybrid between the implicit and explicit contexts.
Alternative
There are some questions as to what the actual behavior should be here, but it can be surprising that only the span is used from the explicit context and that baggage (and anything else) stored in the explicit context are not available in the block. It might make sense to derive the new context from the explicit context, rather than the implicit context. For example:
There are currently bugs in some of our instrumentation packages due to this exact issue. See
In both the baggage from the extracted context is not available within the
in_span
block.What should we do?
Since
Tracer#in_span
is not officially spec'd, we need to agree on what the behavior should before our 1.0 release and commit to supporting the behavior. We have a handful of options:in_span
completelyI just wanted to open this up for discussion and list out some possible ways forward. Feel free to chime in with other suggestions.
See also
This has been discussed in the following PRs / Issues:
Beta Was this translation helpful? Give feedback.
All reactions