Skip to content

Avoid duplicate vhost label for Prometheus queue-exchange metrics #12364

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

Conversation

LoisSotoLopez
Copy link
Contributor

Proposed Changes

Addresses #12347

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}).

Types of Changes

  • Bug fix (non-breaking change which fixes issue #NNNN)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause an observable behavior change in existing systems)
  • Documentation improvements (corrections, new content, etc)
  • Cosmetic change (whitespace, formatting, etc)
  • Build system and/or CI

Checklist

Further Comments

.

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}`)
@LoisSotoLopez
Copy link
Contributor Author

If provided implementation (supporting {Queue, Exchange}) looks good enough I could add a clause for when the Queue and Exchange are in reverse order ({Exchange, Queue}).

label({
    #resource{kind=exchange, name=ExName}
    #resource{kind=queue, virtual_host=VHost, name=QName},
 }) ->
    <<"vhost=\"", (escape_label_value(VHost))/binary, "\",",
      "exchange=\"", (escape_label_value(ExName))/binary, "\",",
      "queue=\"", (escape_label_value(QName))/binary, "\"">>;

@michaelklishin
Copy link
Collaborator

@LoisSotoLopez please do.

@michaelklishin
Copy link
Collaborator

This does address #12347. Once another function head is added, I will submit this branch so that Actions can run with access to secrets.

@LoisSotoLopez
Copy link
Contributor Author

Preferred to add a comment similar to the one in

%% channel_queue_exchange_metrics {channel_id, {queue_id, exchange_id}}
, instead of adding unreachable code.

@michaelklishin michaelklishin merged commit 8377eda into rabbitmq:main Sep 25, 2024
128 of 131 checks passed
@michaelklishin
Copy link
Collaborator

@LoisSotoLopez thank you for contributing this.

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

Successfully merging this pull request may close these issues.

2 participants