From 7382a344f59dec5ccb5a1ff66b59fc8ea9bbf671 Mon Sep 17 00:00:00 2001 From: Jongwoo Han Date: Wed, 7 Jan 2026 15:04:11 +0900 Subject: [PATCH 1/2] Switch version from function to string in otellambda Signed-off-by: Jongwoo Han --- CHANGELOG.md | 4 ++++ .../github.com/aws/aws-lambda-go/otellambda/lambda.go | 2 +- .../aws/aws-lambda-go/otellambda/lambdatest_test.go | 4 ++-- .../github.com/aws/aws-lambda-go/otellambda/version.go | 5 +---- .../github.com/aws/aws-lambda-go/otellambda/version_test.go | 2 +- .../aws-lambda-go/otellambda/xrayconfig/xrayconfig_test.go | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0635d4bd5bb..c3893944340 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Changed + +- The `Version()` function in `go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda` has been replaced by `const Version`. (#8357) + ### Added - Change `Version()` function in `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp` to a `const Version` string. (#8142) diff --git a/instrumentation/github.com/aws/aws-lambda-go/otellambda/lambda.go b/instrumentation/github.com/aws/aws-lambda-go/otellambda/lambda.go index 0d3e784b968..39fe9628c5f 100644 --- a/instrumentation/github.com/aws/aws-lambda-go/otellambda/lambda.go +++ b/instrumentation/github.com/aws/aws-lambda-go/otellambda/lambda.go @@ -43,7 +43,7 @@ func newInstrumentor(opts ...Option) instrumentor { return instrumentor{ configuration: cfg, - tracer: cfg.TracerProvider.Tracer(ScopeName, trace.WithInstrumentationVersion(Version())), + tracer: cfg.TracerProvider.Tracer(ScopeName, trace.WithInstrumentationVersion(Version)), resAttrs: []attribute.KeyValue{}, } } diff --git a/instrumentation/github.com/aws/aws-lambda-go/otellambda/lambdatest_test.go b/instrumentation/github.com/aws/aws-lambda-go/otellambda/lambdatest_test.go index a865b5b3ca8..8f9a146c05d 100644 --- a/instrumentation/github.com/aws/aws-lambda-go/otellambda/lambdatest_test.go +++ b/instrumentation/github.com/aws/aws-lambda-go/otellambda/lambdatest_test.go @@ -147,7 +147,7 @@ var ( attribute.Int("faas.max_memory", 128*miB)), InstrumentationScope: instrumentation.Scope{ Name: "go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda", - Version: otellambda.Version(), + Version: otellambda.Version, }, } ) @@ -342,7 +342,7 @@ var ( attribute.Int("faas.max_memory", 128*miB)), InstrumentationScope: instrumentation.Scope{ Name: "go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda", - Version: otellambda.Version(), + Version: otellambda.Version, }, } ) diff --git a/instrumentation/github.com/aws/aws-lambda-go/otellambda/version.go b/instrumentation/github.com/aws/aws-lambda-go/otellambda/version.go index bfdd587e375..7e943aeca62 100644 --- a/instrumentation/github.com/aws/aws-lambda-go/otellambda/version.go +++ b/instrumentation/github.com/aws/aws-lambda-go/otellambda/version.go @@ -4,7 +4,4 @@ package otellambda // import "go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda" // Version is the current release version of the AWS Lambda 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/github.com/aws/aws-lambda-go/otellambda/version_test.go b/instrumentation/github.com/aws/aws-lambda-go/otellambda/version_test.go index 76125ac844a..1ce37cf9599 100644 --- a/instrumentation/github.com/aws/aws-lambda-go/otellambda/version_test.go +++ b/instrumentation/github.com/aws/aws-lambda-go/otellambda/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 := otellambda.Version() + v := otellambda.Version assert.NotNil(t, versionRegex.FindStringSubmatch(v), "version is not semver: %s", v) } diff --git a/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/xrayconfig_test.go b/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/xrayconfig_test.go index d9e31069b6f..c2bc598866e 100644 --- a/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/xrayconfig_test.go +++ b/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig/xrayconfig_test.go @@ -79,7 +79,7 @@ var ( }) expectedSpans = v1trace.ScopeSpans{ - Scope: &v1common.InstrumentationScope{Name: "go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda", Version: otellambda.Version()}, + Scope: &v1common.InstrumentationScope{Name: "go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda", Version: otellambda.Version}, Spans: []*v1trace.Span{{ TraceId: []byte{0x57, 0x59, 0xe9, 0x88, 0xbd, 0x86, 0x2e, 0x3f, 0xe1, 0xbe, 0x46, 0xa9, 0x94, 0x27, 0x27, 0x93}, SpanId: nil, From eb720cdb872fcb76ea33cc50312e70ab82926f6a Mon Sep 17 00:00:00 2001 From: Jongwoo Han Date: Wed, 7 Jan 2026 17:31:03 +0900 Subject: [PATCH 2/2] Fix changelog for #8357 --- CHANGELOG.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3893944340..9ff8c702c30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] -### Changed - -- The `Version()` function in `go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda` has been replaced by `const Version`. (#8357) - ### Added - Change `Version()` function in `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp` to a `const Version` string. (#8142) @@ -34,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/github.com/aws/aws-lambda-go/otellambda` has been replaced by `const Version`. (#8357)