Skip to content
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

Prevent duplicate vhost label on queue exchange metrics (backport #12373) #12376

Closed
wants to merge 3 commits into from

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Sep 25, 2024

This is #12364 by @LoisSotoLopez, rebased on top of main.


This is an automatic backport of pull request #12373 done by Mergify.

LoisSotoLopez and others added 3 commits September 25, 2024 14:01
Adds a specific clause on the
`prometheus_rabbitmq_core_metrics_collector:labels` function when the
associated metric item is a Queue + Exchange combo (`{Queue, Exchange}`)

(cherry picked from commit 79f04c2)
* Add global histogram metrics for received message sizes per-protocol

fixup: add new files to bazel

fixup: expose message_size_bytes as prometheus classic histogram type

`rabbit_msg_size_metrics` does not use `seshat` any more, but
`counters` directly.

fixup: add msg_size_metrics unit test

* Improve message size histogram

1.
Avoid unnecessary time series emitted for stream protocol
The stream protocol cannot observe message sizes.
This commit ensures that the following time series are omitted:
```
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="64"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="256"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="1024"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="4096"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="16384"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="65536"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="262144"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="1048576"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="4194304"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="16777216"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="67108864"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="268435456"} 0
rabbitmq_global_message_size_bytes_bucket{protocol="stream",le="+Inf"} 0
rabbitmq_global_message_size_bytes_count{protocol="stream"} 0
rabbitmq_global_message_size_bytes_sum{protocol="stream"} 0
```

This reduces the number of time series by 15.

2.
Further reduce the number of time series by reducing the number of
buckets. Instead of 13 bucktes, emit only 9 buckets. Buckets are not
free, each is an extra time series stored.

Prior to this commit:
```
curl -s -u guest:guest localhost:15692/metrics | ag message_size | wc -l
      92
```

After this commit:
```
curl -s -u guest:guest localhost:15692/metrics | ag message_size | wc -l
      57
```

3.
The emitted metric should be called
`rabbitmq_message_size_bytes_bucket` instead of `rabbitmq_global_message_size_bytes_bucket`.
The latter is poor naming. There is no need to use `global` in
the metric name given that this metric doesn't exist in the old flawed
aggregated metrics.

4.
This commit simplies module `rabbit_global_counters`.

5.
Avoid garbage collecting the 10-elements list of buckets per message
being received.

---------

Co-authored-by: Péter Gömöri <peter@84codes.com>
(cherry picked from commit 1e3f4e5)

# Conflicts:
#	deps/rabbit/app.bzl
Copy link
Author

mergify bot commented Sep 25, 2024

Cherry-pick of 1e3f4e5 has failed:

On branch mergify/bp/v4.0.x/pr-12373
Your branch is ahead of 'origin/v4.0.x' by 2 commits.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit 1e3f4e5db9.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   deps/rabbit/BUILD.bazel
	modified:   deps/rabbit/src/rabbit_amqp_session.erl
	modified:   deps/rabbit/src/rabbit_channel.erl
	modified:   deps/rabbit/src/rabbit_global_counters.erl
	new file:   deps/rabbit/src/rabbit_msg_size_metrics.erl
	new file:   deps/rabbit/test/msg_size_metrics_SUITE.erl
	new file:   deps/rabbit/test/unit_msg_size_metrics_SUITE.erl
	modified:   deps/rabbitmq_mqtt/src/rabbit_mqtt.erl
	modified:   deps/rabbitmq_mqtt/src/rabbit_mqtt_processor.erl
	modified:   deps/rabbitmq_mqtt/test/shared_SUITE.erl
	modified:   deps/rabbitmq_prometheus/app.bzl
	modified:   deps/rabbitmq_prometheus/src/collectors/prometheus_rabbitmq_global_metrics_collector.erl
	new file:   deps/rabbitmq_prometheus/src/collectors/prometheus_rabbitmq_message_size_metrics_collector.erl
	modified:   deps/rabbitmq_prometheus/src/rabbit_prometheus_dispatcher.erl
	modified:   deps/rabbitmq_prometheus/test/rabbit_prometheus_http_SUITE.erl
	modified:   moduleindex.yaml

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   deps/rabbit/app.bzl

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify bot added the bazel label Sep 25, 2024
@michaelklishin
Copy link
Member

Closing in favor of #12378.

@michaelklishin michaelklishin deleted the mergify/bp/v4.0.x/pr-12373 branch September 25, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants