diff --git a/CHANGELOG.md b/CHANGELOG.md index e60f013244c..d6cde93b779 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed - The `Version()` function in `go.opentelemetry.io/contrib/zpages` has been replaced by `const Version`. (#8325) +- The `Version()` function in `go.opentelemetry.io/contrib/instrumentation/host` has been replaced by `const Version`. (#8358) - The `Version()` function in `go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda` has been replaced by `const Version`. (#8357) - The `Version()` function in `go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws` has been replaced by `const Version`. (#8356) - The `Version()` function in `go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful` has been replaced by `const Version`. (#8360) diff --git a/instrumentation/host/host.go b/instrumentation/host/host.go index 961fa1bbd17..8118891f0de 100644 --- a/instrumentation/host/host.go +++ b/instrumentation/host/host.go @@ -106,7 +106,7 @@ func Start(opts ...Option) error { h := &host{ meter: c.MeterProvider.Meter( ScopeName, - metric.WithInstrumentationVersion(Version()), + metric.WithInstrumentationVersion(Version), ), config: c, } diff --git a/instrumentation/host/host_test.go b/instrumentation/host/host_test.go index c9c40d7d108..e680b99c271 100644 --- a/instrumentation/host/host_test.go +++ b/instrumentation/host/host_test.go @@ -31,7 +31,7 @@ func TestHostMetrics(t *testing.T) { want := metricdata.ScopeMetrics{ Scope: instrumentation.Scope{ Name: host.ScopeName, - Version: host.Version(), + Version: host.Version, }, Metrics: []metricdata.Metrics{ { diff --git a/instrumentation/host/version.go b/instrumentation/host/version.go index c3dc8f29523..eef5f60549d 100644 --- a/instrumentation/host/version.go +++ b/instrumentation/host/version.go @@ -4,7 +4,4 @@ package host // import "go.opentelemetry.io/contrib/instrumentation/host" // Version is the current release version of the host 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/host/version_test.go b/instrumentation/host/version_test.go index 2cb58772c41..95d1e25b612 100644 --- a/instrumentation/host/version_test.go +++ b/instrumentation/host/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 := host.Version() + v := host.Version assert.NotNil(t, versionRegex.FindStringSubmatch(v), "version is not semver: %s", v) }