-
Notifications
You must be signed in to change notification settings - Fork 283
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
EF Core and SqlClient instrumentation enabled at the same time produce wrong spans #1764
Comments
Moving to the contrib repo as EF instrumentation is hosted there? @virtes Do you have more idea on the underlying issue and possible fixes? There isn't a marked owner for EF instrumentation, so if you/others can help investigate and provide fix, that'd be super helpful! |
@cijothomas I'm not sure, that the problem is caused by EF instrumentation. As I understood, the underlying problem is that EntityFrameworkDiagnosticListener and SqlClientDiagnosticListener are called in parallel so stopping the SqlClient activity doesnt reflect actual current activity in EF listener and this causes the EF instrumentation to use obsolete activity. It turns out that the child SqlClient span is used here, but the EF activity is expected here, so the activity doesnt stop and could not be exported If I misunderstood anything, please correct me |
I will take a look at this one! cc @cijothomas |
I've just experienced this issue. Any progress been made? My package versions are:
|
I did a little investigation. Line 269 in 2ca95ad
Better say problem is sequence of events. How EF span is not closed cannot be reported but yes it is still parent of SQL span. Do we have any practice how to solve such problems? Problem here can be wrong order of events from sources. We have two different libraries so we cannot say who fire event in good moment. It also can be wrong order of processing on OTEL side, |
Bug Report
List of all OpenTelemetry NuGet
packages and version that you are
using (e.g.
OpenTelemetry 1.0.2
):Runtime version (e.g.
net462
,net48
,netcoreapp3.1
,net6.0
etc. You canfind this information from the
*.csproj
file):Symptom
Using
AddSqlClientInstrumentation
andAddEntityFrameworkCoreInstrumentation
at the same time leads to miss parent span.What is the expected behavior?
Exports two spans:
What is the actual behavior?
Output from console exporter - I have only SQL Client span, which has ParentSpanId of EF Core span.
We can see both expected spans using Enrich methods (pay attention to
Id
andParentSpanId
), so I guess that both spans are exist and looks like the first one just doesnt stop:Reproduce
Additional Context
The text was updated successfully, but these errors were encountered: