Skip to content
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

### Added

- Change `Version()` function in `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp` to a `const Version` string. (#8142)
Comment thread
ElenaZvereva marked this conversation as resolved.
Outdated
- `WithMetricAttributesFn` option in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc` to define dynamic attributes on auto-instrumented metrics. (#8191)

### Fixed
Expand All @@ -35,6 +34,8 @@ 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/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)
- The `Version()` function in `go.opentelemetry.io/contrib/propagators/opencensus` has been replaced by `const Version`. (#8361)
- The `Version()` function in `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp` has been replaced by `const Version`. (#8142)
- The `Version()` function in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc` has been replaced by `const Version`. (#8317)

<!-- Released section -->
<!-- Don't change this section unless doing release -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ func checkClientMetrics(t *testing.T, reader metric.Reader) {
expectedScopeMetric := metricdata.ScopeMetrics{
Scope: instrumentation.Scope{
Name: "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc",
Version: otelgrpc.Version(),
Version: otelgrpc.Version,
SchemaURL: semconv.SchemaURL,
},
Metrics: []metricdata.Metrics{
Expand Down Expand Up @@ -1100,7 +1100,7 @@ func checkServerMetrics(t *testing.T, reader metric.Reader) {
expectedScopeMetric := metricdata.ScopeMetrics{
Scope: instrumentation.Scope{
Name: "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc",
Version: otelgrpc.Version(),
Version: otelgrpc.Version,
SchemaURL: semconv.SchemaURL,
},
Metrics: []metricdata.Metrics{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
var wantInstrumentationScope = instrumentation.Scope{
Name: "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc",
SchemaURL: semconv.SchemaURL,
Version: otelgrpc.Version(),
Version: otelgrpc.Version,
}

// newGrpcTest creates a grpc server, starts it, and returns the client, closes everything down during test cleanup.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ func NewServerHandler(opts ...Option) stats.Handler {

h.tracer = c.TracerProvider.Tracer(
ScopeName,
trace.WithInstrumentationVersion(Version()),
trace.WithInstrumentationVersion(Version),
)

meter := c.MeterProvider.Meter(
ScopeName,
metric.WithInstrumentationVersion(Version()),
metric.WithInstrumentationVersion(Version),
metric.WithSchemaURL(semconv.SchemaURL),
)

Expand Down Expand Up @@ -181,12 +181,12 @@ func NewClientHandler(opts ...Option) stats.Handler {

h.tracer = c.TracerProvider.Tracer(
ScopeName,
trace.WithInstrumentationVersion(Version()),
trace.WithInstrumentationVersion(Version),
)

meter := c.MeterProvider.Meter(
ScopeName,
metric.WithInstrumentationVersion(Version()),
metric.WithInstrumentationVersion(Version),
metric.WithSchemaURL(semconv.SchemaURL),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@
package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"

// Version is the current release version of the gRPC 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"
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 := otelgrpc.Version()
v := otelgrpc.Version
assert.NotNil(t, versionRegex.FindStringSubmatch(v), "version is not semver: %s", v)
}