sentry-dotnet icon indicating copy to clipboard operation
sentry-dotnet copied to clipboard

Add ability to set sampling rate for the DiagnosticSource integrations

Open ericsampson opened this issue 5 months ago • 3 comments

Problem Statement

The DiagnosticSource auto-instrumentation of EF and SqlClient is client, but they create an absolute TON of Spans.

To the point where I have to set the overall sampling strategy of the SDK to a very low value in order to avoid costing a untenable $$$$ in Performance credits. But this also has a very unfortunate side-effect of discarding important low-volume traces that we need to see. And it's not a good solution to expect users to manually set up complicated and brittle sampling rules to capture these traces. ("investigation mode" helps, but it's not ideal)

Solution Brainstorm

MVP: I would really love to be able to set sampling rates for:

  • EF Core overall
  • Sql Client overall

Phase 2: be able set the individual sampling rates for every span type (EF and SqlClient db.connection, db.query, etc)

Phase 3: if customer feedback supports the need, then allow people to set custom sampling callbacks for the above.

Thanks a ton!!!

(it's possible that I could work on contributing the MVP over time, if someone could point me in the right direction re code to steal/reuse)

ericsampson avatar Sep 16 '24 15:09 ericsampson