aboutsummaryrefslogtreecommitdiffstats
path: root/util/openmetrics.lua
Commit message (Collapse)AuthorAgeFilesLines
* util.openmetrics: Set __name field on metatables to improve error messagesKim Alvefur2022-05-301-0/+3
| | | | Don't think we cause any such errors right now, but you never know!
* util.openmetrics: Set (previously unused, empty) metatableKim Alvefur2022-05-301-2/+2
| | | | Silences luacheck warning about the metatable being unused.
* Spelling: Fix various spelling mistakes (thanks timeless)Kim Alvefur2022-03-071-1/+1
| | | | | | Words, sometimes I wonder how they even work Maybe I missed something.
* mod_http_openmetrics: Imported from prosody-modules mod_prometheus @df2246b15075Matthew Wild2021-11-241-0/+79
| | | | | | | | | This version has several changes from the earlier mod_prometheus: - Conversion of metrics into the text-based OpenMetrics format is moved to util.openmetrics - Support for IP-based access control - Compatibility with earlier Prosody versions removed
* util.openmetrics: Use pack from util.table, detect appropriate unpack for ↵Matthew Wild2021-06-141-4/+5
| | | | Lua 5.1 (thanks sups)
* util.openmetrics: Prettify format of histogram bucketsKim Alvefur2021-06-081-1/+1
| | | | | | | | | "%g" turns 1GB into 1.07374e+09, which is a bit awkward for the bytes measurements IMO. Turning up the precision, at "%.17g" turns 0.1 into 0.10000000000000001 while "%0.16" gives 0.1, hiding most of those pesky floating point artefacts. Lua version 5.2 uses "%.14g" ( see LUA_NUMBER_FMT in luaconf.h.html ) so it seems like a sensible choice here.
* Statistics: Rewrite statistics backends to use OpenMetricsJonas Schäfer2021-04-181-0/+308
The metric subsystem of Prosody has had some shortcomings from the perspective of the current state-of-the-art in metric observability. The OpenMetrics standard [0] is a formalization of the data model (and serialization format) of the well-known and widely-used Prometheus [1] software stack. The previous stats subsystem of Prosody did not map well to that format (see e.g. [2] and [3]); the key reason is that it was trying to do too much math on its own ([2]) while lacking first-class support for "families" of metrics ([3]) and structured metric metadata (despite the `extra` argument to metrics, there was no standard way of representing common things like "tags" or "labels"). Even though OpenMetrics has grown from the Prometheus world of monitoring, it maps well to other popular monitoring stacks such as: - InfluxDB (labels can be mapped to tags and fields as necessary) - Carbon/Graphite (labels can be attached to the metric name with dot-separation) - StatsD (see graphite when assuming that graphite is used as backend, which is the default) The util.statsd module has been ported to use the OpenMetrics model as a proof of concept. An implementation which exposes the util.statistics backend data as Prometheus metrics is ready for publishing in prosody-modules (most likely as mod_openmetrics_prometheus to avoid breaking existing 0.11 deployments). At the same time, the previous measure()-based API had one major advantage: It is really simple and easy to use without requiring lots of knowledge about OpenMetrics or similar concepts. For that reason as well as compatibility with existing code, it is preserved and may even be extended in the future. However, code relying on the `stats-updated` event as well as `get_stats` from `statsmanager` will break because the data model has changed completely; in case of `stats-updated`, the code will simply not run (as the event was renamed in order to avoid conflicts); the `get_stats` function has been removed completely (so it will cause a traceback when it is attempted to be used). Note that the measure_*_event methods have been removed from the module API. I was unable to find any uses or documentation and thus deemed they should not be ported. Re-implementation is possible when necessary. [0]: https://openmetrics.io/ [1]: https://prometheus.io/ [2]: #959 [3]: #960