Skip to content

Promtool should support openmetrics #8932

Open

Description

@roidelapluie

Promtool should support openmetrics, next to the text format.

Maybe via --format=openmetrics

Activity

  1. ide-rea commented on Jun 14, 2021

    @ide-rea
    Contributor

    Hi, does this mean check openmetrics format like check prom text format, could you tell me?

  2. roidelapluie commented on Jun 14, 2021

    @roidelapluie
    MemberAuthor

    This issue is to add support for promtool check metrics --format=openmetrics

  3. ide-rea commented on Jun 14, 2021

    @ide-rea
    Contributor

    Thanks, i would like to try if not anybody is working on this.

  4. ide-rea commented on Jun 15, 2021

    @ide-rea
    Contributor

    Hi, i'm a little confused about the check rule. Do we parse the text wire openmetrics format into prometheus MetricFamily, and then encoded the metrics into bytes stream, at last use promlint package to do the check? need your help, thanks :) @roidelapluie

  5. roidelapluie commented on Jun 15, 2021

    @roidelapluie
    MemberAuthor

    This issue would require a openmetrics text parser in go, which does not exist at the moment. We only have a textformat parser in go.

  6. roidelapluie commented on Jun 15, 2021

    @roidelapluie
    MemberAuthor

    Here is the textparser in go: https://github.com/prometheus/common/blob/main/expfmt/text_parse.go
    We should have one openmetrics parser in go for this issue. It should be developed next to the text parser, in the prometheus/common repository.

  7. ide-rea commented on Jun 15, 2021

    @ide-rea
    Contributor

    Thanks, i'm understanding the issue better!

  8. jyz0309 commented on Sep 6, 2023

    @jyz0309
    Contributor

    Is this Issue still valid and can I try it? :)

  9. machine424 commented on Sep 14, 2023

    @machine424
    Member

    I think so, especially that prometheus supports back filling from openmetrics #8084

  10. beorn7 commented on Jun 25, 2024

    @beorn7
    Contributor

    Hello from the bug scrub!

    @jyz0309 are you still willing to work on this? We'll happily assign this issue to you (or to others that want to help with it).

    Note that it requires an implementation of an OpenMetrics parsers in https://github.com/prometheus/common/tree/main/expfmt , so it's a bit of work and maybe not as easy as it looks.

  11. jyz0309 commented on Jun 26, 2024

    @jyz0309
    Contributor

    @beorn7 Yes, I am willing to try this issue, I think I need to implement an OpenMetrics parser and merge in expfmt firstly then use it to support openmetrics in promtool.

  12. assigned and unassigned on Jun 26, 2024
  13. jyz0309 commented on Jul 9, 2024

    @jyz0309
    Contributor

    @beorn7 Hello! I want to ask sth about the parser in expfmt, I am implementing the OpenMetrics parser in expfmt and I found that in client_model still have not support info, stateset types, should I add these to protobuf file first or just unsupported these two type firstly (I found that the encoder also unsupported these type yet)?

  14. beorn7 commented on Jul 9, 2024

    @beorn7
    Contributor

    Yeah, good question.

    So the source of dissonance here is that the encoders and parsers in https://github.com/prometheus/common/tree/main/expfmt are all based on https://github.com/prometheus/client_model , which in turn represents the data model behind the classic Prometheus text format. (OpenMetrics in fact has its own protobuf spec here.)

    As the encoder is also just encoding from the classic Prometheus protobuf, let's do what you said above, i.e. implement a parser that supports everything we can easily put into the classic Prometheus protobuf. We can later decide if we want to convert info and stateset into other metrics (which is essentially what Prometheus itself is doing right now upon ingestion) or add support for it into the classic protobuf or port the whole shebang to the OpenMetrics protobuf (which isn't that different after all).

  15. jyz0309 commented on Jul 22, 2024

    @jyz0309
    Contributor

    prometheus/common#669
    @beorn7 I have implement OpenMetrics parser in expfmt in this PR, PTAL, thanks :)

  16. added a commit that references this issue on May 3, 2026
  17. martincostello commented on May 3, 2026

    @martincostello

    I discovered I had a need for this while working on stabilising the OpenTelemetry .NET SDK's Prometheus exporter.

    I've picked up the prior attempt and opened prometheus/common#904 based on it.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions