PrometheusComponentProvider promotes all resource attributes when resource_constant_labels is empty ({})
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- java, prometheus
- Domain
- backend, observability
Research direction
Start in exporters/prometheus/src/main/java/io/opentelemetry/exporter/prometheus/internal/PrometheusComponentProvider.java, especially the resource_constant_labels parsing around lines 63–76, and trace how an empty configuration reaches IncludeExcludePredicate.createPatternMatching. Check the related predicate tests and Prometheus exporter tests first. Done means an empty map adds no resource attributes as metric labels, with regression coverage for that configuration.
Written by the indexing model from the issue text.
Description
Describe the bug
In PrometheusComponentProvider.java, configuring an empty resource_constant_labels: {} map in declarative configuration promotes all resource attributes onto every Prometheus metric series instead of none.
resource_constant_labels: {} is currently valid against the opentelemetry-configuration JSON Schema ($defs.IncludeExclude sets minItems: 1 on included and excluded, not minProperties: 1 on the object). When parsed:
meter_provider:
readers:
- pull:
exporter:
prometheus/development:
resource_constant_labels: {}
config.getStructured("resource_constant_labels") returns a non-null DeclarativeConfigProperties where both included and excluded are null, and passes (null, null) to IncludeExcludePredicate.createPatternMatching(null, null), which returns an include-all predicate (attributeKey -> true).
Expected behavior
Per the Prometheus exporter specification (By default, it MUST NOT add any resource attributes as metric labels) and ExperimentalPrometheusMetricExporter.resource_constant_labels (defaultBehavior: no resource attributes are added), when both included and excluded are null (matching Collector's pkg/resourcetotelemetry IsEmpty() check), no resource attributes should be added as metric labels (or empty {} should be rejected if disallowed by opentelemetry-configuration).
- Dominant language
- Java
- Stars
- 2.5k
- Forks
- 1k
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 49
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from open-telemetry/opentelemetry-java
-
Retry-After parser accepts invalid delay-seconds valuesPossibly taken @Dhruvraj-Rana claimed this today. OpenBug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
open-telemetry/opentelemetry-java#9018 ·
Maintainers usually reply within 2 days
-
MetricReusableDataMarshaler passes MetricData count instead of data point count to otel.sdk.exporter.metric_data_point.{inflight,exported}Possibly taken @goutamadwant claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
open-telemetry/opentelemetry-java#9011 · 1 comment ·
Maintainers usually reply within 2 days
-
Fix `otel.sdk.log.created` counting semanticsPossibly taken @anuraaga claimed this 94 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
open-telemetry/opentelemetry-java#8688 ·
Maintainers usually reply within 2 days
-
Add experimental view_matching_mode (composable metric views) supportPossibly taken @rooks-ns claimed this today. Open
Difficulty 5/5 Over a week Newbie friendliness 35/100
open-telemetry/opentelemetry-java#9013 ·
Maintainers usually reply within 2 days
-
Span/log processors and PeriodicMetricReader use static ComponentId, causing all instances to share otel.component.name "<type>/0"Possibly taken @goutamadwant claimed this today. Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
open-telemetry/opentelemetry-java#9012 ·
Maintainers usually reply within 2 days
All issues in open-telemetry/opentelemetry-java
Similar issues
-
Document and enforce pull request review guidelinesPossibly taken @dashorst claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
`Time.at(t, in: nil)` returns UTC instead of the local time (or the time zone of `t`), unlike CRubyOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
hermes-queue
Difficulty 1/5 Under an hour Newbie friendliness 72/100
chrisalunlloyd2-sudo/mindpalace#349 ·
Maintainers usually reply within 1 day
-
bug priority: medium Review effort [1-5]: 2 status: needs-triage type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
carlos-emr/carlos#5818 ·
Maintainers usually reply within 1 day
-
bug good first issue help wanted tooling
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
appmonster007/kmip-adapter#100 ·