-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
Fix/DB Connection spans presented poorly #2409
Conversation
…ectionId and CommandId
… EF diagnostic events
Co-authored-by: Matt Johnson-Pint <matt.johnson-pint@sentry.io>
…ntry/sentry-dotnet into fix/db-spans-not-finishing
…ly compare TimeStamps
@mattjohnsonpint I checked this with SqlClient as well. Apparently SqlClient never had any such similar issues. However I did notice that SqlClient puts all the queries under the relevant DB Connection. We could revert to doing that with for EntityFramework as well. Now that we're consolidating connections by ConnectionId, I don't think that would be an issue visually for the user... and the diagnostic events contain a ConnectionId as well as a CommandId for command/query events. Thoughts? |
… as a description
…o fix/db-spans-presentation
@mattjohnsonpint this should be good to go now I think. |
OK I think we're getting close. The db.connection and db.query spans have now been "flattened" so that these both appear at the same level in the hierarchy (see screenshot in the pull summary above). In terms of enriching the db.connection description, there isn't much we can use from the ConnectionEventData that we receive other than the Database name (here are all the properties). Using Postgres, for example, it looks like the Host and Port are available but actually I'm seeing The latest code does, however, store the All of those changes have been made for both SQL Client and Entity Framework so functionality should be consistent when using either of those. |
Looking great! I pushed a few nitpicks. One last thing - can we put Thanks |
Leveraging the work from Fix/db spans not finishing #2398 this turned out to be a fairly easy fix. The connections that are being opened/closed before/after executing DB commands typically all share the same connection id... which means we can tell if we're getting the same connection from the pool.
When we receive an
EFConnectionOpening
event then, we check to see if the Transaction contains an existing span with a matchingConnectionId
(from theEFConnectionOpening
event data). If so, we reuse it rather than creating a new span. To "reuse" it, we simply set theStatus = null
andEndTimestamp = null
.Resulting waterfall charts now look like this: