diff --git a/.chloggen/45089-zipkin-http-scope-gates-beta.yaml b/.chloggen/45089-zipkin-http-scope-gates-beta.yaml new file mode 100644 index 0000000000000..c509821e7b266 --- /dev/null +++ b/.chloggen/45089-zipkin-http-scope-gates-beta.yaml @@ -0,0 +1,30 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog) +component: pkg/zipkin + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Promote "pkg.translator.zipkin.EmitV1HttpConventions", "pkg.translator.zipkin.DontEmitV0HttpConventions", "pkg.translator.zipkin.EmitV1ScopeConventions", and "pkg.translator.zipkin.DontEmitV0ScopeConventions" feature gates to Beta. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [50909] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: | + This changes the default behavior to emit the new semantic convention attributes instead of the old deprecated ones. + The Zipkin translator will now use `http.response.status_code` (replacing `http.status_code`), `otel.scope.name` + (replacing `otel.library.name`), and `otel.scope.version` (replacing `otel.library.version`) by default when emitting spans. + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/.chloggen/45293-goldendataset-http-to-beta.yaml b/.chloggen/45293-goldendataset-http-to-beta.yaml new file mode 100644 index 0000000000000..c75c2d3483af4 --- /dev/null +++ b/.chloggen/45293-goldendataset-http-to-beta.yaml @@ -0,0 +1,34 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog) +component: pkg/coreinternal + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Promote internal.coreinternal.goldendataset.DontEmitV0HTTPConventions and internal.coreinternal.goldendataset.EmitV1HTTPConventions feature gates to Beta + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [45293, 45089] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: | + Both feature gates should be promoted together as per RFC. + goldendataset now generates spans with user_agent.original, network.protocol.name, + network.protocol.version, client.address, and http.response.status_code (semconv v1.40.0) + by default, and no longer generates the deprecated http.user_agent, http.flavor + (semconv v1.19.0), http.client_ip, and http.status_code (semconv v1.25.0) attributes. + The http.status_code migration is now wired to these gates so that round-trip translation + stays consistent with pkg.translator.zipkin's HTTP semantic convention feature gates. + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] diff --git a/internal/coreinternal/documentation.md b/internal/coreinternal/documentation.md index 4540c3c72c38d..5ca09871f16f4 100644 --- a/internal/coreinternal/documentation.md +++ b/internal/coreinternal/documentation.md @@ -10,13 +10,13 @@ This component has the following feature gates: | ------------ | ----- | ----------- | ------------ | ---------- | --------- | | `internal.coreinternal.goldendataset.DontEmitV0DatabaseConventions` | alpha | When enabled, goldendataset no longer generates spans with deprecated semconv v1.28.0 attribute db.system. | v0.154.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45299) | | `internal.coreinternal.goldendataset.DontEmitV0FaaSConventions` | alpha | When enabled, goldendataset no longer generates spans with deprecated semconv FaaS attributes like faas.execution. | v0.155.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45293) | -| `internal.coreinternal.goldendataset.DontEmitV0HTTPConventions` | alpha | When enabled, goldendataset no longer generates spans with deprecated semconv HTTP attributes http.user_agent, http.flavor (semconv v1.19.0), and http.client_ip. | v0.154.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45293) | +| `internal.coreinternal.goldendataset.DontEmitV0HTTPConventions` | beta | When enabled, goldendataset no longer generates spans with deprecated semconv HTTP attributes http.user_agent, http.flavor (semconv v1.19.0), http.client_ip, and http.status_code (semconv v1.25.0). Enable together with pkg.translator.zipkin.DontEmitV0HttpConventions for consistent round-trip translation in tests. | v0.154.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45293) | | `internal.coreinternal.goldendataset.DontEmitV0MessagingConventions` | beta | When enabled, goldendataset no longer generates spans with deprecated semconv attributes messaging.destination (semconv v1.16.0) and messaging.destination.kind (semconv v1.19.0). | v0.155.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45077) | | `internal.coreinternal.goldendataset.DontEmitV0NetworkConventions` | beta | When enabled, goldendataset no longer generates spans with deprecated semconv v1.12.0 attributes (net.host.ip, net.peer.ip, http.host, http.server_name). | v0.147.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45076) | | `internal.coreinternal.goldendataset.DontEmitV0RPCConventions` | beta | When enabled, goldendataset no longer generates spans with deprecated semconv RPC attributes rpc.service and peer.service. | v0.148.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/47548) | | `internal.coreinternal.goldendataset.EmitV1DatabaseConventions` | alpha | When enabled, goldendataset generates spans with db.system.name (semconv v1.40.0) instead of the deprecated db.system (semconv v1.28.0). | v0.154.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45299) | | `internal.coreinternal.goldendataset.EmitV1FaaSConventions` | alpha | When enabled, goldendataset generates spans with faas.invocation_id (semconv v1.40.0) alongside legacy faas.execution to support migration. | v0.155.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45293) | -| `internal.coreinternal.goldendataset.EmitV1HTTPConventions` | alpha | When enabled, goldendataset generates spans with user_agent.original, network.protocol.name, network.protocol.version, and client.address (semconv v1.40.0) alongside legacy http.user_agent, http.flavor, and http.client_ip to support migration. | v0.154.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45293) | +| `internal.coreinternal.goldendataset.EmitV1HTTPConventions` | beta | When enabled, goldendataset generates spans with user_agent.original, network.protocol.name, network.protocol.version, client.address, and http.response.status_code (semconv v1.40.0) alongside legacy http.user_agent, http.flavor, http.client_ip, and http.status_code to support migration. Enable together with pkg.translator.zipkin.EmitV1HttpConventions for consistent round-trip translation in tests. | v0.154.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45293) | | `internal.coreinternal.goldendataset.EmitV1MessagingConventions` | beta | When enabled, goldendataset generates spans with messaging.destination.name (semconv v1.40.0) alongside legacy messaging.destination to support migration. | v0.155.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45077) | | `internal.coreinternal.goldendataset.EmitV1NetworkConventions` | beta | When enabled, goldendataset generates spans with network.local.address, network.peer.address, and server.address (semconv v1.38.0) instead of the deprecated net.host.ip, net.peer.ip, http.host, http.server_name (semconv v1.12.0). Enable together with pkg.translator.zipkin.EmitV1NetworkConventions for consistent round-trip translation in tests. | v0.147.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45076) | | `internal.coreinternal.goldendataset.EmitV1RPCConventions` | beta | When enabled, goldendataset generates spans with rpc.method and service.peer.name (semconv v1.40.0) alongside legacy rpc.service and peer.service to support migration. | v0.148.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/47548) | diff --git a/internal/coreinternal/goldendataset/span_generator.go b/internal/coreinternal/goldendataset/span_generator.go index 788dc3a63c0f4..16edd2a172fb0 100644 --- a/internal/coreinternal/goldendataset/span_generator.go +++ b/internal/coreinternal/goldendataset/span_generator.go @@ -283,7 +283,12 @@ func appendFaaSHTTPAttributes(includeStatus bool, attrMap pcommon.Map) { attrMap.PutStr(string(conventions.NetworkProtocolVersionKey), "2") } if includeStatus { - attrMap.PutInt(string(conventionsv125.HTTPStatusCodeKey), 201) + if !metadata.InternalCoreinternalGoldendatasetDontEmitV0HTTPConventionsFeatureGate.IsEnabled() { + attrMap.PutInt(string(conventionsv125.HTTPStatusCodeKey), 201) + } + if metadata.InternalCoreinternalGoldendatasetEmitV1HTTPConventionsFeatureGate.IsEnabled() { + attrMap.PutInt(string(conventions.HTTPResponseStatusCodeKey), 201) + } } if !metadata.InternalCoreinternalGoldendatasetDontEmitV0HTTPConventionsFeatureGate.IsEnabled() { attrMap.PutStr(string(conventionsv118.HTTPUserAgentKey), @@ -334,7 +339,12 @@ func appendHTTPClientAttributes(includeStatus bool, attrMap pcommon.Map) { attrMap.PutStr(string(conventionsv125.HTTPMethodKey), http.MethodGet) attrMap.PutStr(string(conventionsv125.HTTPURLKey), "https://opentelemetry.io/registry/") if includeStatus { - attrMap.PutInt(string(conventionsv125.HTTPStatusCodeKey), 200) + if !metadata.InternalCoreinternalGoldendatasetDontEmitV0HTTPConventionsFeatureGate.IsEnabled() { + attrMap.PutInt(string(conventionsv125.HTTPStatusCodeKey), 200) + } + if metadata.InternalCoreinternalGoldendatasetEmitV1HTTPConventionsFeatureGate.IsEnabled() { + attrMap.PutInt(string(conventions.HTTPResponseStatusCodeKey), 200) + } attrMap.PutStr("http.status_text", "More Than OK") } attrMap.PutStr(string(conventionsv126.EnduserIDKey), "unittest") @@ -359,7 +369,12 @@ func appendHTTPServerAttributes(includeStatus bool, attrMap pcommon.Map) { attrMap.PutStr(string(conventions.NetworkProtocolVersionKey), "2") } if includeStatus { - attrMap.PutInt(string(conventionsv125.HTTPStatusCodeKey), 201) + if !metadata.InternalCoreinternalGoldendatasetDontEmitV0HTTPConventionsFeatureGate.IsEnabled() { + attrMap.PutInt(string(conventionsv125.HTTPStatusCodeKey), 201) + } + if metadata.InternalCoreinternalGoldendatasetEmitV1HTTPConventionsFeatureGate.IsEnabled() { + attrMap.PutInt(string(conventions.HTTPResponseStatusCodeKey), 201) + } } if !metadata.InternalCoreinternalGoldendatasetDontEmitV0HTTPConventionsFeatureGate.IsEnabled() { attrMap.PutStr(string(conventionsv118.HTTPUserAgentKey), @@ -481,7 +496,12 @@ func appendMaxCountAttributes(includeStatus bool, attrMap pcommon.Map) { attrMap.PutStr(string(conventions.NetworkProtocolVersionKey), "2") } if includeStatus { - attrMap.PutInt(string(conventionsv125.HTTPStatusCodeKey), 201) + if !metadata.InternalCoreinternalGoldendatasetDontEmitV0HTTPConventionsFeatureGate.IsEnabled() { + attrMap.PutInt(string(conventionsv125.HTTPStatusCodeKey), 201) + } + if metadata.InternalCoreinternalGoldendatasetEmitV1HTTPConventionsFeatureGate.IsEnabled() { + attrMap.PutInt(string(conventions.HTTPResponseStatusCodeKey), 201) + } attrMap.PutStr("http.status_text", "Created") } if !metadata.InternalCoreinternalGoldendatasetDontEmitV0HTTPConventionsFeatureGate.IsEnabled() { diff --git a/internal/coreinternal/goldendataset/span_generator_test.go b/internal/coreinternal/goldendataset/span_generator_test.go index 09dea5749caee..b6a39b1049169 100644 --- a/internal/coreinternal/goldendataset/span_generator_test.go +++ b/internal/coreinternal/goldendataset/span_generator_test.go @@ -32,7 +32,7 @@ func TestGenerateParentSpan(t *testing.T) { fillSpan(traceID, pcommon.SpanID([8]byte{}), "/gotest-parent", spanInputs, random, span) assert.Equal(t, traceID, span.TraceID()) assert.True(t, span.ParentSpanID().IsEmpty()) - assert.Equal(t, 11, span.Attributes().Len()) + assert.Equal(t, 12, span.Attributes().Len()) assert.Equal(t, ptrace.StatusCodeOk, span.Status().Code()) } diff --git a/internal/coreinternal/internal/metadata/generated_feature_gates.go b/internal/coreinternal/internal/metadata/generated_feature_gates.go index 42d8d4bd4aeb3..8adf1fd2561e0 100644 --- a/internal/coreinternal/internal/metadata/generated_feature_gates.go +++ b/internal/coreinternal/internal/metadata/generated_feature_gates.go @@ -24,8 +24,8 @@ var InternalCoreinternalGoldendatasetDontEmitV0FaaSConventionsFeatureGate = feat var InternalCoreinternalGoldendatasetDontEmitV0HTTPConventionsFeatureGate = featuregate.GlobalRegistry().MustRegister( "internal.coreinternal.goldendataset.DontEmitV0HTTPConventions", - featuregate.StageAlpha, - featuregate.WithRegisterDescription("When enabled, goldendataset no longer generates spans with deprecated semconv HTTP attributes http.user_agent, http.flavor (semconv v1.19.0), and http.client_ip."), + featuregate.StageBeta, + featuregate.WithRegisterDescription("When enabled, goldendataset no longer generates spans with deprecated semconv HTTP attributes http.user_agent, http.flavor (semconv v1.19.0), http.client_ip, and http.status_code (semconv v1.25.0). Enable together with pkg.translator.zipkin.DontEmitV0HttpConventions for consistent round-trip translation in tests."), featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45293"), featuregate.WithRegisterFromVersion("v0.154.0"), ) @@ -72,8 +72,8 @@ var InternalCoreinternalGoldendatasetEmitV1FaaSConventionsFeatureGate = featureg var InternalCoreinternalGoldendatasetEmitV1HTTPConventionsFeatureGate = featuregate.GlobalRegistry().MustRegister( "internal.coreinternal.goldendataset.EmitV1HTTPConventions", - featuregate.StageAlpha, - featuregate.WithRegisterDescription("When enabled, goldendataset generates spans with user_agent.original, network.protocol.name, network.protocol.version, and client.address (semconv v1.40.0) alongside legacy http.user_agent, http.flavor, and http.client_ip to support migration."), + featuregate.StageBeta, + featuregate.WithRegisterDescription("When enabled, goldendataset generates spans with user_agent.original, network.protocol.name, network.protocol.version, client.address, and http.response.status_code (semconv v1.40.0) alongside legacy http.user_agent, http.flavor, http.client_ip, and http.status_code to support migration. Enable together with pkg.translator.zipkin.EmitV1HttpConventions for consistent round-trip translation in tests."), featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45293"), featuregate.WithRegisterFromVersion("v0.154.0"), ) diff --git a/internal/coreinternal/metadata.yaml b/internal/coreinternal/metadata.yaml index 2857de5f4b06d..fdcddf443e39e 100644 --- a/internal/coreinternal/metadata.yaml +++ b/internal/coreinternal/metadata.yaml @@ -24,11 +24,13 @@ feature_gates: from_version: v0.155.0 reference_url: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45293 - id: internal.coreinternal.goldendataset.DontEmitV0HTTPConventions - stage: alpha + stage: beta description: >- When enabled, goldendataset no longer generates spans with deprecated semconv HTTP attributes http.user_agent, http.flavor (semconv v1.19.0), - and http.client_ip. + http.client_ip, and http.status_code (semconv v1.25.0). Enable together + with pkg.translator.zipkin.DontEmitV0HttpConventions for consistent + round-trip translation in tests. from_version: v0.154.0 reference_url: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45293 - id: internal.coreinternal.goldendataset.DontEmitV0MessagingConventions @@ -68,12 +70,15 @@ feature_gates: from_version: v0.155.0 reference_url: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45293 - id: internal.coreinternal.goldendataset.EmitV1HTTPConventions - stage: alpha + stage: beta description: >- When enabled, goldendataset generates spans with user_agent.original, - network.protocol.name, network.protocol.version, and client.address - (semconv v1.40.0) alongside legacy http.user_agent, http.flavor, and - http.client_ip to support migration. + network.protocol.name, network.protocol.version, client.address, and + http.response.status_code (semconv v1.40.0) alongside legacy + http.user_agent, http.flavor, http.client_ip, and http.status_code to + support migration. Enable together with + pkg.translator.zipkin.EmitV1HttpConventions for consistent round-trip + translation in tests. from_version: v0.154.0 reference_url: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45293 - id: internal.coreinternal.goldendataset.EmitV1MessagingConventions diff --git a/pkg/translator/zipkin/documentation.md b/pkg/translator/zipkin/documentation.md index 3f3c7b26f9138..f0d96ada3c488 100644 --- a/pkg/translator/zipkin/documentation.md +++ b/pkg/translator/zipkin/documentation.md @@ -9,12 +9,12 @@ This component has the following feature gates: | Feature Gate | Stage | Description | From Version | To Version | Reference | | ------------ | ----- | ----------- | ------------ | ---------- | --------- | | `pkg.translator.zipkin.DontEmitV0CloudResourceConventions` | alpha | When enabled, the Zipkin translator no longer emits the deprecated faas.id attribute (semconv v1.18.0). Requires pkg.translator.zipkin.EmitV1CloudResourceConventions to also be enabled. | v0.155.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45080) | -| `pkg.translator.zipkin.DontEmitV0HttpConventions` | alpha | When enabled, the Zipkin translator no longer emits the deprecated http.status_code attribute (semconv v1.25.0). Requires pkg.translator.zipkin.EmitV1HttpConventions to also be enabled. | v0.154.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45089) | +| `pkg.translator.zipkin.DontEmitV0HttpConventions` | beta | When enabled, the Zipkin translator no longer emits the deprecated http.status_code attribute (semconv v1.25.0). Requires pkg.translator.zipkin.EmitV1HttpConventions to also be enabled. | v0.154.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45089) | | `pkg.translator.zipkin.DontEmitV0NetworkConventions` | beta | When enabled, the Zipkin translator no longer emits the deprecated net.host.ip, net.peer.ip, and peer.service (semconv v1.12.0) attributes. Requires pkg.translator.zipkin.EmitV1NetworkConventions to also be enabled. | v0.147.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45041) | -| `pkg.translator.zipkin.DontEmitV0ScopeConventions` | alpha | When enabled, the Zipkin translator no longer emits the deprecated otel.library.name and otel.library.version attributes (semconv v1.25.0). Requires pkg.translator.zipkin.EmitV1ScopeConventions to also be enabled. | v0.154.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45089) | +| `pkg.translator.zipkin.DontEmitV0ScopeConventions` | beta | When enabled, the Zipkin translator no longer emits the deprecated otel.library.name and otel.library.version attributes (semconv v1.25.0). Requires pkg.translator.zipkin.EmitV1ScopeConventions to also be enabled. | v0.154.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45089) | | `pkg.translator.zipkin.EmitV1CloudResourceConventions` | alpha | When enabled, the Zipkin translator emits cloud.resource_id (semconv v1.40.0) instead of the deprecated faas.id (semconv v1.18.0). | v0.155.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45080) | -| `pkg.translator.zipkin.EmitV1HttpConventions` | alpha | When enabled, the Zipkin translator emits http.response.status_code (semconv v1.40.0) instead of the deprecated http.status_code (semconv v1.25.0). | v0.154.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45089) | +| `pkg.translator.zipkin.EmitV1HttpConventions` | beta | When enabled, the Zipkin translator emits http.response.status_code (semconv v1.40.0) instead of the deprecated http.status_code (semconv v1.25.0). | v0.154.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45089) | | `pkg.translator.zipkin.EmitV1NetworkConventions` | beta | When enabled, the Zipkin translator emits network.local.address and network.peer.address and service.peer.name (semconv v1.40.0) instead of the deprecated net.host.ip, net.peer.ip, and peer.service (semconv v1.12.0). | v0.147.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45041) | -| `pkg.translator.zipkin.EmitV1ScopeConventions` | alpha | When enabled, the Zipkin translator emits otel.scope.name and otel.scope.version (semconv v1.40.0) instead of the deprecated otel.library.name and otel.library.version (semconv v1.25.0). | v0.154.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45089) | +| `pkg.translator.zipkin.EmitV1ScopeConventions` | beta | When enabled, the Zipkin translator emits otel.scope.name and otel.scope.version (semconv v1.40.0) instead of the deprecated otel.library.name and otel.library.version (semconv v1.25.0). | v0.154.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45089) | For more information about feature gates, see the [Feature Gates](https://github.com/open-telemetry/opentelemetry-collector/blob/main/featuregate/README.md) documentation. diff --git a/pkg/translator/zipkin/internal/metadata/generated_feature_gates.go b/pkg/translator/zipkin/internal/metadata/generated_feature_gates.go index b2f97879284f9..a280b351c07db 100644 --- a/pkg/translator/zipkin/internal/metadata/generated_feature_gates.go +++ b/pkg/translator/zipkin/internal/metadata/generated_feature_gates.go @@ -16,7 +16,7 @@ var PkgTranslatorZipkinDontEmitV0CloudResourceConventionsFeatureGate = featurega var PkgTranslatorZipkinDontEmitV0HTTPConventionsFeatureGate = featuregate.GlobalRegistry().MustRegister( "pkg.translator.zipkin.DontEmitV0HttpConventions", - featuregate.StageAlpha, + featuregate.StageBeta, featuregate.WithRegisterDescription("When enabled, the Zipkin translator no longer emits the deprecated http.status_code attribute (semconv v1.25.0). Requires pkg.translator.zipkin.EmitV1HttpConventions to also be enabled."), featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45089"), featuregate.WithRegisterFromVersion("v0.154.0"), @@ -32,7 +32,7 @@ var PkgTranslatorZipkinDontEmitV0NetworkConventionsFeatureGate = featuregate.Glo var PkgTranslatorZipkinDontEmitV0ScopeConventionsFeatureGate = featuregate.GlobalRegistry().MustRegister( "pkg.translator.zipkin.DontEmitV0ScopeConventions", - featuregate.StageAlpha, + featuregate.StageBeta, featuregate.WithRegisterDescription("When enabled, the Zipkin translator no longer emits the deprecated otel.library.name and otel.library.version attributes (semconv v1.25.0). Requires pkg.translator.zipkin.EmitV1ScopeConventions to also be enabled."), featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45089"), featuregate.WithRegisterFromVersion("v0.154.0"), @@ -48,7 +48,7 @@ var PkgTranslatorZipkinEmitV1CloudResourceConventionsFeatureGate = featuregate.G var PkgTranslatorZipkinEmitV1HTTPConventionsFeatureGate = featuregate.GlobalRegistry().MustRegister( "pkg.translator.zipkin.EmitV1HttpConventions", - featuregate.StageAlpha, + featuregate.StageBeta, featuregate.WithRegisterDescription("When enabled, the Zipkin translator emits http.response.status_code (semconv v1.40.0) instead of the deprecated http.status_code (semconv v1.25.0)."), featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45089"), featuregate.WithRegisterFromVersion("v0.154.0"), @@ -64,7 +64,7 @@ var PkgTranslatorZipkinEmitV1NetworkConventionsFeatureGate = featuregate.GlobalR var PkgTranslatorZipkinEmitV1ScopeConventionsFeatureGate = featuregate.GlobalRegistry().MustRegister( "pkg.translator.zipkin.EmitV1ScopeConventions", - featuregate.StageAlpha, + featuregate.StageBeta, featuregate.WithRegisterDescription("When enabled, the Zipkin translator emits otel.scope.name and otel.scope.version (semconv v1.40.0) instead of the deprecated otel.library.name and otel.library.version (semconv v1.25.0)."), featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45089"), featuregate.WithRegisterFromVersion("v0.154.0"), diff --git a/pkg/translator/zipkin/metadata.yaml b/pkg/translator/zipkin/metadata.yaml index 5ce267aea2164..d002be0a66c23 100644 --- a/pkg/translator/zipkin/metadata.yaml +++ b/pkg/translator/zipkin/metadata.yaml @@ -18,7 +18,7 @@ feature_gates: from_version: v0.155.0 reference_url: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45080 - id: pkg.translator.zipkin.DontEmitV0HttpConventions - stage: alpha + stage: beta description: >- When enabled, the Zipkin translator no longer emits the deprecated http.status_code attribute (semconv v1.25.0). @@ -35,7 +35,7 @@ feature_gates: from_version: v0.147.0 reference_url: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45041 - id: pkg.translator.zipkin.DontEmitV0ScopeConventions - stage: alpha + stage: beta description: >- When enabled, the Zipkin translator no longer emits the deprecated otel.library.name and otel.library.version attributes (semconv v1.25.0). @@ -51,7 +51,7 @@ feature_gates: from_version: v0.155.0 reference_url: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45080 - id: pkg.translator.zipkin.EmitV1HttpConventions - stage: alpha + stage: beta description: >- When enabled, the Zipkin translator emits http.response.status_code (semconv v1.40.0) instead of the deprecated http.status_code @@ -68,7 +68,7 @@ feature_gates: from_version: v0.147.0 reference_url: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45041 - id: pkg.translator.zipkin.EmitV1ScopeConventions - stage: alpha + stage: beta description: >- When enabled, the Zipkin translator emits otel.scope.name and otel.scope.version (semconv v1.40.0) instead of the deprecated diff --git a/pkg/translator/zipkin/zipkinv1/json_test.go b/pkg/translator/zipkin/zipkinv1/json_test.go index a93343aa759f0..ef5907251e074 100644 --- a/pkg/translator/zipkin/zipkinv1/json_test.go +++ b/pkg/translator/zipkin/zipkinv1/json_test.go @@ -15,6 +15,7 @@ import ( zipkinmodel "github.com/openzipkin/zipkin-go/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/featuregate" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/ptrace" @@ -188,6 +189,16 @@ func TestMultipleJSONV1BatchesToTraces(t *testing.T) { } func TestZipkinAnnotationsToSpanStatus(t *testing.T) { + // These cases assert the v0 (http.status_code) attribute is emitted, so pin the + // HTTP semantic-convention gates to their pre-Beta (disabled) state and restore + // the Beta default afterwards. + require.NoError(t, featuregate.GlobalRegistry().Set("pkg.translator.zipkin.DontEmitV0HttpConventions", false)) + require.NoError(t, featuregate.GlobalRegistry().Set("pkg.translator.zipkin.EmitV1HttpConventions", false)) + t.Cleanup(func() { + require.NoError(t, featuregate.GlobalRegistry().Set("pkg.translator.zipkin.DontEmitV0HttpConventions", true)) + require.NoError(t, featuregate.GlobalRegistry().Set("pkg.translator.zipkin.EmitV1HttpConventions", true)) + }) + type test struct { name string haveTags []*binaryAnnotation diff --git a/pkg/translator/zipkin/zipkinv2/from_translator_test.go b/pkg/translator/zipkin/zipkinv2/from_translator_test.go index fc8768c2f87ba..629bdc16eeed9 100644 --- a/pkg/translator/zipkin/zipkinv2/from_translator_test.go +++ b/pkg/translator/zipkin/zipkinv2/from_translator_test.go @@ -180,12 +180,23 @@ func TestExtractScopeTags(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - if tt.name == "with attributes and name/version (v1)" { + // The Scope semconv gates default to Beta (enabled). Pin them per-case so + // both the v0 (otel.library.*) and v1 (otel.scope.*) outputs stay covered, + // restoring the Beta default afterwards. + switch tt.name { + case "with attributes and name/version": + require.NoError(t, featuregate.GlobalRegistry().Set("pkg.translator.zipkin.DontEmitV0ScopeConventions", false)) + require.NoError(t, featuregate.GlobalRegistry().Set("pkg.translator.zipkin.EmitV1ScopeConventions", false)) + defer func() { + require.NoError(t, featuregate.GlobalRegistry().Set("pkg.translator.zipkin.DontEmitV0ScopeConventions", true)) + require.NoError(t, featuregate.GlobalRegistry().Set("pkg.translator.zipkin.EmitV1ScopeConventions", true)) + }() + case "with attributes and name/version (v1)": require.NoError(t, featuregate.GlobalRegistry().Set("pkg.translator.zipkin.DontEmitV0ScopeConventions", true)) require.NoError(t, featuregate.GlobalRegistry().Set("pkg.translator.zipkin.EmitV1ScopeConventions", true)) defer func() { - require.NoError(t, featuregate.GlobalRegistry().Set("pkg.translator.zipkin.DontEmitV0ScopeConventions", false)) - require.NoError(t, featuregate.GlobalRegistry().Set("pkg.translator.zipkin.EmitV1ScopeConventions", false)) + require.NoError(t, featuregate.GlobalRegistry().Set("pkg.translator.zipkin.DontEmitV0ScopeConventions", true)) + require.NoError(t, featuregate.GlobalRegistry().Set("pkg.translator.zipkin.EmitV1ScopeConventions", true)) }() } diff --git a/receiver/zipkinreceiver/trace_receiver_test.go b/receiver/zipkinreceiver/trace_receiver_test.go index 1e3ef1ff64448..9969616544289 100644 --- a/receiver/zipkinreceiver/trace_receiver_test.go +++ b/receiver/zipkinreceiver/trace_receiver_test.go @@ -503,16 +503,16 @@ func TestReceiverConvertsStringsToTypes(t *testing.T) { span := td.ResourceSpans().At(0).ScopeSpans().At(0).Spans().At(0) expected := map[string]any{ - "cache_hit": true, - "ping_count": int64(25), - "timeout": 12.3, - "clnt/finagle.version": "6.45.0", - "http.path": "/api", - "http.status_code": int64(500), - "network.local.address": "7::80:807f", - "service.peer.name": "backend", - "network.peer.address": "192.168.99.101", - "net.peer.port": int64(9000), + "cache_hit": true, + "ping_count": int64(25), + "timeout": 12.3, + "clnt/finagle.version": "6.45.0", + "http.path": "/api", + "http.response.status_code": int64(500), + "network.local.address": "7::80:807f", + "service.peer.name": "backend", + "network.peer.address": "192.168.99.101", + "net.peer.port": int64(9000), } assert.Equal(t, expected, span.Attributes().AsRaw())