Skip to content

Prometheus declarative config inverts scope_info_enabled and target_info_enabled #8749

Description

@thswlsqls

Describe the bug

PrometheusComponentProvider.create() negates the declarative config values for scope_info_enabled and target_info_enabled/development, so both options do the opposite of what they say.

Steps to reproduce

Declarative config file:

meter_provider:
  readers:
    - pull:
        exporter:
          prometheus/development:
            scope_info_enabled: false
            target_info_enabled/development: false

What did you expect to see?

Scope labels and the target_info metric disabled. The opentelemetry-configuration schema defines both keys as "if omitted or null, true is used", so an explicit true must enable and an explicit false must disable. The generated ExperimentalPrometheusMetricExporterModel javadoc says the same.

What did you see instead?

Both stay enabled. PrometheusComponentProvider.create() (exporters/prometheus/src/main/java/io/opentelemetry/exporter/prometheus/internal/PrometheusComponentProvider.java lines 50-57) applies ! to both values. #8451 renamed the keys from without_scope_info / without_target_info to the positive form but left the negation in place, so the meaning flipped.

What version and what artifacts are you using?

Artifacts: opentelemetry-exporter-prometheus, opentelemetry-sdk-extension-declarative-config
Version: main @ 3a9fdc6 (1.66.0-SNAPSHOT)
How did you reference these artifacts? Built from source.

Environment

Compiler: Temurin 21
OS: N/A

Additional context

MetricReaderFactoryTest's "pull prometheus configured" case passes false for both keys but its expected reader leaves them at the builder default true, so the test only passes while the bug exists.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions