Skip to content

Added metrics framework and implementation #910

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

hylkevds
Copy link
Collaborator

@hylkevds hylkevds commented May 28, 2025

  • enhancement

Release notes

[feature] Added metrics framework and Prometheus implementation.
- Enable by setting metrics_provider_class to MetricsProviderPrometheus.
- Metrics endpoint can be found on http://localhost:9400/metrics by default.
- port can be changed with metrics_endpoint_port. Set to 0 to disable http endpoint.

What does this PR do?

To gain insights into the state of running software, the software can expose metrics, which are then gathered by a metrics framework.
A popular framework for this is Prometheus, but there are others.
This PR adds the ability for Moquette to expose metrics for such system to gather, and provides an implementation for Prometheus specifically.

By default, metrics are not gathered, and the system is only a shim that has minimal impact on performance. The Proteus implementation is a separate project that can be added to the classpath if desired. This minimises the impact for users that do not require metrics and does not change any dependencies for those use-cases.

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files (and/or docker env variables)
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the Changelog if it's a feature or a fix that has to be reported

How to test this PR locally

  1. Start moquette with metrics_provider_class=MetricsProviderPrometheus
  2. navigate to http://localhost:9400/metrics

hylkevds added 5 commits June 7, 2025 12:24
For monitoring a system it is not really important how many items are in
a queue. The important metric is how full the queue is. That is, how many
items the queue has, relative to the maximum size of the queue.
@hylkevds hylkevds requested a review from andsel June 14, 2025 22:09
@andsel
Copy link
Collaborator

andsel commented Jun 17, 2025

Hi @hylkevds thanks for this. It will take some time to me for review, but I'll do, just little bit slow.

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.

2 participants