view mod_prometheus/README.markdown @ 4738:5aee8d86629a

mod_bookmarks2: Fix handling of nick and password elements This form of child retrieval fails when the stanza elements internally don't have an 'xmlns' attribute, which can happen sometimes for some reason, including when they have been constructed via the stanza builder API. When that is the case then the explicit namespace arguemnt does not match the nil value of the internal attribute. Calling `:get_child()` without the namespace argument does the right thing here, with both nil and the parent namespace as valid values for the internal attribute.
author Kim Alvefur <zash@zash.se>
date Wed, 03 Nov 2021 21:11:55 +0100
parents f4ab80f72d63
children bb66e87a3604
line wrap: on
line source

---
labels:
- Statistics
summary: Implementation of the Prometheus protocol
...

Description
===========

This module implements the Prometheus reporting protocol, allowing you
to collect statistics directly from Prosody into Prometheus.

See the [Prometheus documentation][prometheusconf] on the format for
more information.

[prometheusconf]: https://prometheus.io/docs/instrumenting/exposition_formats/

Configuration
=============

mod\_prometheus itself doesn’t have any configuration option, but it
requires Prosody’s [internal statistics
provider](https://prosody.im/doc/statistics#built-in_providers) to be
enabled.  You may also want to change the default collection interval
to the one your statistics consumer is using. See below for more information.

```lua
statistics = "internal"
statistics_interval = 15 -- in seconds
```

::: {.alert .alert-warning}
**NOTE:** Make sure to put the statistics variables in the global section of
the configuration, **not** in a `VirtualHost` or `Component` section.  You can
use `prosodyctl check` if you are unsure and want to check your configuration.
:::

See also the documentation of Prosody’s [HTTP
server](https://prosody.im/doc/http), since Prometheus is an HTTP
protocol that is how you can customise its URL.  The default one being
http://localhost:5280/metrics

Scrape interval vs statistics_interval
--------------------------------------

The `statistics_interval` should be set to `"manual"` on trunk if and only
if you have a single Prometheus instance scraping Prosody. This will allow
the internal statistics gathering to run optimally.

If you have multiple instances scraping Prosody, set `statistics_interval`
to the scrape interval of Prometheus to avoid errors in rate calculations
and similar.

Future work will allow the use of `"manual"` with multiple Prometheus
instances and varying scrape intervals (stay tuned).

Compatibility
=============

  ------- -------------
  trunk   Works
  0.11    Works
  0.10    Works
  0.9     Does not work
  ------- -------------