GithubHelp home page GithubHelp logo

Comments (7)

mxinden avatar mxinden commented on May 25, 2024

and are definitely not fully compatible with each other.

Can you expand in which way recent Prometheus versions are not compatible with the OpenMetrics specification?

Note that this has also been discussed in #66 (comment) and in #51. I don't understand why this requires a new GitHub issue.

from client_rust.

08d2 avatar 08d2 commented on May 25, 2024

Can you expand in which way recent Prometheus versions are not compatible with the OpenMetrics specification?

Consider a counter metric exported via curl <hostport>/metrics, and specifically maybe e.g. the mxinden/kademlia-exporter metric kademlia_exporter_meta_random_node_lookup_triggered. Running that program and then fetching the /metrics endpoint returns

# HELP kademlia_exporter_meta_random_node_lookup_triggered Number of times a random Kademlia node lookup was triggered.
# TYPE kademlia_exporter_meta_random_node_lookup_triggered counter
kademlia_exporter_meta_random_node_lookup_triggered_total 1

Note that the HELP and TYPE lines have metric name "kademlia_exporter_xxx" and that the actual metric data line has a metric name "kadmelia_exporter_xxx_total". This may be valid for OpenMetrics, but it is not valid for Prometheus. Prometheus requires consistent metric names, e.g.

# HELP kademlia_exporter_meta_random_node_lookup_triggered_total Number of times a random Kademlia node lookup was triggered.
# TYPE kademlia_exporter_meta_random_node_lookup_triggered_total counter
kademlia_exporter_meta_random_node_lookup_triggered_total 1

from client_rust.

08d2 avatar 08d2 commented on May 25, 2024

I don't understand why this requires a new GitHub issue.

Consider this issue a superset of the other issues. OpenMetrics and Prometheus define specs which are not equivalent. If this repo lives in the Prometheus org, it should implement the Prometheus spec. If it doesn't implement the Prometheus spec, then it shouldn't live in the Prometheus org. That's my only point.

from client_rust.

kalabukdima avatar kalabukdima commented on May 25, 2024

I was also trying to understand why the metrics exported by this crate can't be scraped by Prometheus.

In particular, the issue is with the Info metric that is not part of the default set and leads to the error invalid metric type "info" preventing all other metrics to be scraped too (tested with prometheus 2.51.2 and some other verions — none of them could deal with this format).

So I think it is confusing indeed that the official Prometheus client doesn't work with Prometheus. I can see the following possible solutions:

  • rename this crate to something like open-metrics-client or
  • add a possibility to export metrics in Prometheus format as done in Python client

Upd: after setting the correct header with the response, Prometheus could parse the output, but it's still confusing that those formats are not compatible and the naming doesn't suggest which one is used.

from client_rust.

mxinden avatar mxinden commented on May 25, 2024

@08d2 and @kalabukdima I understand your concerns.

@RichiH do you have additional input here as one of the authors of the open metrics specification? How should the Rust client proceed to be consistent within the Prometheus ecosystem.

In the meantime, @08d2 and @kalabukdima, how about very prominently calling out on the main docs.rs page (i.e. in src/lib.rs) that application/openmetrics-text needs to be set as a content type? Does either of you want to create a pull request?

from client_rust.

RichiH avatar RichiH commented on May 25, 2024

FYI, OpenMetrics is now part of Prometheus officially

I am on the road right now, but this feels like a bug in Prometheus. Potentially dev summit material to discuss?

from client_rust.

mxinden avatar mxinden commented on May 25, 2024

FYI, OpenMetrics is now part of Prometheus officially

Can you point us to some docs @RichiH? Is OpenMetrics the default? Is setting the HTTP content type still needed?

Related: #194 and prometheus/prometheus#13944

from client_rust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.