Skip to content

Commit a32ef13

Browse files
authored
HTTP migration, Env Var name (#5997)
This change renames the environment variable used for compatibility mode to `OTEL_SEMCONV_STABILITY_OPT_IN` as per the recommendation in the spec. Follow up from [this comment](#5132 (comment)). Co-authored-by: Aaron Clawson <[email protected]>
1 parent bb9ac54 commit a32ef13

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
1717
- The `go.opentelemetry.io/contrib/config` package supports configuring `with_resource_constant_labels` for the prometheus exporter. (#5890)
1818
- Add new runtime metrics to `go.opentelemetry.io/contrib/instrumentation/runtime`, which are still disabled by default. (#5870)
1919
- Support for the `OTEL_HTTP_CLIENT_COMPATIBILITY_MODE=http/dup` environment variable in `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp` to emit attributes for both the v1.20.0 and v1.26.0 semantic conventions. (#5401)
20+
- The `go.opentelemetry.io/contrib/bridges/otelzerolog` module.
21+
This module provides an OpenTelemetry logging bridge for `github.com/rs/zerolog`. (#5405)
2022

2123
### Removed
2224

instrumentation/net/http/otelhttp/internal/semconv/bench_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
var benchHTTPServerRequestResults []attribute.KeyValue
1515

1616
// BenchmarkHTTPServerRequest allows comparison between different version of the HTTP server.
17-
// To use an alternative start this test with OTEL_HTTP_CLIENT_COMPATIBILITY_MODE set to the
17+
// To use an alternative start this test with OTEL_SEMCONV_STABILITY_OPT_IN set to the
1818
// version under test.
1919
func BenchmarkHTTPServerRequest(b *testing.B) {
2020
// Request was generated from TestHTTPServerRequest request.

instrumentation/net/http/otelhttp/internal/semconv/env.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func (s HTTPServer) RecordMetrics(ctx context.Context, md MetricData) {
111111
}
112112

113113
func NewHTTPServer(meter metric.Meter) HTTPServer {
114-
env := strings.ToLower(os.Getenv("OTEL_HTTP_CLIENT_COMPATIBILITY_MODE"))
114+
env := strings.ToLower(os.Getenv("OTEL_SEMCONV_STABILITY_OPT_IN"))
115115
duplicate := env == "http/dup"
116116
server := HTTPServer{
117117
duplicate: duplicate,
@@ -125,7 +125,7 @@ type HTTPClient struct {
125125
}
126126

127127
func NewHTTPClient() HTTPClient {
128-
env := strings.ToLower(os.Getenv("OTEL_HTTP_CLIENT_COMPATIBILITY_MODE"))
128+
env := strings.ToLower(os.Getenv("OTEL_SEMCONV_STABILITY_OPT_IN"))
129129
return HTTPClient{duplicate: env == "http/dup"}
130130
}
131131

instrumentation/net/http/otelhttp/internal/semconv/httpconv_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
)
1818

1919
func TestNewTraceRequest(t *testing.T) {
20-
t.Setenv("OTEL_HTTP_CLIENT_COMPATIBILITY_MODE", "http/dup")
20+
t.Setenv("OTEL_SEMCONV_STABILITY_OPT_IN", "http/dup")
2121
serv := NewHTTPServer(nil)
2222
want := func(req testServerReq) []attribute.KeyValue {
2323
return []attribute.KeyValue{
@@ -131,7 +131,7 @@ func TestNewMethod(t *testing.T) {
131131
}
132132

133133
func TestNewTraceRequest_Client(t *testing.T) {
134-
t.Setenv("OTEL_HTTP_CLIENT_COMPATIBILITY_MODE", "http/dup")
134+
t.Setenv("OTEL_SEMCONV_STABILITY_OPT_IN", "http/dup")
135135
body := strings.NewReader("Hello, world!")
136136
url := "https://example.com:8888/foo/bar?stuff=morestuff"
137137
req := httptest.NewRequest("pOST", url, body)
@@ -156,7 +156,7 @@ func TestNewTraceRequest_Client(t *testing.T) {
156156
}
157157

158158
func TestNewTraceResponse_Client(t *testing.T) {
159-
t.Setenv("OTEL_HTTP_CLIENT_COMPATIBILITY_MODE", "http/dup")
159+
t.Setenv("OTEL_SEMCONV_STABILITY_OPT_IN", "http/dup")
160160
testcases := []struct {
161161
resp http.Response
162162
want []attribute.KeyValue

instrumentation/net/http/otelhttp/internal/semconv/v1.20.0_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717

1818
func TestV120TraceRequest(t *testing.T) {
1919
// Anything but "http" or "http/dup" works.
20-
t.Setenv("OTEL_HTTP_CLIENT_COMPATIBILITY_MODE", "old")
20+
t.Setenv("OTEL_SEMCONV_STABILITY_OPT_IN", "old")
2121
serv := NewHTTPServer(nil)
2222
want := func(req testServerReq) []attribute.KeyValue {
2323
return []attribute.KeyValue{

0 commit comments

Comments
 (0)