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

Refactor existing code to propagate context. #674

Closed
tomas-langer opened this issue May 10, 2019 · 3 comments · Fixed by #675
Closed

Refactor existing code to propagate context. #674

tomas-langer opened this issue May 10, 2019 · 3 comments · Fixed by #675
Assignees

Comments

@tomas-langer
Copy link
Member

tomas-langer commented May 10, 2019

Follow up issue for #596
Refactor existing implementations to make sure context is correct created and propagated when switching threads.

@tomas-langer
Copy link
Member Author

tomas-langer commented May 10, 2019

The expected stuff to find in the context (to be documented).
This is proper magic and as such we should minimize this and properly document such behavior. Nevertheless this is a much needed magic - we have trouble propagating any information otherwise, as we have no chance to use ThreadLocals that could otherwise be used within a component.

Request context (coming from Web Server or gRPC Server or any other originating component):

  • io.opentracing.Tracer - the configured tracer (this may be also a no-op tracer if none is configured)
  • io.opentracing.SpanContext - the span context of the current request
  • io.helidon.security.SecurityContext - the information about current subject, security context is optional and only present if security is configured

Recommended usage of these:

Tracer tracer = context.get(Tracer.class)
                    .orElseGet(GlobalTracer::get);

Tracer.SpanBuilder spanBuilder = tracer.buildSpan("new-span");
context.get(SpanContext.class).ifPresent(spanBuilder::asChildOf);

@tomas-langer
Copy link
Member Author

Initial implementation for Web server and FT is done in #675

@tomas-langer tomas-langer reopened this May 16, 2019
@tomas-langer
Copy link
Member Author

This task is finished - gRPC, FT, Jersey and security all use context propagating executor services or run tasks in context.

@m0mus m0mus added this to Backlog Aug 12, 2024
@m0mus m0mus moved this to Closed in Backlog Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant