diff --git a/CHANGELOG.md b/CHANGELOG.md index 04a4daec961..73dbe1eb237 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `Version()` function in `go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin` has been replaced by `const Version`. (#8341) - Set `error.type` attribute instead of adding `exception` span events in `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp`. (#8386) - Set `error.type` attribute instead of adding `exception` span events in `go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws`. (#8386) +- The `Version()` function in `go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo` hae been replaced by `const Version`. (#8340) diff --git a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/config.go b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/config.go index 5b14a269d08..1f056412682 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/config.go +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/config.go @@ -32,7 +32,7 @@ func newConfig(opts ...Option) config { cfg.Tracer = cfg.TracerProvider.Tracer( ScopeName, - trace.WithInstrumentationVersion(Version()), + trace.WithInstrumentationVersion(Version), ) return cfg } diff --git a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/test/version.go b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/test/version.go index 1a2f070eaa1..dd3f65d810f 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/test/version.go +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/test/version.go @@ -4,7 +4,4 @@ package test // import "go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/test" // Version is the current release version of the mongo-driver instrumentation test module. -func Version() string { - return "0.64.0" - // This string is updated by the pre_release.sh script during release -} +const Version = "0.64.0" diff --git a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/test/version_test.go b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/test/version_test.go index 37ab3d5c422..dfeb0003746 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/test/version_test.go +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/test/version_test.go @@ -19,6 +19,6 @@ var versionRegex = regexp.MustCompile(`^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*) `(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$`) func TestVersionSemver(t *testing.T) { - v := test.Version() + v := test.Version assert.NotNil(t, versionRegex.FindStringSubmatch(v), "version is not semver: %s", v) } diff --git a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/version.go b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/version.go index 69b07983873..ea794e6e9f6 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/version.go +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/version.go @@ -4,7 +4,4 @@ package otelmongo // import "go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo" // Version is the current release version of the mongo-driver instrumentation. -func Version() string { - return "0.64.0" - // This string is updated by the pre_release.sh script during release -} +const Version = "0.64.0" diff --git a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/version_test.go b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/version_test.go index 26b6ff397c7..3f77be333be 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/version_test.go +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/version_test.go @@ -19,6 +19,6 @@ var versionRegex = regexp.MustCompile(`^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*) `(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$`) func TestVersionSemver(t *testing.T) { - v := otelmongo.Version() + v := otelmongo.Version assert.NotNil(t, versionRegex.FindStringSubmatch(v), "version is not semver: %s", v) }