-
(Sorry, @beorn7, I already asked you for help in Discourse, and didn't see that we could also discuss my question here). I run fluent-bit with a plugin to export metrics to Prometheus. I found the following issue when running multiple instances of it: https://github.com/neiman-marcus/fluent-bit-out-prometheus-metrics/issues/4 Tried to solve this problem by explicitly adding a Grouping instruction here like @@ -620,7 +621,8 @@ func FLBPluginInit(plugin unsafe.Pointer) int {
}
// Initialize new metric with push gateway
- pCtx.Pusher = push.New(pCtx.URL, pCtx.Job).Gatherer(registry)
+ pCtx.Pusher = push.New(pCtx.URL, pCtx.Job).Grouping("instance", pCtx.ConstantLabels["instance"]).Gatherer(registry) In this case I get errors from the library:
I have drilled down the problem to the following line in Prometheus golang client library: https://github.com/prometheus/client_golang/blob/main/prometheus/push/push.go#L255 Is this a bug or a feature? I would think that the label should be allowed in both the grouping path as well as in the payload. The only test which makes sense to me is to check for equality of the value instead of the label name? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yeah, too many discussion forums for Prometheus… (told everyone so… ;) The behavior is deliberate. At least it is documented as such: https://pkg.go.dev/github.com/prometheus/client_golang/prometheus/push#Pusher.Grouping The basic idea is that grouping labels are akin to target labels and therefore should not collide with the metric’s own labels. I guess if the label value is the same, there is not really any harm done, it’s just a bit weird. Can you perhaps just not set that label on the metric itself? |
Beta Was this translation helpful? Give feedback.
Yeah, too many discussion forums for Prometheus… (told everyone so… ;)
The behavior is deliberate. At least it is documented as such: https://pkg.go.dev/github.com/prometheus/client_golang/prometheus/push#Pusher.Grouping
The basic idea is that grouping labels are akin to target labels and therefore should not collide with the metric’s own labels. I guess if the label value is the same, there is not really any harm done, it’s just a bit weird.
Can you perhaps just not set that label on the metric itself?