Skip to content
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

Prometheus exporter does not support openmetrics-text 1.0.0 #18913

Closed
jonatan-ivanov opened this issue Feb 24, 2023 · 12 comments
Closed

Prometheus exporter does not support openmetrics-text 1.0.0 #18913

jonatan-ivanov opened this issue Feb 24, 2023 · 12 comments
Labels

Comments

@jonatan-ivanov
Copy link
Member

jonatan-ivanov commented Feb 24, 2023

Component(s)

exporter/prometheus

What happened?

Description

It seems the Prometheus exporter does not support openmetrics-text 1.0.0, it only supports openmetrics-text 0.0.1.

Steps to Reproduce

Scrape the /metrics endpoint and request openmetrics-text 1.0.0:

Accept: application/openmetrics-text; version=1.0.0; charset=utf-8

Expected Result

Result in OpenMetrics format, also the content-type should be:

Content-Type: application/openmetrics-text; version=1.0.0; charset=utf-8

Actual Result

Result in Prometheus plaintext format, the content-type says the same:

Content-Type: text/plain; version=0.0.4; charset=utf-8

Collector version

otel/opentelemetry-collector-contrib:cdf47846a7ff

Environment information

Environment

OS: MacOS 13.2.1

OpenTelemetry Collector configuration

receivers:
  otlp:
    protocols:
      grpc:
      http:

exporters:
  prometheus:
    endpoint: '0.0.0.0:9090'
    metric_expiration: 1m
    enable_open_metrics: true
    resource_to_telemetry_conversion:
      enabled: true

service:
  pipelines:
    metrics:
      receivers: [otlp]
      exporters: [prometheus]

Log output

No response

Additional context

If I scrape the /metrics endpoint and request openmetrics-text 0.0.1, I get the response in the OpenMetrics format:

Accept: application/openmetrics-text; version=0.0.1; charset=utf-8

will result in

Content-Type: application/openmetrics-text; version=0.0.1; charset=utf-8

The problem is that 0.0.1 should not be used, only 1.0.0.
According to the OpenMetrics specs:

The content type MUST be: application/openmetrics-text; version=1.0.0; charset=utf-8

Also the Prometheus server uses 1.0.0 for scraping: prometheus/prometheus#9430

@jonatan-ivanov jonatan-ivanov added bug Something isn't working needs triage New item requiring triage labels Feb 24, 2023
@github-actions
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@Aneurysm9
Copy link
Member

The prometheus exporter uses promhttp to handle requests. The content type negotiation for OpenMetrics exposition is handled by that package and gets the OpenMetrics version from another Prometheus-owned package. If this is fixed upstream we will inherit the fix.

@Aneurysm9 Aneurysm9 added priority:p2 Medium and removed needs triage New item requiring triage labels Feb 24, 2023
@jonatan-ivanov
Copy link
Member Author

Thanks, do you think it would worth adding tests for this on OTel side?

@jonatan-ivanov
Copy link
Member Author

fyi: prometheus/common#456

@github-actions
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions github-actions bot added the Stale label Apr 26, 2023
@jonatan-ivanov
Copy link
Member Author

@Aneurysm9 Do you know anyone we can ping on Prometheus side about this?
Also, Is there anything that can be done on OTel side?

@Aneurysm9
Copy link
Member

@gouthamve do you know if there is any movement on the Prometheus end for this? What impact will folding OpenMetrics into Prometheus have on this?

@mx-psi mx-psi removed the Stale label May 2, 2023
@jonatan-ivanov
Copy link
Member Author

jonatan-ivanov commented May 10, 2023

Fyi, it seems the fix for the issue in Prometheus was released.

@gouthamve
Copy link
Member

opened: prometheus/prometheus#12411

@gouthamve
Copy link
Member

Hi @jonatan-ivanov, this should be fixed now. Can we close this?

@jonatan-ivanov
Copy link
Member Author

jonatan-ivanov commented Jun 29, 2023

Thanks! I checked 0.80.0, I checked it with Micrometer's integration tests, it seems it support application/openmetrics-text; version=1.0.0. Though 0.80.0 contains a bunch of breaking changes so I'm not going to migrate Micrometer tests to 0.0.80 just yet.

From my/Micrometer's perspective, I think this issue can be closed.
From Otel perspective, do you think it would worth adding tests for this?

@github-actions
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants