Skip to content

Conversation

@zeitlinger
Copy link
Member

Fixes #1632

@zeitlinger zeitlinger requested a review from a team January 6, 2025 11:17
@trask
Copy link
Member

trask commented Jan 6, 2025

I'm not sure there is any difference? (sort of related to open-telemetry/opentelemetry-java-instrumentation#12952)

@zeitlinger
Copy link
Member Author

I'm not sure there is any difference? (sort of related to open-telemetry/opentelemetry-java-instrumentation#12952)

can you elaborate?

@trask
Copy link
Member

trask commented Jan 7, 2025

can you elaborate?

sorry, I'm wondering why this change is needed? can you give a concrete example of when this implementation would have different behavior from existing implementation?

@zeitlinger
Copy link
Member Author

sorry, I'm wondering why this change is needed? can you give a concrete example of when this implementation would have different behavior from existing implementation?

When a baggage item is added after span start:

  Span span = sdk.getTracer("test").spanBuilder("test").startSpan();

      try (Scope unused = span.makeCurrent()) {
        try (Scope scope = Baggage.current().toBuilder().put("key", "value").build()
            .makeCurrent()) {
          span.end();
        }
      }

@trask
Copy link
Member

trask commented Jan 7, 2025

yeah, but that doesn't work when we follow open-telemetry/opentelemetry-java-instrumentation#12952

@zeitlinger
Copy link
Member Author

yeah, but that doesn't work when we follow open-telemetry/opentelemetry-java-instrumentation#12952

OK - so you're saying that this feature should not be implemented because it would not work for users that use the agent - and that would be surprising?

@trask
Copy link
Member

trask commented Jan 8, 2025

so you're saying that this feature should not be implemented because it would not work for users that use the agent

yeah, I'm not convinced we should make this change since I think "best practice" is to end span after closing scope

also I realized this change will cause the processor to break for people who are passing context manually instead of using thread local

@zeitlinger
Copy link
Member Author

so you're saying that this feature should not be implemented because it would not work for users that use the agent

yeah, I'm not convinced we should make this change since I think "best practice" is to end span after closing scope

also I realized this change will cause the processor to break for people who are passing context manually instead of using thread local

I think that's a good argument - I'll add it to the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BaggageSpanProcessor should use ExtendedSpanProcessor.onEnding()

2 participants