Skip to content

Put component-identifying scope attributes for internal metrics back behind feature gate #12933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
17 changes: 13 additions & 4 deletions .chloggen/lock-attributes-gate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,27 @@ change_type: breaking
component: service

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Set the `telemetry.newPipelineTelemetry` feature gate to stable.
note: Restrict the `telemetry.newPipelineTelemetry` feature gate to metrics.

# One or more tracking issues or pull requests related to the change
issues: [12856]
issues: [12856, 12933]

# (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: |
The off state of this feature gate introduced a regression, where the Collector's internal logs were missing component attributes. See issue #12870 for more details on this bug. Since there does not appear to be much benefit to disabling the gate, we are immediately moving it to stable in order to lock in the correct behavior.
The "off" state of this feature gate introduced a regression, where the Collector's internal logs were missing component attributes. See issue #12870 for more details on this bug.

This comes with a breaking change, where internal logs exported through OTLP will now use instrumentation scope attributes to identify the source component instead of log attributes. This does not affect the Collector's stderr output. See the changelog for v0.123.0 for a more detailed description of the gate's effects.
On the other hand, the "on" state introduced an issue with the Collector's default internal metrics, because the Prometheus exporter does not currently support instrumentation scope attributes.

To solve both of these issues, this change turns on the new scope attributes for logs and traces by default regardless of the feature gate.
However, the new scope attributes for metrics stay locked behind the feature gate, and will remain off by default until the Prometheus exporter is updated to support scope attributes.

Please understand that enabling the `telemetry.newPipelineTelemetry` feature gate may break the export of Collector metrics through, depending on your configuration.
Having a `batch` processor in multiple pipelines is a known trigger for this.

This comes with a breaking change, where internal logs exported through OTLP will now use instrumentation scope attributes to identify the source component instead of log attributes.
This does not affect the Collector's stderr output. See the changelog for v0.123.0 for a more detailed description of the gate's effects.

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
Expand Down
8 changes: 5 additions & 3 deletions internal/telemetry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import (

var NewPipelineTelemetryGate = featuregate.GlobalRegistry().MustRegister(
"telemetry.newPipelineTelemetry",
featuregate.StageStable,
featuregate.StageAlpha,
featuregate.WithRegisterFromVersion("v0.123.0"),
featuregate.WithRegisterToVersion("v0.127.0"),
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/rfcs/component-universal-telemetry.md"),
featuregate.WithRegisterDescription("Injects component-identifying scope attributes in internal Collector metrics"),
)

// IMPORTANT: This struct is reexported as part of the public API of
Expand Down Expand Up @@ -53,6 +53,8 @@ func WithAttributeSet(ts TelemetrySettings, attrs attribute.Set) TelemetrySettin
ts.extraAttributes = attrs
ts.Logger = componentattribute.ZapLoggerWithAttributes(ts.Logger, ts.extraAttributes)
ts.TracerProvider = componentattribute.TracerProviderWithAttributes(ts.TracerProvider, ts.extraAttributes)
ts.MeterProvider = componentattribute.MeterProviderWithAttributes(ts.MeterProvider, ts.extraAttributes)
if NewPipelineTelemetryGate.IsEnabled() {
ts.MeterProvider = componentattribute.MeterProviderWithAttributes(ts.MeterProvider, ts.extraAttributes)
}
return ts
}
Loading