-
Notifications
You must be signed in to change notification settings - Fork 477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
the same metric with different labels override each other #65
Comments
That's by design. If the grouping key and the name of the metric is the same, then metrics are always replaced, regardless if you use POST and PUT. POST will not replace metrics with a different |
"If the grouping key and the name of the metric is the same..." What grouping key ? Can I push same metric name different labels on one instance of pushgateway with different jobs,so that they don't override each other? |
You can as long as the grouping key is different.
…On Mon, Mar 20, 2017, 01:41 Radu Toader ***@***.***> wrote:
"If the grouping key and the name of the metric is the same..." What
grouping key ?
Can I push same metric name different labels on one instance of
pushgateway with different jobs,so that they don't override each other?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#65 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF7u5GjVc8Czs0ByP_cqMhd8XO3DRp0-ks5rnhGJgaJpZM4Gl7mH>
.
|
And what is the grouping key. What fields are in this grouping key? |
The README.md on https://github.com/prometheus/pushgateway explains the grouping key (just search for "grouping key" on that page to find all the occurrences). In general, it makes more sense to ask questions like this on the prometheus-users mailinglist rather than in a GitHub issue. |
This still feels like a bug or at least a design flaw to me. Say for instance, you have an ephemeral job like an AWS Lambda function processing files uploaded to an S3 bucket. There is no meaningful grouping key for this setup. It looks like you would have to stick a StatsD server in front of your push gateway in order to get meaningful service-level metrics. After discussing with some other folks, I feel like a push gateway really only serves one use case: I can't scrape my endpoints due to my network architecture or other security concerns. Even then, PGs do not appear to properly handle counters, and, by derivative, histograms or summaries at all. They only support gauges, and only with "last-write-wins" aggregation. If you want to generate metrics for ephemeral jobs, if possible, it seems like you would be much better off running an exporter daemon host on each machine running the jobs, and have the jobs push metrics updates to these exporters on each run. Then prometheus could scrape the job endpoints as normal. The above limitation has an unfortunate consequence that you are forced to essentially have an "instance" dimension to all your metrics, even if this dimension isn't useful or meaningful to you, resulting in major and unnecessary timeseries bloat. I again can't see any way to work around this other than through using a separate aggregator like StatsD. |
Something statsd-like is one of the appropriate ways to deal with Lambda-like things. The pushgateway does not do temporal aggregation. |
For others looking, you can work around the last-write-wins semantic by using your labels as the grouping key. That took a while to figure out, and I'm not 100% sure if there's any consequence to doing it this way. In my case I'm using the Java client. I used the |
This is a bad design |
I'd hate to comment on an old issue, but I must say the current design is not good. The PUT/POST behaviors are counter-intuitive to say the least. POST method should be associated with posting new/replacing. |
Even with unique labels? Does anyone know where this is documented, I haven't seen it mentioned and I'm facing this same issue. The fact that unique labels don't actually make it unique is very counter intuitive. |
does anybody know how to work it around? For instance, how to use approach of @alexklibisz but using plain POST request |
I know it's an old thread that I opened up long time a go, but just in case someone need counter&histogram support for push gateway - you can try using the aggregation push gateway: https://github.com/zapier/prom-aggregation-gateway |
### Description - My changes in #3491 / #3492 were kind of accurate - according to prometheus/pushgateway#65 even using pushAdd will displace existing metrics. It's all very confusing! - I tested this with a script that pushed some test metrics to the push gateway - basically by having the key funder use a different job name than the mainnet2 one, the metrics each of them push won't conflict with one another ### Drive-by changes <!-- Are there any minor or drive-by changes also included? --> ### Related issues <!-- - Fixes #[issue number here] --> ### Backward compatibility <!-- Are these changes backward compatible? Are there any infrastructure implications, e.g. changes that would prohibit deploying older commits using this infra tooling? Yes/No --> ### Testing <!-- What kind of testing have these changes undergone? None/Manual/Unit Tests -->
### Description - My changes in #3491 / #3492 were kind of accurate - according to prometheus/pushgateway#65 even using pushAdd will displace existing metrics. It's all very confusing! - I tested this with a script that pushed some test metrics to the push gateway - basically by having the key funder use a different job name than the mainnet2 one, the metrics each of them push won't conflict with one another ### Drive-by changes <!-- Are there any minor or drive-by changes also included? --> ### Related issues <!-- - Fixes #[issue number here] --> ### Backward compatibility <!-- Are these changes backward compatible? Are there any infrastructure implications, e.g. changes that would prohibit deploying older commits using this infra tooling? Yes/No --> ### Testing <!-- What kind of testing have these changes undergone? None/Manual/Unit Tests -->
### Description - My changes in hyperlane-xyz#3491 / hyperlane-xyz#3492 were kind of accurate - according to prometheus/pushgateway#65 even using pushAdd will displace existing metrics. It's all very confusing! - I tested this with a script that pushed some test metrics to the push gateway - basically by having the key funder use a different job name than the mainnet2 one, the metrics each of them push won't conflict with one another ### Drive-by changes <!-- Are there any minor or drive-by changes also included? --> ### Related issues <!-- - Fixes #[issue number here] --> ### Backward compatibility <!-- Are these changes backward compatible? Are there any infrastructure implications, e.g. changes that would prohibit deploying older commits using this infra tooling? Yes/No --> ### Testing <!-- What kind of testing have these changes undergone? None/Manual/Unit Tests -->
The gauge issue and having to restart prom-aggregation-gateway to delete stale metrics was a no go for our use case. That's why I created the Metrics Accumulator https://github.com/bpoole6/metrics-accumulator The Metrics Accumulator doesn't add gauge values together, it instead takes the latest value pushed for a gauge (There is some customization here). It also has a TTL for your metrics. |
So, If I try to send to the same push gateway the same metric but with different values in the labels they override each other using post(and put) - it seems that it replaces the metric no matter if replace is set to false or true.
The text was updated successfully, but these errors were encountered: