I created a C++ client library at https://github.com/jupp0r/prometheus-cpp
It's mostly functional (although missing summary metrics for now) and I'd like to invite everybody to try it out, give me feedback and contribute.
Some highlights:
- uses modern C++ everywhere
- batteries included (embedded lightweight http server)
- full unit and integration test suite
- designed in a way that makes it easy to bring your own http stack, etc
Thanks and let me know what you think,
Jupp
Hi,
I created a C++ client library at https://github.com/jupp0r/prometheus-cpp
It's mostly functional (although missing summary metrics for now) and I'd like to invite everybody to try it out, give me feedback and contribute.
Some highlights:
- uses modern C++ everywhere
- batteries included (embedded lightweight http server)
- full unit and integration test suite
- designed in a way that makes it easy to bring your own http stack, etc
Thanks and let me know what you think,
Jupp
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsub...@googlegroups.com.
To post to this group, send email to prometheus-developers@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/86166cf9-4cd8-4d0e-bb4e-6e6460a69709%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hey Brian,
thanks for taking the time to give feedback.
I'll address your points in the next weeks. While I agree with you mostly, I'd like to discuss some points in more detail.
> On 19 Oct 2016, at 00:53, Brian Brazil <brian.brazil@robustperception.io> wrote:
> - Allowing labels to be set across all exposed metrics
I was under the impression that this is required:
A client library MUST allow for optionally specifying a list of label names at Gauge/Counter/Summary/Histogram creation time.
Are you referring to the constant labels optionally being added by registries?
> - registries being added to the exposition, rather than exposition using one registry (that'd make the exposer a 2nd type of registry)
I have a specific use case where an exposer has to scrape multiple registries (each originating from a component contained in a different library) and also each registry is scraped by different exposers (http and dumping metrics to log files). This seems to be a reasonable requirement and not very well modeled by the one registry to one exposition mapping you describe above.
> - Default histogram buckets not matching other clients
There are no defaults, the API forces you to specify them.
> - Supporting json, it's long deprecated
I don't see anything wrong with offering additional formats to the specified ones, what's your rationale for discouraging client libraries to do this?
> - Does not expose the Prometheus text format
Although preferable (and planned), this is not required by the spec:
Clients MUST implement one of the documented exposition formats.
Clients MAY implement more than one format. There SHOULD be a human readable format offered.
The library implements the protobuf format for actual scrapes, the current human readable format is provided by protobufs DebugString() output. This complies with the MUST and SHOULD, but not the MAY requirements.
> I'd suggest looking at the Java client for inspiration of how to lay things out.
I did, although I found the Go library to be closer to my use case.
Thanks again for your feedback,
Jupp
On 25 October 2016 at 21:39, Brian Brazil
<brian.brazil@robustperception.io> wrote:
>> > - registries being added to the exposition, rather than exposition using
>> > one registry (that'd make the exposer a 2nd type of registry)
>> I have a specific use case where an exposer has to scrape multiple
>> registries (each originating from a component contained in a different
>> library) and also each registry is scraped by different exposers (http and
>> dumping metrics to log files). This seems to be a reasonable requirement and
>> not very well modeled by the one registry to one exposition mapping you
>> describe above.
>
> This is the first time I've come across a requirement like this, all
> libraries are meant to share the one default registry.
Multiple registries were a long time requirement for the Go client –
and finally made it into v0.8 of the Go client. The main use case is
exposing different metrics at different endpoints, the most concrete
need for which showed up in Kubernetes instrumentation.
Jupp, you can check out how it was solved in the current Go client:
The registry implements to different interfaces, the Registerer and
the Gatherer. The former is for the registration, the latter for
handing over the gathered metrics to some kind of exposition mechanism
(an HTTP endpoint, or to a Graphite bridge, or for testing, or – as
you said – for dumping into a logfile). There is also a way to merge
different Gatherers into one Gatherer, which in turn doesn't implement
the Registerer parts. Not sure how directly this can translate into
C++, but it might serve as an inspiration.
the client library gives a good example for counter. Where can I get a similar simple-yet-working example for simple histograms. Can anyone help here..
Vick
Mr Jupp:
I am considering using it. Its organiztion is quite good. I was able to use it in minutes using your awesome simple counters example.
However struggling for hours to use histograms. I am able to BuildHistogram but how to specify buckets width and count ??? .Add() seems not working for me on the Built Histo family. can u please help here? finally I think .observe(value) will complete my program.
- Vicky
Can anyone help here?
Vick