Commit Graph

269 Commits

Author SHA1 Message Date
Christoph Petrausch
9309470930 Merge pull request #154 from alfrunes/config-profiling-metrics
feat: Add configuration option to enable/disable profiling metrics
2024-12-26 13:04:31 +01:00
Alf-Rune Siqveland
95bbd81f7d feat: Add configuration option to enable/disable profiling metrics
Added a new configuration `enable_profiling_metrics` which
enable/disable the default runtime metrics exported by the Prometheus
client package.

BREAKING CHANGE: Changed default behavior to exclude runtime metrics.
        Enable with enable_profiling_metrics configuration option.
Signed-off-by: Alf-Rune Siqveland <alf.rune@siqveland.no>
2024-08-18 12:44:23 +02:00
Christoph Petrausch
0137ffc738 Merge pull request #143 from chrschn/expressions
Expressions
2024-05-19 20:18:38 +02:00
Christoph Petrausch
e1033ddf06 Merge pull request #145 from pdostal/shelly_ht
Add example for Shelly H&T sensor
2024-03-25 10:28:29 +01:00
Christoph Petrausch
e748c6f823 Merge pull request #147 from podorozhny/patch-1
fix typo
2024-03-25 10:28:16 +01:00
Christoph Petrausch
8a185ed151 Merge pull request #146 from hikhvar/renovate/golang-1.x
Update dependency golang to v1.22
2024-03-25 10:28:03 +01:00
Christoph Petrausch
5b7d22bea8 Merge pull request #144 from hikhvar/renovate/prom-prometheus-2.x
Update dependency prom/prometheus to v2.49.0
2024-03-25 10:27:51 +01:00
Christian Schneider
cd459836a6 Improved error reporting. 2024-03-25 10:15:05 +01:00
Christian Schneider
9f92116fe3 Support multiple configs per input metric.
When generating metric values using expression evaluation, there are new
use-cases for more than one configuration for each sensor value.
Expressions are more flexible than aggregation rules in Prometheus, so
it makes sense to derive multiple metrics from the same sensor input.
2024-03-25 10:15:05 +01:00
Christian Schneider
f380bea81d Support metrics from arithmetic expressions.
This change adds the new metric config option `expression` which can
define a complex expression to calculate the final metric value. The
expression is evaluated using github.com/antonmedv/expr as the engine,
see expr-lang.org/docs/v1.9/Language-Definition for a language overview.
In addition, some basic functions are available during evaluation: now,
int, float, round, ceil, floor, abs, min, max.

For each evaluation, the expression gets:
- the current MQTT value
- the last MQTT value
- the result of the last evaluation
- the elapsed time since the last evaluation

Expressions allow more flexibility to derive metrics from sensor inputs
which are very hard or even impossible to do in Prometheus, for example,
integrate continuous values over time, filter extreme or zero values, or
non-linear scaling. The last value, result, and timestamp are preserved
even between restarts of mqtt2prometheus. This means that expressions
can be used to produce continuous time series over a long time range.

To make upstream integration easier, the code depends on the rather old
v1.8.9 of github.com/antonmedv/expr, which is available in the main repo
of all supported Debian versions.
2024-03-25 10:15:05 +01:00
Christoph Petrausch
0191b7b263 Don't enable experimental docker features in release process v0.1.8-RC2 2024-03-25 05:49:10 +01:00
Christoph Petrausch
20da3216ef Bump go versions used in tests and builds 2024-03-25 05:41:08 +01:00
Christoph Petrausch
66d4028eff Merge pull request #141 from chrschn/monotonic_gauge
Add option to enforce strict monotonicy in metrics
2024-03-25 05:33:34 +01:00
Renovate Bot
0eba231132 Update dependency prom/prometheus to v2.51.0 2024-03-19 14:28:49 +00:00
Ivan Podorozhnyi
8b38164ec4 Update Readme.md 2024-03-01 23:20:14 +01:00
Renovate Bot
8a476678d3 Update dependency golang to v1.22 2024-02-07 14:27:51 +00:00
chrschn
72289eeb10 Merge branch 'master' into monotonic_gauge 2024-02-05 22:15:55 +01:00
Christian Schneider
84ed960831 Restrict to Go 1.14 functionality 2024-02-05 21:56:40 +01:00
Christian Schneider
4943c97963 Add option to enforce strict monotonicy in metrics.
This change adds the new option `force_monotonicy` to metric
configurations. It is intended for almost-but-not-really monotinic
sources, such as counters which reset when the sensor is restarted.

