-
Notifications
You must be signed in to change notification settings - Fork 595
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: adding instrumentation support for mongo-driver/v2 #6539
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6539 +/- ##
======================================
Coverage 75.5% 75.5%
======================================
Files 206 210 +4
Lines 19181 19304 +123
======================================
+ Hits 14484 14593 +109
- Misses 4259 4270 +11
- Partials 438 441 +3
|
cc @prestonvasquez for review? |
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.
@AlaricWhitney Thank you for putting this together. I wanted to let you know that I'll be reviewing this in stages, as my schedule allows.
instrumentation/go.mongodb.org/mongo-driver/v2/mongo/otelmongo/doc.go
Outdated
Show resolved
Hide resolved
instrumentation/go.mongodb.org/mongo-driver/v2/mongo/otelmongo/doc.go
Outdated
Show resolved
Hide resolved
// This code was originally based on the following: | ||
// - https://github.com/DataDog/dd-trace-go/tree/02f0449efa3cb382d499fadc873957385dcb2192/contrib/go.mongodb.org/mongo-driver/mongo | ||
// - https://github.com/DataDog/dd-trace-go/tree/v1.23.3/ddtrace/ext |
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.
We should update this to note that the code was copied from a specific instance of the v1 instrumentation.
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.
I've updated it to reference the commit version that it was based on.
// SemVersion is the semantic version to be supplied to tracer/meter creation. | ||
// | ||
// Deprecated: Use [Version] instead. | ||
func SemVersion() string { |
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.
@dmathieu Can this be excluded in v2?
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.
Sure, this is a new package. We shouldn't introduce methods that are already deprecated.
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.
Sounds good. I'll remove it.
package otelmongo // import "go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/v2/mongo/otelmongo" | ||
|
||
// Version is the current release version of the mongo-driver instrumentation. | ||
func Version() string { |
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 should probably start at 0.1.0 per SEMVAR: semver.org#how-should-i-deal-with-revisions-in-the-0yz-initial-development-phase
@dmathieu Unless there is an open telemetry-specific requirement? This also mentions something about being updated by the pre_releash.sh script during release. Where does that script live? Does it need to include v2/mongo/otelmongo? Should this file be excluded altogether, i.e. does the script generate the entire file?
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.
Versions are specified here: https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/versions.yaml
We have commonly not started at 0.1.0 for new instrumentations, but at the version where we're currently at.
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.
The release procedure is detailed here: https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/RELEASING.md
The pre_release script has been moved to a make command.
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.
I can update the version to 0.60.0, and let the the pre_release script update it to the correct value if I'm understanding the process correctly.
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package test_test |
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.
Suggest removing this file along with the test. If it gets autogenerated as part of pre-release automation, so bet it.
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.
Great! I'll remove the test.
instrumentation/go.mongodb.org/mongo-driver/v2/mongo/otelmongo/test/doc.go
Outdated
Show resolved
Hide resolved
instrumentation/go.mongodb.org/mongo-driver/v2/mongo/otelmongo/version.go
Outdated
Show resolved
Hide resolved
instrumentation/go.mongodb.org/mongo-driver/v2/mongo/otelmongo/test/version.go
Outdated
Show resolved
Hide resolved
can this pr merge? I need use it in my project |
Not until all review comments have been closed an it has been approved. |
…/doc.go Co-authored-by: Preston Vasquez <[email protected]>
…/doc.go Co-authored-by: Preston Vasquez <[email protected]>
…/test/doc.go Co-authored-by: Preston Vasquez <[email protected]>
…/test/version.go Co-authored-by: Damien Mathieu <[email protected]>
…/version.go Co-authored-by: Preston Vasquez <[email protected]>
…tation for go.mongodb.org/mongo-driver/v2
@prestonvasquez @dmathieu This should be ready for review. |
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.
Could you add this new package to the CODEOWNERS
file too?
This looks good. I don't have the required mongo knowledge to assert proper behavior though, so I'll let @prestonvasquez weigh on that.
@@ -13,6 +13,7 @@ The next release will require at least [Go 1.23]. | |||
|
|||
### Added | |||
|
|||
- Add instrumentation support for `go.mongodb.org/mongo-driver/v2` in `go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/v2/mongo/otelmongo`(#6539) |
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.
Could you move this entry to be last in the section?
|
||
"go.opentelemetry.io/otel/attribute" | ||
"go.opentelemetry.io/otel/codes" | ||
semconv "go.opentelemetry.io/otel/semconv/v1.21.0" |
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.
Since this is a new package, we should rely on the latest semantic conventions (1.30.0) right away, let's not make things harder by forcing a migration right away :)
/* | ||
Package test validates the otelmongo V2 instrumentation with the default SDK. | ||
|
||
This package is in a separate module from the instrumentation it tests to |
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.
Having this in a test subpackage shouldn't be required anymore, and we're in the process of removing that folder for every instrumentation.
Since this is a new one, could we avoid creating it altogether?
See #6763 as similar work for otelhttp.
Adding the mongo-driver/v2 instrumentation.
This is a copy/paste of the v1 instrumentation, and was modified to adhere to the mongo-driver/v2 requirements.
Notable differences:
mtest
was removed in v2. Replaced withdrivertest
in the unit testing.This addresses PR #6419