-
Notifications
You must be signed in to change notification settings - Fork 215
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: database/sql integration #893
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #893 +/- ##
==========================================
- Coverage 83.21% 82.48% -0.73%
==========================================
Files 55 62 +7
Lines 5897 6259 +362
==========================================
+ Hits 4907 5163 +256
- Misses 820 919 +99
- Partials 170 177 +7 ☔ View full report in Codecov by Sentry. |
I really don't like golangci-lint, it's so pedantic :( |
Should be good by now. |
I'll test this locally myself this week and report back. We should also update the docs and main repository with this integration. |
You're missing examples in _examples. These should also include example on how to set the DSN. |
@ribice I've been occupied so much with work this week. Will find the time to work on this later. |
LGTM Overall. Still misses some tests for the coverage, entry in CHANGELOG.MD and documentation in main repo and sentry-docs. |
To be honest, I don't know how to make some of that as covered other than using old Go versions. But I might try creating another database driver implementation that does not implement
I might be able to help with the sentry-docs one, since I also need to update some of the self-hosted docs. |
I haven't reviewed this PR in full yet, but some things I would like to be changed:
|
We are not supporting 3rd party libraries here. We only import the database driver since Go does not bring built-in database drivers and rely on third party drivers. The database drivers we're using should not going to be compiled to the resulting binary since it's only used in tests. Although it seems like we're using it as a library here, it is not, it's still considered a database driver: sentry-go/_examples/sql/main.go Lines 40 to 45 in c5fa49d
MongoDB does not have and does not conform to the
Since we're wrapping a database driver and thus making us another database driver, we are required to implement multiple methods that are considered duplicates by the linter, yet again, from the driver documentation, we're still required to implement those. |
span := parentSpan.StartChild("db.sql.exec", sentry.WithDescription(s.query)) | ||
s.config.SetData(span, s.query) | ||
defer span.Finish() | ||
|
||
result, err := s.originalStmt.Exec(args) //nolint:staticcheck // We must support legacy clients | ||
if err != nil { | ||
span.Status = sentry.SpanStatusInternalError | ||
return nil, err | ||
} | ||
|
||
span.Status = sentry.SpanStatusOK | ||
|
||
return result, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section is not covered by tests, yet I don't know how to make it so.
I've added this check beforehand:
if s.ctx == nil && ctx != nil {
s.ctx = ctx
}
But it doesn't seem to help anyway.
Don't let this die! :) I'm sure many of us in the community will be grateful for an officially supported DB integration |
Queries insights tracing for Go.