rabbitmq-server/deps/rabbitmq_prometheus
Michael Klishin 61dcfd5fa6
Use the standard 'undefined' here
2025-06-04 12:31:27 +04:00
..
docker [skip ci] Update dashboards for RabbitMQ 4.1 2025-04-16 17:48:21 +02:00
priv/schema Bump (c) line year 2025-01-01 17:54:10 -05:00
src Use the standard 'undefined' here 2025-06-04 12:31:27 +04:00
test RMQ-1460: Emit queue_info metric (#13583) 2025-03-27 15:54:26 +01:00
.autocomplete Add hidden file to quickly activate shell autocompletion 2019-10-04 21:56:22 +01:00
.gitignore Cleanup .gitignore files for the monorepo 2024-06-28 12:00:52 +02:00
CODE_OF_CONDUCT.md Replace files with symlinks 2022-04-15 06:04:29 -07:00
CONTRIBUTING.md Replace files with symlinks 2022-04-15 06:04:29 -07:00
LICENSE Replace @rabbitmq.com addresses with rabbitmq-core@groups.vmware.com 2023-06-20 15:40:13 +04:00
LICENSE-MPL-RabbitMQ Revert drop of Exhibit B on MPL 2.0 2020-07-20 17:02:50 +01:00
Makefile Use Erlang.mk's native Elixir support for CLI 2025-03-18 10:02:49 +01:00
README.md More missed license header updates #9969 2024-02-05 12:26:25 -05:00
metrics-detailed.md Wording 2023-01-03 14:19:58 -05:00
metrics.md Remove sockets_used/sockets_total metrics from UIs 2024-06-24 12:07:51 +02:00
rabbitmq-disable-metrics-collector.conf Build Docker image with the latest management & management_agent 2019-04-22 17:47:22 +01:00

README.md

Build Grafana Dashboards

Prometheus Exporter of Core RabbitMQ Metrics

Getting Started

This is a Prometheus exporter of core RabbitMQ metrics, developed by the RabbitMQ core team. It is largely a "clean room" design that reuses some prior work from Prometheus exporters done by the community.

Project Maturity

This plugin is new as of RabbitMQ 3.8.0.

Documentation

See Monitoring RabbitMQ with Prometheus and Grafana.

Installation

This plugin is included into RabbitMQ 3.8.x releases. Like all plugins, it has to be enabled before it can be used:

To enable it with rabbitmq-plugins:

rabbitmq-plugins enable rabbitmq_prometheus

Usage

See the documentation guide.

Default port used by the plugin is 15692 and the endpoint path is at /metrics. To try it with curl:

curl -v -H "Accept:text/plain" "http://localhost:15692/metrics"

In most environments there would be no configuration necessary.

See the entire list of metrics exposed via the default port.

Configuration

This exporter supports the following options via a set of prometheus.* configuration keys:

Sample configuration snippet:

# these values are defaults
prometheus.return_per_object_metrics = false
prometheus.path = /metrics
prometheus.tcp.port =  15692

When metrics are returned per object, nodes with 80k queues have been measured to take 58 seconds to return 1.9 million metrics in a 98MB response payload. In order to not put unnecessary pressure on your metrics system, metrics are aggregated by default.

When debugging, it may be useful to return metrics per object (unaggregated).

This can be done by scraping the /metrics/per-object endpoint:

curl -v -H "Accept:text/plain" "http://localhost:15692/metrics/per-object"

This can also be enabled as the default behavior of the /metrics endpoint on-the-fly, without restarting or configuring RabbitMQ, using the following command:

rabbitmqctl eval 'application:set_env(rabbitmq_prometheus, return_per_object_metrics, true).'

To go back to aggregated metrics on-the-fly, run the following command:

rabbitmqctl eval 'application:set_env(rabbitmq_prometheus, return_per_object_metrics, false).'

Selective querying of per-object metrics

As mentioned in the previous section, returning a lot of per-object metrics is quite computationally expensive process. One of the reasons is that /metrics/per-object returns every possible metric for every possible object - even if having them makes no sense in the day-to-day monitoring activity.

That's why there is an additional endpoint that always return per-object metrics and allows one to explicitly query only the things that are relevant - /metrics/detailed. By default it doesn't return anything at all, but it's possible to specify required metric groups and virtual host filters in the GET-parameters. Scraping /metrics/detailed?vhost=vhost-1&vhost=vhost-2&family=queue_coarse_metrics&family=queue_consumer_count. will only return requested metrics (and not, for example, channel metrics that include erlang PID in labels).

This endpoint supports the following parameters:

  • Zero or more family - only the requested metric families will be returned. The full list is documented in metrics-detailed.
  • Zero or more vhost - if it's given, queue related metrics (queue_coarse_metrics, queue_consumer_count and queue_metrics) will be returned only for given vhost(s).

The returned metrics use different prefix rabbitmq_detailed_ (instead of plain rabbitmq_ used by other endpoints), so that endpoint can be used simultaneously with /metrics, and existing dashboards won't be affected.

Here are the performance gains you can expect from using this endpoint. On a test system with 10k queues/10k consumer/10k producers, /metrics/per-object took a bit over 2 minutes. Querying /metrics/detailed?family=queue_coarse_metrics&family=queue_consumer_count provides just enough metrics to see how many messages sit in every queue and how much consumers each of these queues have. And it takes only 2 seconds, a significant improvement over indiscriminate /metrics/per-object.

Contributing

See CONTRIBUTING.md.

Makefile

This project uses erlang.mk, running make help will return erlang.mk help.

To see all custom targets that have been documented, run make h.

For Bash shell autocompletion, run eval "$(make autocomplete)", then type make a<TAB> to see all Make targets starting with the letter a, e.g.:

$ make a<TAB
ac               all.coverdata    app-build        apps             apps-eunit       asciidoc-guide   autocomplete
all              app              app-c_src        apps-ct          asciidoc         asciidoc-manual

(c) 2007-2024 Broadcom. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.