opentelemetry-swift icon indicating copy to clipboard operation
opentelemetry-swift copied to clipboard

Prometheus Exporter using Push Gateway

Open Sherlouk opened this issue 4 years ago • 8 comments

Hi there 👋

I was just wondering if it was currently possible to use Prometheus (or any other Meter/Metric exporter, though I believe there's only Prom for now...) with some sort of push engine? From what I can see it only really works with PrometheusExporterHttpServer with no option to push at this time?

The context for this is I'm investigating using OpenTelemetry as part of an iOS application which cannot, obviously, spin up its own HTTP server for Prometheus to scrape. We might want to consider using a PushGateway to retrieve these metered metrics.

Side note: I've not yet tested it (admittedly), but I'm assuming the collectorAddress on the Jaeger exporter would work fine with a remote collector hosted on GCP/Heroku/etc? (The only examples in the repository are using localhost, so apologies if this comes across as a dumb question!)

Thanks in advance 😄

Sherlouk avatar Dec 27 '20 11:12 Sherlouk

Hi 👋, As you said, currently only Prometheus is supported for metrics exporting, and I think it must always work scraping the data (I am not an expert in Prometheus though). It is in my plans to work on exporting metrics to Datadog in the short/medium term, but currently no plans for any other metrics exporter (at least from my side, but I offer all my help to anyone interested).

About the Jaeger exporter, yes, it should work with any remote collector, report it as a bug if you have any problem. The reason for the examples using localhost is only for development and testing purposes, not a limitation of the implementation.

Please keep us informed of the your usage and issues, we are trying to validate the current api/implementation.

nachoBonafonte avatar Dec 28 '20 11:12 nachoBonafonte

Thanks for that Ignacio, I'll keep trucking ahead with the Jaeger stuff 👍

It is possible to push data to Prometheus, it's just not what I would call the "recommended" approach and if you can scrape you most certainly should. In our case, being a mobile app, that's simply not possible though!

Here's some more information about the PushGateway though, if you're unfamiliar: https://github.com/prometheus/pushgateway

At it's core though, at an undetermined frequency we would need to make a POST/PUT request to a user-defined endpoint with the same Prometheus metrics payload the exporter already creates.

Will be sure to keep you posted on highlights/lowlights as I tumble through all of this -- is GitHub the best place to raise this on? I will say there is one missing requirement (might be a bit niche to our usage) which might, unfortunately, mean we have to duplicate and write our own exporters but I'll see what I can do there 👀

Sherlouk avatar Dec 28 '20 11:12 Sherlouk

Yes, you can raise this on Github, currently there is not any swift specific channel, there is a general opentelemetry channel in gitter though, but for more general opentelemetry info.

Depending on the changes, we can think and discuss about adapting the current exporters or adding some generic way of supporting your needs.

nachoBonafonte avatar Dec 28 '20 11:12 nachoBonafonte

I will say on the niche requirement we have, I found a simple workaround which simply involved wrapping the exporter in my own exporter (much like the MultiSpanExporter example you provide) - this allows me to use the full capability of the exporters you provide, while interjecting my own functionality. Happy days!

On the subject of the PushGateway capability - is this a requirement/feature request that you would be willing to add support for (maybe even take a PR for)? 🙏

Sherlouk avatar Dec 28 '20 18:12 Sherlouk

For the PushGateway (or any other development you think is useful/interesting), of course the project would accept PR's.

nachoBonafonte avatar Dec 28 '20 20:12 nachoBonafonte

Vinod Vydier is gonna take this

nachoBonafonte avatar Apr 15 '21 16:04 nachoBonafonte

@nachoBonafonte I can take this one up, Thanks!

vvydier avatar Apr 15 '21 16:04 vvydier

This issue is unassigned now

nachoBonafonte avatar May 06 '21 16:05 nachoBonafonte