siimon / prom-client

Prometheus client for node.js
Apache License 2.0
3.15k stars 376 forks source link

Support for aggregation-gateway #319

Open gavinhenderson opened 4 years ago

gavinhenderson commented 4 years ago

Hey 👋 , thanks for an excellent library.

We are trying to use an aggregation-gateway in order to collect build times of devs.

The aggregation gateway expects all metrics to be pushed to /api/ui/metrics but pushing to this URL doesn't seem possible with prom-client as it seems to always append /metrics/job/{jobName} to the URL.

For our use case it would be ideal if we could override the full URL that is used to push metrics to. Is this something that could be implemented within prom-client? Happy to open a PR if it is

martin-magakian commented 4 years ago

Hi @gavinhenderson, I agree, it could be nice to configure the endpoint to push your metrics to.

But in your case, I feel like it should be the other way around. Why "aggregation-gateway" endpoint is /api/ui/metrics instead of /metrics/*? If "aggregation-gateway" accept pushes on endpoint /metrics/* you could use any Prometheus client (not only prom-client) without any update on the client side.

This is exactly what my push request is about (I encourage you up vote): https://github.com/weaveworks/prom-aggregation-gateway/pull/31

As the current push request isn't accepted yet, you can use https://github.com/keymantics/prom-aggregation-gateway/tree/master_keymantics. It implement few other fixes

gavinhenderson commented 4 years ago

Oh didnt see your issue on the aggregation-gateway repo.

For now my solution was to bring the 'Pushgateway' class into my code and modify it so it doesn't append to the URL.