Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Supporting Baggage for Instrumentations used in Weblog Tests #8773

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

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

mhlidd
Copy link
Contributor

@mhlidd mhlidd commented May 6, 2025

What Does This Do

This PR migrates context propagation from Span contexts to generic Contexts for the instrumentations used in weblog tests (Tomcat on the server-side and okhttp3 on the client-side). This allows us to verify that we can properly propagate generic contexts end-to-end through System-tests verification.

Additionally, this PR introduces more helper methods in the HttpServerDecorator in order to reduce repetitive code in the instrumentation advice layer and ensure consistency among how we handle instrumentations.

Motivation

Additional Notes

Contributor Checklist

Jira ticket: [PROJ-IDENT]

/* Verify whether we have only span contexts or more contexts */
public ContextScope activateScope(Context context, AgentSpan span) {
Baggage baggage = Baggage.fromContext(context);
if (baggage == null) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcculls This is what I understood when you mentioned that we can only use span context if it is the only context that was extracted. Let me know if I interpreted that idea correctly here. 😃

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part feels weird to me. Would need to discuss with @mcculls

  1. It will drop any other context data than baggage (like DSM or other product)
  2. If there is no data in context, context will be root, and root.with(span) is equals to span (no allocation, no perf cost) so this will always be save to use context.with(span).attach()

nitpick: And on the semantic side, you are not activating a scope, you are activating a context, which activation results in a scope

@pr-commenter
Copy link

pr-commenter bot commented May 6, 2025

Benchmarks

Startup

Load

Dacapo

/* Verify whether we have only span contexts or more contexts */
public ContextScope activateScope(Context context, AgentSpan span) {
Baggage baggage = Baggage.fromContext(context);
if (baggage == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part feels weird to me. Would need to discuss with @mcculls

  1. It will drop any other context data than baggage (like DSM or other product)
  2. If there is no data in context, context will be root, and root.with(span) is equals to span (no allocation, no perf cost) so this will always be save to use context.with(span).attach()

nitpick: And on the semantic side, you are not activating a scope, you are activating a context, which activation results in a scope

@mhlidd mhlidd force-pushed the mhlidd/migrate_tomcat_okhttp branch from e2d8ef7 to 81a9768 Compare May 7, 2025 19:17
@mhlidd mhlidd changed the title supporting baggage in weblog related instrumentations Supporting Baggage for Instrumentations used in Weblog Tests May 7, 2025
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.

2 participants