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

Change internal tracing to use otel trace #3567

Merged
merged 1 commit into from
Jul 8, 2021

Conversation

bogdandrutu
Copy link
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

exporter/exporterhelper/common_test.go Show resolved Hide resolved
sr := new(oteltest.SpanRecorder)
tp := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr))
otel.SetTracerProvider(tp)
defer otel.SetTracerProvider(trace.NewNoopTracerProvider())
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 now the 5th time the same lines are repeated in tests. Wouldn't it make sense to externalize it?

obsreport/obsreport.go Show resolved Hide resolved
Copy link
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
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
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
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
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
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
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
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
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
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
Member Author

Choose a reason for hiding this comment

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

Copy link
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