diff --git a/CHANGELOG.md b/CHANGELOG.md index bc25b1b1c45..27af86e351b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `WithMetricAttributesFn` option in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc` to define dynamic attributes on auto-instrumented metrics. (#8191) - Add support for configuring propagators in `go.opentelemetry.io/contrib/otelconf`. (#8281) - Add `const Version` in `go.opentelemetry.io/contrib/bridges/prometheus`. (#8401) +- Add `const Version` in `go.opentelemetry.io/contrib/otelconf`. (#8461) ### Fixed diff --git a/otelconf/version.go b/otelconf/version.go new file mode 100644 index 00000000000..ac22e1cccb8 --- /dev/null +++ b/otelconf/version.go @@ -0,0 +1,7 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otelconf // import "go.opentelemetry.io/contrib/otelconf" + +// Version is the current release version of the otelconf module. +const Version = "0.19.0" diff --git a/otelconf/version_test.go b/otelconf/version_test.go new file mode 100644 index 00000000000..50b64a508a1 --- /dev/null +++ b/otelconf/version_test.go @@ -0,0 +1,24 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package otelconf_test + +import ( + "regexp" + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/contrib/otelconf" +) + +// regex taken from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string +var versionRegex = regexp.MustCompile(`^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)` + + `(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)` + + `(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?` + + `(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$`) + +func TestVersionSemver(t *testing.T) { + v := otelconf.Version + assert.NotNil(t, versionRegex.FindStringSubmatch(v), "version is not semver: %s", v) +}