Skip to content
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

Make empty agent bridged context equal root context #3869

Merged
merged 5 commits into from
Aug 20, 2021

Conversation

laurit
Copy link
Contributor

@laurit laurit commented Aug 18, 2021

Inside agent Context.current() == Context.root() when context is empty. The same holds when using sdk without agent. It seems reasonable to assume that this should also hold when using sdk with agent.

@@ -40,6 +40,11 @@
private static final Logger logger = LoggerFactory.getLogger(AgentContextStorage.class);

public static final AgentContextStorage INSTANCE = new AgentContextStorage();
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@laurit laurit Aug 19, 2021

Choose a reason for hiding this comment

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

Yes, it fails muzzle when older api is used because I call ContextStorage.root() which was just added. Seems like wrapper based approach won't work on older api because Context.root() just returns ArrayBasedContext.root() which we would still need to wrap.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replaced call to ContextStorage.root() with method handle, @anuraaga could you review.

Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

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

👍 created #3884 to add tests for the new AgentContext wrapper bridging

Comment on lines +107 to +108
// APPLICATION_ROOT is null when this method is called while the static initializer is
// initializing the value of APPLICATION_ROOT field
Copy link
Member

Choose a reason for hiding this comment

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

this is a little scary

@trask trask merged commit c96af0d into open-telemetry:main Aug 20, 2021
@laurit laurit deleted the context-equality branch August 21, 2021 20:31
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.

4 participants