When this option is set to `true`, the source metric value is regularly
written to disk. This allows us to detect and compensate counter resets
even between restarts. When a reset is detected, the last value before
the reset becomes the new offset, which is added to the metric value
going forth.  The result is a strictly monotonic time series, like an
ever increasing counter.
2024-02-05 21:04:52 +01:00
Christoph Petrausch
5c1917ff68 Bump action versions 2024-02-05 21:04:52 +01:00
Christoph Petrausch
c071e92223 Fix go releaser config 2024-02-05 21:04:52 +01:00
Christoph Petrausch
6e9f1a21af Fix goreleaser deprecation 2024-02-05 21:04:52 +01:00
Christoph Petrausch
7419ffac11 Bump to Go 1.21 in tests in relase 2024-02-05 21:04:52 +01:00
Christoph Petrausch
70de9d66d7 Bump newest version to go 1.21 in tests 2024-02-05 21:04:52 +01:00
Renovate Bot
a963576416 Update dependency prom/prometheus to v2.48.1 2024-02-05 21:04:52 +01:00
Renovate Bot
1f018bf108 Update dependency golang to v1.21 2024-02-05 21:04:52 +01:00
yan
9da7b1b379 Handle json payload in metric_per_topic mode 2024-02-05 21:04:52 +01:00
dmolle
d562b927f8 Update Readme.md
JSON needs to be upper case, otherwiese "could not setup a metric extractor	{"error": "unsupported object format: json"} " is thrown.
2024-02-05 21:04:52 +01:00
Alexander Bakker
6d695bdbf4 Rename received_messages metric to be more conventional
This patch renames the ``received_messages`` metric to
``mqtt2prometheus_received_messages_total``, making it a bit more in
line with conventional Prometheus metric naming.

I also slightly adjusted the descriptions.
2024-02-05 21:04:52 +01:00
Pavel Dostál
aef661ee0e Add example for Shelly H&T sensor 2024-01-21 14:44:12 +01:00
Christoph Petrausch
47658bb8da Merge pull request #142 from hikhvar/hikhvar-patch-1
Bump newest version to go 1.21
v0.1.8-RC1
2023-12-14 23:30:27 +01:00
Christoph Petrausch
980736228f Bump action versions 2023-12-14 23:22:37 +01:00
Christoph Petrausch
8bf0346b10 Fix go releaser config 2023-12-14 23:22:25 +01:00
Christoph Petrausch
b3c4e7615b Fix goreleaser deprecation 2023-12-14 23:17:40 +01:00
Christoph Petrausch
592cb840d9 Bump to Go 1.21 in tests in relase 2023-12-14 23:09:17 +01:00
Christoph Petrausch
eaaecc2d81 Bump newest version to go 1.21 in tests 2023-12-14 23:06:01 +01:00
Christoph Petrausch
9ac285c236 Merge pull request #127 from hikhvar/renovate/prom-prometheus-2.x
Update dependency prom/prometheus to v2.43.0
2023-12-14 23:05:09 +01:00
Christoph Petrausch
f96b7f3bdc Merge pull request #136 from hikhvar/renovate/golang-1.x
Update dependency golang to v1.21
2023-12-14 23:03:07 +01:00
Christoph Petrausch
b27f5a8c2e Merge pull request #131 from y-martin/jsonpayload-metric-per-topic
Handle json payload in metric_per_topic mode
2023-12-14 22:50:44 +01:00
Christoph Petrausch
f6b8e4dbb1 Merge pull request #129 from dmolle/patch-1
Update Readme.md: object_per_topic_config: encoding need to be upper case
2023-12-14 22:48:48 +01:00
Christoph Petrausch
05784700cd Merge pull request #130 from alexbakker/metric-names
Rename received_messages metric to be more conventional
2023-12-14 22:48:27 +01:00
Renovate Bot
09558b1ddb Update dependency prom/prometheus to v2.48.1 2023-12-09 14:27:46 +00:00
Renovate Bot
28b465c46e Update dependency golang to v1.21 2023-08-09 14:31:54 +00:00
Christoph Petrausch
dbd47d303b Merge pull request #132 from timbuchwaldt/patch-1
Fix typo
2023-04-24 08:13:13 +02:00
Tim Buchwaldt
74563f1caa Fix typo 2023-04-24 07:58:30 +02:00
yan
51b627abce Handle json payload in metric_per_topic mode 2023-04-19 01:06:13 +02:00
Alexander Bakker
6375aacc87 Rename received_messages metric to be more conventional
This patch renames the ``received_messages`` metric to
``mqtt2prometheus_received_messages_total``, making it a bit more in
line with conventional Prometheus metric naming.

I also slightly adjusted the descriptions.
2023-04-13 23:33:38 +02:00
dmolle
ced08556ab Update Readme.md
JSON needs to be upper case, otherwiese "could not setup a metric extractor	{"error": "unsupported object format: json"} " is thrown.
2023-04-01 01:32:24 +02:00
Christoph Petrausch
1e7d2bfbfe Merge pull request #124 from hikhvar/renovate/prom-prometheus-2.x
Update dependency prom/prometheus to v2.42.0
2023-03-08 20:31:24 +01:00
Renovate Bot
bf2b08cfb9 Update dependency prom/prometheus to v2.42.0 2023-03-08 14:31:41 +00:00