Skip to content
Open
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

### Changed

- Change `Version()` function in `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp` to a `const Version` string. (#8142)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@open-telemetry/go-approvers I think we could make it more visible this is a breaking change. But at the same time, doing something too prominent for the version string probably too much. WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to only mark content or tags related to significant changes here.

- Improve performance by reducing allocations in the gRPC stats handler in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc`. (#8035)

### Deprecated
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/net/http/otelhttp/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ const (
type Filter func(*http.Request) bool

func newTracer(tp trace.TracerProvider) trace.Tracer {
return tp.Tracer(ScopeName, trace.WithInstrumentationVersion(Version()))
return tp.Tracer(ScopeName, trace.WithInstrumentationVersion(Version))
}
2 changes: 1 addition & 1 deletion instrumentation/net/http/otelhttp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func newConfig(opts ...Option) *config {

c.Meter = c.MeterProvider.Meter(
ScopeName,
metric.WithInstrumentationVersion(Version()),
metric.WithInstrumentationVersion(Version),
)

return c
Expand Down
4 changes: 2 additions & 2 deletions instrumentation/net/http/otelhttp/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ func TestHandlerBasics(t *testing.T) {
func assertScopeMetrics(t *testing.T, sm metricdata.ScopeMetrics, attrs attribute.Set) {
assert.Equal(t, instrumentation.Scope{
Name: "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",
Version: Version(),
Version: Version,
}, sm.Scope)

require.Len(t, sm.Metrics, 3)

want := metricdata.ScopeMetrics{
Scope: instrumentation.Scope{
Name: ScopeName,
Version: Version(),
Version: Version,
},
Metrics: []metricdata.Metrics{
{
Expand Down
4 changes: 2 additions & 2 deletions instrumentation/net/http/otelhttp/transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -860,15 +860,15 @@ func TestTransportMetrics(t *testing.T) {
func assertClientScopeMetrics(t *testing.T, sm metricdata.ScopeMetrics, attrs attribute.Set) {
assert.Equal(t, instrumentation.Scope{
Name: "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",
Version: Version(),
Version: Version,
}, sm.Scope)

require.Len(t, sm.Metrics, 2)

want := metricdata.ScopeMetrics{
Scope: instrumentation.Scope{
Name: ScopeName,
Version: Version(),
Version: Version,
},
Metrics: []metricdata.Metrics{
{
Expand Down
5 changes: 1 addition & 4 deletions instrumentation/net/http/otelhttp/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@
package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"

// Version is the current release version of the otelhttp instrumentation.
func Version() string {
return "0.63.0"
// This string is updated by the pre_release.sh script during release
}
const Version = "0.63.0"
2 changes: 1 addition & 1 deletion instrumentation/net/http/otelhttp/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := otelhttp.Version()
v := otelhttp.Version
assert.NotNil(t, versionRegex.FindStringSubmatch(v), "version is not semver: %s", v)
}