Skip to content

Commit 40820d1

Browse files
authored
added troubleshooting for EF (#10966)
1 parent abf7f1c commit 40820d1

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: Troubleshooting
3+
sidebar_order: 9000
4+
description: "Learn more about how to troubleshoot common issues with the EntityFramework SDK."
5+
---
6+
7+
## Tracing Instrumentation Issues
8+
9+
### Spans generated for `db.connection` and `db.query` are disconnected
10+
11+
The SDK keeps automatically generated spans for `db.connection` and `db.query` under the same parent by design. Consider the following snippet:
12+
13+
```csharp
14+
var transaction = SentrySdk.StartTransaction("Program Main", "function");
15+
16+
await db.Blogs.OrderBy(b => b.BlogId).ToListAsync();
17+
18+
var span = transaction.StartChild("task", "some custom stuff");
19+
await Task.Delay(100);
20+
span.Finish();
21+
22+
await db.Blogs.OrderBy(b => b.BlogId).ToListAsync();
23+
24+
transaction.Finish();
25+
```
26+
27+
This would lead to the following waterfall graph
28+
29+
![Waterfall graph in Sentry](./img/dotnet-db.png)
30+
31+
where an unrelated task would attempt to be nested within the `db.connection` span. Since the task does not have `db.connection` set as parent it gets appended at the bottom. But because it happened while the connection was open it would get interpreted as a missing instrumentation.
32+
33+
It makes sense also from the perspective of the parent/child spans having any sort of causal relationship. The `db.query.compile`, `db.connection`, `db.query`, and the custom `task` were all things that were caused by the function implementation. The queries weren't caused by the connection, they just used the connection.

0 commit comments

Comments
 (0)