-
Notifications
You must be signed in to change notification settings - Fork 589
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 68.5% 68.6% +0.1%
=======================================
Files 200 204 +4
Lines 16768 16906 +138
=======================================
+ Hits 11490 11606 +116
- Misses 4933 4950 +17
- Partials 345 350 +5
|
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.
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Package otelmongo instruments go.mongodb.org/mongo-driver/mongo. |
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.
// Package otelmongo instruments go.mongodb.org/mongo-driver/mongo. | |
// Package otelmongo instruments go.mongodb.org/mongo-driver/v2/mongo. |
// This package is compatible with v0.2.0 of | ||
// go.mongodb.org/mongo-driver/mongo. |
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 package is compatible with v0.2.0 of | |
// go.mongodb.org/mongo-driver/mongo. |
MongoDB's Go Driver has a major version compatibility guarantee, so this information is necessary for v2.
// 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.
// 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.
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.
// 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.
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
/* | ||
Package test validates the otelmongo instrumentation with the default SDK. |
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.
Package test validates the otelmongo instrumentation with the default SDK. | |
Package test validates the otelmongo V2 instrumentation with the default SDK. |
|
||
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. |
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.
// Version is the current release version of the mongo-driver instrumentation. | |
// Version is the current release version of the mongo-go-driver V2 instrumentation. |
|
||
// Version is the current release version of the mongo-driver instrumentation test module. | ||
func Version() string { | ||
return "0.58.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.
return "0.58.0" | |
return "0.60.0" |
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