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

feat: Add diagnostic source integration. #1154

Merged
merged 78 commits into from
Aug 25, 2021
Merged

Conversation

lucas-zimerman
Copy link
Collaborator

@lucas-zimerman lucas-zimerman commented Aug 6, 2021

See #1150

This PR adds a new project called Sentry.Diagnostics.DiagnosticSource that implements the Diagnostic Source integration, integrating (for now) EF Core and SQLClient.
In addition, the main Sentry project will come with the same integration if the target version is .NET CORE 3.1 or newer.

EF Core

Adds automatic spans for EF Core queries.

It creates spans for measuring the time required to connect to the database, execute the query and optimize it.
If everything went well, the spans will receive the status OK, otherwise, an internal error.

samples
OK Request https://sentry.io/organizations/sentry-sdks/discover/sentry-dotnet:7a363753fbc6446ba983de5006bb5809
On error: https://sentry.io/organizations/sentry-sdks/discover/sentry-dotnet:8806f87262324b45aaf1a9a5fd851f29
Another case of error: https://sentry.io/organizations/sentry-sdks/discover/sentry-dotnet:6424aec6c1684f658144ee29f320f279

SQLClient

Adds automatic spans to any code that interacts with

https://www.nuget.org/packages/Microsoft.Data.SqlClient/
and
https://www.nuget.org/packages/System.Data.SqlClient.

The following Spans are created:

db.connection: measures the connection lifespan.
db.query: measures the time required to execute the query.

@codecov-commenter
Copy link

codecov-commenter commented Aug 9, 2021

Codecov Report

Merging #1154 (171839e) into main (133e1a5) will decrease coverage by 0.05%.
The diff coverage is 78.39%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1154      +/-   ##
==========================================
- Coverage   80.62%   80.57%   -0.06%     
==========================================
  Files         205      212       +7     
  Lines        6647     6846     +199     
  Branches     1508     1563      +55     
==========================================
+ Hits         5359     5516     +157     
- Misses        796      822      +26     
- Partials      492      508      +16     
Impacted Files Coverage Δ
...sions.Logging/Extensions/KeyValuePairExtensions.cs 0.00% <0.00%> (ø)
src/Sentry/SentryOptionsExtensions.cs 70.76% <50.00%> (-0.66%) ⬇️
...gnosticSource/SentryOptionsDiagnosticExtensions.cs 66.66% <66.66%> (ø)
...als/DiagnosticSource/SentryDiagnosticSubscriber.cs 68.00% <68.00%> (ø)
...osticSource/SentryDiagnosticListenerIntegration.cs 71.42% <71.42%> (ø)
...rce/Internals/Extensions/KeyValuePairExtensions.cs 75.00% <75.00%> (ø)
...ce/Internals/DiagnosticSource/SentrySqlListener.cs 84.09% <84.09%> (ø)
...Internals/DiagnosticSource/SentryEFCoreListener.cs 86.79% <86.79%> (ø)
src/Sentry.AspNet/SentryAspNetOptionsExtensions.cs 100.00% <100.00%> (ø)
.../Sentry.AspNetCore/SentryAspNetCoreOptionsSetup.cs 100.00% <100.00%> (ø)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 133e1a5...171839e. Read the comment docs.

@lucas-zimerman lucas-zimerman marked this pull request as ready for review August 9, 2021 17:01
Copy link
Member

@bruno-garcia bruno-garcia left a comment

Choose a reason for hiding this comment

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

Quick pass.

Formatting fixes and negated logic  on Sentry,csproj

Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>
@bruno-garcia bruno-garcia changed the title Feat: Add diagnostic source integration. feat: Add diagnostic source integration. Aug 24, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Aug 24, 2021

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against e705666

@bruno-garcia bruno-garcia merged commit f8a05a4 into main Aug 25, 2021
@bruno-garcia bruno-garcia deleted the feat/diagnostic-source branch August 25, 2021 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants