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

rabbitmq_queue_exchange_messages_published_total in /metrics/per-object has a duplicate vhost label #12347

Closed
Gama11 opened this issue Sep 19, 2024 · 8 comments
Labels
Milestone

Comments

@Gama11
Copy link

Gama11 commented Sep 19, 2024

Describe the bug

Prometheus seems to choke on duplicate labels:

image

Note how vhost appears twice here:

# TYPE rabbitmq_queue_exchange_messages_published_total counter
# HELP rabbitmq_queue_exchange_messages_published_total Total number of messages published into a queue through an exchange
rabbitmq_queue_exchange_messages_published_total{vhost="/",queue="<queue-name>",vhost="/",exchange="<exchange-name>"} 19

Versions used:

  • rabbitmq:4.0.0-management-alpine
  • prom/prometheus:v2.54.1

This seems to be a regression compared to 3.13.7 which we upgraded from.

Reproduction steps

  1. Enable the rabbitmq_prometheus plugin
  2. Send some messages to a queue so the rabbitmq_queue_exchange_messages_published_total metric is included
  3. Query the /metrics/per-object endpoint

Expected behavior

There should not be duplicate labels.

Additional context

No response

@Gama11 Gama11 added the bug label Sep 19, 2024
@Gama11
Copy link
Author

Gama11 commented Sep 19, 2024

Possibly relevant, our rabbitmq.config:

[
  {
    rabbit,
      [
        { loopback_users, [] }
      ]
  },
  {
    rabbitmq_management,
      [
        { load_definitions, "/etc/rabbitmq/definitions.json" }
      ]
  }
].

definitions.json:

{
  "users": [
    {
      "name": "test",
      "password_hash": "<redacted>",
      "hashing_algorithm": "rabbit_password_hashing_sha256",
      "tags": "administrator,monitoring"
    }
  ],
  "vhosts": [
    {
      "name": "/"
    }
  ],
  "permissions": [
    {
      "user": "test",
      "vhost": "/",
      "configure": ".*",
      "write": ".*",
      "read": ".*"
    }
  ],
  "topic_permissions": [],
  "parameters": [],
  "global_parameters": [],
  "policies": [],
  "queues": [],
  "exchanges": [],
  "bindings": []
}

@michaelklishin
Copy link
Member

Thank you. This looks like a blank node's config with a pre-configured user for remote access.

I was able to reproduce with a blank node from main:

# HELP rabbitmq_queue_exchange_messages_published_total Total number of messages published into a queue through an exchange
rabbitmq_queue_exchange_messages_published_total{vhost="/",queue="qq.1",vhost="/",exchange=""} 100000

@gomoripeti
Copy link
Contributor

I think this is related to #11559
the first vhost belongs to the queue, the second to the exchange but obviously they are the same so need to special handle this new case to eliminate the redundancy

@Gama11
Copy link
Author

Gama11 commented Sep 20, 2024

I noticed that rabbitmq_queue_messages_published_total has two labels called exchange_vhost and queue_vhost (or at least it did in 3.13.7).

@pschichtel
Copy link

is there ever a case where a queue's vhost and the exchange's vhost would be different?

@michaelklishin
Copy link
Member

@pschichtel no, by definition, entities in different virtual hosts cannot be bound together.

@michaelklishin
Copy link
Member

The labels may simply reflect the fact that there are two associated entities with certain metric samples, and they both belong to a virtual host. Ideally it should be just vhost, virtual_host, or whatever is the label we use for other metrics.

@michaelklishin
Copy link
Member

A fix was contributed by @LoisSotoLopez in #12364, merged in #12373 and (will be) backported in #12378.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants