Skip to content

Change internal tracing to use otel trace#3567

Merged
bogdandrutu merged 1 commit intoopen-telemetry:mainfrom
bogdandrutu:oteltrace
Jul 8, 2021
Merged

Change internal tracing to use otel trace#3567
bogdandrutu merged 1 commit intoopen-telemetry:mainfrom
bogdandrutu:oteltrace

Conversation

@bogdandrutu
Copy link
Copy Markdown
Member

For the moment we rely on the global TracerProvider, in a future PR will change that.

Signed-off-by: Bogdan Drutu bogdandrutu@gmail.com

@bogdandrutu bogdandrutu requested review from a team and jpkrohling July 5, 2021 23:00
sr := new(oteltest.SpanRecorder)
tp := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr))
otel.SetTracerProvider(tp)
defer otel.SetTracerProvider(trace.NewNoopTracerProvider())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is now the 5th time the same lines are repeated in tests. Wouldn't it make sense to externalize it?

Copy link
Copy Markdown
Member

@tigrannajaryan tigrannajaryan left a comment

Choose a reason for hiding this comment

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

Great to see this coming.
I am curious how performance of Otel tracing compares to OC tracing? Do we have any benchmarks that measure the impact of tracing on component operations?

Comment on lines +229 to +232
// Enable OpenTelemetry observability plugin.
opts = append(opts, grpc.WithUnaryInterceptor(otelgrpc.UnaryClientInterceptor()))
opts = append(opts, grpc.WithStreamInterceptor(otelgrpc.StreamClientInterceptor()))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This enables context propagation, right? So, we will propagate context for grpc-based protocols, like OTLP. Is this something we want?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is similar with what we had before with opencensus using the stats handler.

Copy link
Copy Markdown
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 any propagators are configured in this PR, so no propagation should happen by default. If a custom build (or later PR for this repo/contrib) were to configure a global propagator then it would be used by these interceptors.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Is it not the case that w3c is the default?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No, unfortunately it isn't.

The OpenTelemetry API MUST use no-op propagators unless explicitly configured otherwise.

@bogdandrutu
Copy link
Copy Markdown
Member Author

I am curious how performance of Otel tracing compares to OC tracing? Do we have any benchmarks that measure the impact of tracing on component operations?

Based on our loadtests no significant difference, the otel seems actually to be slightly faster. @MrAlias @Aneurysm9 do you have these benchmarks?

@Aneurysm9
Copy link
Copy Markdown
Member

I am curious how performance of Otel tracing compares to OC tracing? Do we have any benchmarks that measure the impact of tracing on component operations?

Based on our loadtests no significant difference, the otel seems actually to be slightly faster. @MrAlias @Aneurysm9 do you have these benchmarks?

We have some basic tracer benchmarks, starting and stopping spans, ID handling, etc. This should get all the benchmarks in the core repo.

Comment on lines +229 to +232
// Enable OpenTelemetry observability plugin.
opts = append(opts, grpc.WithUnaryInterceptor(otelgrpc.UnaryClientInterceptor()))
opts = append(opts, grpc.WithStreamInterceptor(otelgrpc.StreamClientInterceptor()))

Copy link
Copy Markdown
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 any propagators are configured in this PR, so no propagation should happen by default. If a custom build (or later PR for this repo/contrib) were to configure a global propagator then it would be used by these interceptors.

Comment on lines +133 to +135
_, span = rec.tracer.Start(context.Background(), spanName, trace.WithLinks(trace.Link{
SpanContext: trace.SpanContextFromContext(receiverCtx),
}))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
_, span = rec.tracer.Start(context.Background(), spanName, trace.WithLinks(trace.Link{
SpanContext: trace.SpanContextFromContext(receiverCtx),
}))
ctx, span = rec.tracer.Start(ctx, spanName, trace.WithLinks(trace.Link{
SpanContext: trace.SpanContextFromContext(receiverCtx),
}), trace.WithNewRoot())

I believe this does what you're trying to do without needing the later call to ContextWithSpan().

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Please file a PR when that issue is fixed.

For the moment we rely on the global TracerProvider, in a future PR will change that.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
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