Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ 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)
- 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/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)
- 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/github.com/labstack/echo/otelecho` has been replaced by `const Version`. (#8365)
- The `Version()` function in `go.opentelemetry.io/contrib/samplers/probability/consistent` has been replaced by `const Version`. (#8366)

<!-- Released section -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func Middleware(serverName string, opts ...Option) echo.MiddlewareFunc {
}
tracer := cfg.TracerProvider.Tracer(
ScopeName,
oteltrace.WithInstrumentationVersion(Version()),
oteltrace.WithInstrumentationVersion(Version),
)
if cfg.Propagators == nil {
cfg.Propagators = otel.GetTextMapPropagator()
Expand All @@ -54,7 +54,7 @@ func Middleware(serverName string, opts ...Option) echo.MiddlewareFunc {

meter := cfg.MeterProvider.Meter(
ScopeName,
metric.WithInstrumentationVersion(Version()),
metric.WithInstrumentationVersion(Version),
)

semconvSrv := semconv.NewHTTPServer(meter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func TestMetrics(t *testing.T) {
require.Len(t, rm.ScopeMetrics, 1)
sm := rm.ScopeMetrics[0]
assert.Equal(t, ScopeName, sm.Scope.Name)
assert.Equal(t, Version(), sm.Scope.Version)
assert.Equal(t, Version, sm.Scope.Version)

attrs := []attribute.KeyValue{
attribute.String("http.request.method", "GET"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@
package otelecho // import "go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho"

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