-
Notifications
You must be signed in to change notification settings - Fork 707
support mongo-driver's db metrics #7983
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
base: main
Are you sure you want to change the base?
Conversation
|
cc @prestonvasquez as code owner |
|
Looking at this, I think it should be split into multiple PRs to get proper review. The db.client.response.returned_rows is still in development. So we shouldn't expose it by default, as it may have breaking changes that would make migrations on our end quite a bunch of toil. Similarly, all database connection pools semantic conventions are still under development. So they should also be hidden behind a feature flag. |
231e886 to
647725b
Compare
Thank you for your review. I'll make flags to enable the development metrics. @dmathieu |
2542481 to
288ffdb
Compare
…n pool feat(metrics): add metrics tests for MongoDB operations and connection pool feat(mongo): improve error handling in NewMonitor and add test for invalid meter provider fix(mongo): remove unnecessary elements extraction in Succeeded method to improve performance chore: fix removed license docs: update documentation and examples to support metrics for MongoDB instrumentation fix missing bucket boundaries fix nil meterProvider drop others
instrumentation/go.mongodb.org/mongo-driver/v2/mongo/otelmongo/config.go
Outdated
Show resolved
Hide resolved
instrumentation/go.mongodb.org/mongo-driver/v2/mongo/otelmongo/config.go
Outdated
Show resolved
Hide resolved
instrumentation/go.mongodb.org/mongo-driver/v2/mongo/otelmongo/mongo.go
Outdated
Show resolved
Hide resolved
instrumentation/go.mongodb.org/mongo-driver/v2/mongo/otelmongo/mongo.go
Outdated
Show resolved
Hide resolved
instrumentation/go.mongodb.org/mongo-driver/v2/mongo/otelmongo/mongo.go
Outdated
Show resolved
Hide resolved
…/config.go Co-authored-by: Preston Vasquez <[email protected]>
Co-authored-by: Preston Vasquez <[email protected]>
Co-authored-by: Preston Vasquez <[email protected]>
prestonvasquez
left a comment
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.
LGTM with a few nits/minor suggestions 👍
Thanks!
instrumentation/go.mongodb.org/mongo-driver/v2/mongo/otelmongo/metrics_test.go
Outdated
Show resolved
Hide resolved
instrumentation/go.mongodb.org/mongo-driver/v2/mongo/otelmongo/metrics_test.go
Outdated
Show resolved
Hide resolved
instrumentation/go.mongodb.org/mongo-driver/v2/mongo/otelmongo/metrics_test.go
Outdated
Show resolved
Hide resolved
instrumentation/go.mongodb.org/mongo-driver/v2/mongo/otelmongo/mongo.go
Outdated
Show resolved
Hide resolved
e762a63 to
bb7eb18
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7983 +/- ##
=======================================
- Coverage 81.8% 81.7% -0.1%
=======================================
Files 194 194
Lines 13377 13429 +52
=======================================
+ Hits 10951 10984 +33
- Misses 2029 2044 +15
- Partials 397 401 +4
🚀 New features to boost your workflow:
|
|
Could you fix the lint issues? |
|
Current failure is because of #8163 |
|
And I found the changelog was wrong. I fixed it. |

I cannot find the metrics support of otel for mongo-driver. If I'm wrong, please let me know. 🙇
Description
OTel guides
However, there is no implementation for it.
Implementations
- Define & ImplementNewPoolMonitorto collect database's connection pool metrics.- Supportdb.client.operation.durationanddb.client.response.returned_rowsmetrics:~~- Limitation: In the doc (https://opentelemetry.io/docs/specs/semconv/database/database-metrics/),
db.query.textis a opt-in attributes. But, mongo-driver does not provides this information. So, I left it as a todo comment. ~~db.client.operation.durationmetric.Sample output as a prometheus format