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

Opentracing Support #263

Closed
wants to merge 2 commits into from
Closed

Opentracing Support #263

wants to merge 2 commits into from

Conversation

sdwr98
Copy link
Contributor

@sdwr98 sdwr98 commented Nov 21, 2020

Addresses #258 - bringing over the ContextPropagator improvements and adding a default OpenTracing implementation of context propagation

Enhances the ContextPropagator API by providing more lifecycle methods,
and adds an implementation of OpenTracing
@CLAassistant
Copy link

CLAassistant commented Nov 21, 2020

CLA assistant check
All committers have signed the CLA.

}

@Override
public Map<String, Payload> serializeContext(Object context) {
Copy link
Member

Choose a reason for hiding this comment

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

The header is a shared resource. So we cannot assume that all the keys in it are created using this specific propagator. So the solution is to store the whole context in a single header key. We also want this to be compatible with Go SDK. Here is the Go SDK open trace propagator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point - I will take a look at the go propagator and work on ensuring cross-platform.

@Override
public void setUp() {
Tracer openTracingTracer = GlobalTracer.get();
Tracer.SpanBuilder builder = openTracingTracer.buildSpan("cadence.workflow");
Copy link
Member

Choose a reason for hiding this comment

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

I don't think it is going to work. The problem is that during replay a new span is going to be created.
Unfortunately, there is no way to create a span passing deterministically generated ID to it.

Another option would be using SideEffect to store the span, but that implies additional MarkerEvent for every workflow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does it really matter if we start multiple spans if we only finish one? I don't think spans get reported until you finish() them.

@@ -126,4 +130,27 @@

/** Sets the current context */
void setCurrentContext(Object context);

Copy link
Member

Choose a reason for hiding this comment

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

Looking at this and the implementation I'm getting more inclined to just using interceptors for this integration and getting rid of the context propagator interface completely as it has very limited use.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’d be happy to look into that - are there any docs or examples of interceptors anywhere? I didn’t see a way of propagating information from worker/client to the server and back using interceptors.

Copy link
Member

Choose a reason for hiding this comment

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

I think you are right that there is something missing in the interceptors to support this use case. Let me think about this.

@mfateev
Copy link
Member

mfateev commented Feb 1, 2021

The newly added WorkerInterceptor should be enough to implement open tracing support.

I'm going to close this PR. I would love to review a contribution that relies on the interceptor.

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.

3 participants