Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
38 changes: 38 additions & 0 deletions .chloggen/prom_enable_scope_info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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. otlpreceiver)
component: service

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Default internal metrics config now enables `otel_scope_` labels

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

# (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: |
By default, the Collector exports its internal metrics using a Prometheus
exporter from the opentelemetry-go repository. With this change, the Collector
no longer sets "without_scope_info" to true in its configuration.
This means that all exported metrics will have `otel_scope_name`,
`otel_scope_schema_url`, and `otel_scope_version` labels corresponding to the
instrumentation scope metadata for that metric.
This notably prevents an error when multiple metrics are only distinguished
by their instrumentation scopes and end up aliased during export.
If this is not desired behavior, a Prometheus exporter can be explicitly
configured with this option enabled.
# 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: []
2 changes: 1 addition & 1 deletion cmd/otelcorecol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module go.opentelemetry.io/collector/cmd/otelcorecol

go 1.23.0

toolchain go1.23.10
toolchain go1.24.4

require (
go.opentelemetry.io/collector/component v1.35.0
Expand Down
1 change: 0 additions & 1 deletion service/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ func TestConfmapMarshalConfig(t *testing.T) {
"with_resource_constant_labels": map[string]any{
"included": []any{},
},
"without_scope_info": true,
"without_type_suffix": true,
"without_units": true,
},
Expand Down
1 change: 0 additions & 1 deletion service/internal/promtest/server_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func addrToPrometheus(address string) *config.Prometheus {
return &config.Prometheus{
Host: &host,
Port: &portInt,
WithoutScopeInfo: ptr(true),
WithoutUnits: ptr(true),
WithoutTypeSuffix: ptr(true),
WithResourceConstantLabels: &config.IncludeExclude{
Expand Down
1 change: 0 additions & 1 deletion service/telemetry/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ func createDefaultConfig() component.Config {
Readers: []config.MetricReader{
{
Pull: &config.PullMetricReader{Exporter: config.PullMetricExporter{Prometheus: &config.Prometheus{
WithoutScopeInfo: newPtr(true),
WithoutUnits: newPtr(true),
WithoutTypeSuffix: newPtr(true),
Host: &metricsHost,
Expand Down
40 changes: 25 additions & 15 deletions service/telemetry/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
otelPrefix = "otel_sdk_"
grpcPrefix = "grpc_"
httpPrefix = "http_"
scopeName = "collector_test"
counterName = "test_counter"
)

Expand All @@ -49,30 +50,39 @@ func TestTelemetryInit(t *testing.T) {
metricPrefix + otelPrefix + counterName: {
value: 13,
labels: map[string]string{
"service_name": "otelcol",
"service_version": "latest",
"service_instance_id": testInstanceID,
"service_name": "otelcol",
"service_version": "latest",
"service_instance_id": testInstanceID,
"otel_scope_name": scopeName,
"otel_scope_schema_url": "",
"otel_scope_version": "",
},
},
metricPrefix + grpcPrefix + counterName: {
value: 11,
labels: map[string]string{
"net_sock_peer_addr": "",
"net_sock_peer_name": "",
"net_sock_peer_port": "",
"service_name": "otelcol",
"service_version": "latest",
"service_instance_id": testInstanceID,
"net_sock_peer_addr": "",
"net_sock_peer_name": "",
"net_sock_peer_port": "",
"service_name": "otelcol",
"service_version": "latest",
"service_instance_id": testInstanceID,
"otel_scope_name": "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc",
"otel_scope_schema_url": "",
"otel_scope_version": "",
},
},
metricPrefix + httpPrefix + counterName: {
value: 10,
labels: map[string]string{
"net_host_name": "",
"net_host_port": "",
"service_name": "otelcol",
"service_version": "latest",
"service_instance_id": testInstanceID,
"net_host_name": "",
"net_host_port": "",
"service_name": "otelcol",
"service_version": "latest",
"service_instance_id": testInstanceID,
"otel_scope_name": "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",
"otel_scope_schema_url": "",
"otel_scope_version": "",
},
},
"target_info": {
Expand Down Expand Up @@ -160,7 +170,7 @@ func TestTelemetryInit(t *testing.T) {

func createTestMetrics(t *testing.T, mp metric.MeterProvider) {
// Creates a OTel Go counter
counter, err := mp.Meter("collector_test").Int64Counter(metricPrefix+otelPrefix+counterName, metric.WithUnit("ms"))
counter, err := mp.Meter(scopeName).Int64Counter(metricPrefix+otelPrefix+counterName, metric.WithUnit("ms"))
require.NoError(t, err)
counter.Add(context.Background(), 13)

Expand Down
Loading