rabbitmq / rabbitmq-prometheus

A minimalistic Prometheus exporter of core RabbitMQ metrics
Other
147 stars 110 forks source link

Expose metric for number of publishers when metrics are aggregated #30

Closed gerhard closed 3 years ago

gerhard commented 4 years ago

Since #28 we aggregate metrics by default, which means that we can no longer use the rabbitmq_channel_messages_published_total metric to count the number of publishers.

This is the metrics that we are returning when aggregating - we cannot count all publishers, the total count is 3, one per node:

image

This is what we return when metrics are enabled per object - we can correctly count 10 publishers:

image

We don't have the same problem with consumers as every node emits the rabbitmq_channel_consumers metric. @dcorbacho would it make sense to have a similar metric for publishing channels?

dcorbacho commented 4 years ago

@gerhard That's the number of published messages, not the number of publishers

gerhard commented 4 years ago

The number of published messages is per channel, and the count of these channels is the number of publishers. There is no other metric that we emit which can be used to work out the number of publishers as far as I know.

The indirect method, i.e. count(rabbitmq_channel_messages_published_total), works when metrics are exposed per object, but it stops working when metrics are aggregated.

Should we expose a new metric for publishers that would work in both cases?

michaelklishin commented 4 years ago

We never provided the number of publishers as a metric. What is a publisher? A publishing channel? If I have 100 of those on a connection, does it mean I have 100 publishers or just 1?

The number of connections that performed a publish in a given time window is the closest thing there is.

gerhard commented 4 years ago

I did add the number of publishers on the RabbitMQ-Overview Dashboard because it was a useful metric to have, right above consumers:

image

Are you saying that we shouldn't support this metric when metrics are aggregated?

michaelklishin commented 4 years ago

This is a metric derived from another one (published messages), so if when aggregated we can no longer derive it, it should be dropped. Maybe a new core metric would be introduced at some point to replace it, I don't see much interest in having the number of publishers. Unlike with consumers, which can take their sweet time processing deliveries, it is usually dead obvious if you don't have any publishers online from the global publishing rate. With consumers a zero rate of deliveries does not mean that there are no consumers online, for example.

Consumers is a specific concept in messaging protocols. A single consumer is a single consumer registered, not a single consuming. channel.

gerhard commented 4 years ago

OK, we are agreeing to drop the Publishers metric from the RabbitMQ-Overview dashboard as we cannot hide it conditionally.

We are currently using sum(rabbitmq_channel_consumers) to represent the number of consumers. If you are saying that this is good enough & worth keeping, what metric should we display in lieu of Publishers which we will no longer have?

Alternatively, if we are agreeing to drop consumers as well, this is a solved issue.

michaelklishin commented 4 years ago

I'd need to see how rabbitmq_channel_consumers is computed but it can and likely does represent the number of what most folks would call consumers. With publishers it's would be an opinionated judgement call.

gerhard commented 3 years ago

This was solved by https://github.com/rabbitmq/rabbitmq-prometheus/pull/61