-
Notifications
You must be signed in to change notification settings - Fork 779
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
OpenTracingShim generate span with invalid spanContext for custom instrumentaion #2787
Comments
It isn't clear to me, is this issue still an open issue or was it resolved with this |
Hi @MMartyn - when I submitted the PR that you linked I didn't have a chance to directly verify if this specific issue was resolved by it. So I was hesitant to close the issue. My understanding at the time was that this one should have been fixed by it. @yehaotian could you let's know if the issue is resolved for you? |
Thanks for the response, will try find some time to update the environment and do the test |
Hi @pjanotti and @MMartyn, I updated all OpenTelemetry.* versions and still get the error.
Getting error:
|
I also get the same error and was just trying to confirm if it was just me. |
Thanks @MMartyn and @yehaotian for confirming. The behavior is triggered if there are no listeners for the activity source associated to the registered OpenTracing tracer. Here is an example of the workaround: // Add OTel
builder.Services.AddOpenTelemetry()
.WithTracing(tracing => tracing
.AddAspNetCoreInstrumentation()
.AddConsoleExporter()
.AddSource("OpenTracing")); // <- Adding the source of the OpenTracing shim
// Add OpenTracing
ITracer otTracer = new TracerShim(
TracerProvider.Default.GetTracer("OpenTracing"),
Propagators.DefaultTextMapPropagator);
OpenTracing.Util.GlobalTracer.Register(otTracer); Anyway, it shouldn't hit an exception if there are no listeners for the OT shim. So this is still a bug. |
I still get error when DO NOT have |
No, you should be able to customize it. |
The problem is that OpenTracing shim is broken if there is no parent activity. It is related to other problem in the sense that they hit the same exception, but, likely need two different fixes: one for "no listeners" and another to correctly handle root span. I will take a look at the code to see if I can quickly fix both issues. |
That makes sense! |
Just want to report back that the workaround to add the source worked for me. Thanks. |
Hi @pjanotti , just want to double check if there is ETA/timeline on the issue fix, we would like to migrate from OpenTracing to OpenTelemetry in this Q and this is a blocker. |
Hi @yehaotian, I was on a short vacation. I will debug this issue this week or the next. |
In the comments above there were two paths in which the issue was hit:
It seems that the shim should not consider an invalid span context an error condition. A related issue is that I started coding some integration tests for the shim, the proposed fix itself is trivial. |
Hi |
@sasha-khadasevich, fix from #4668 should be included in next Other parts related to
are not fixed yet there is no ETA. |
Bug Report
List of NuGet packages and
version that you are using:
Runtime version:
netcoreapp3.1
Symptom
We are using our own instrumentations/diagnostics to build spans for specific activities.
Static TracerShim:
Custom diagnostics:
What is the expected behavior?
The generated span will have valid spanContext in SpanContextShim. And related spans can be created successfully.
What is the actual behavior?
The span contains empty fields for context which will cause
Passed span's context is not valid
ArgumentException when build other child spans for other activities. And no span get created successfully.Printed span info:
Reproduce
Since we are leveraging same design as
OpenTracing.Contrib.NetCore
, we can use the project directly with opentelemetry-dotnet/examples/AspNetCore for reproducing the issue.<PackageReference Include="OpenTracing.Contrib.NetCore" Version="0.8.0" />
In Startup.cs:
Warning when running the program:
Additional Context
We are sending data to Lighstep with internal configuration.
Also because of OpenTracing ITracer API results in broken and multiple traces when using the AspNetCore instrumentation #2257 we cannot create any span within the application, for example create span in Controller.
The text was updated successfully, but these errors were encountered: