Commit Graph

281 Commits

Author SHA1 Message Date
Christoph Petrausch
3a9ad76b8f Merge pull request #157 from fatpat/error_value
make error_value global to metric and add error_expression
2024-12-31 22:21:19 +01:00
Jérôme LOYET
d28d6cd818 make error_value global to metric
* fail if both metric.error_value and
  metric.string_value_mapping.error_value are set
* mark metric.string_value_mapping.error_value as deprecated
2024-12-30 09:53:12 +01:00
Christoph Petrausch
4674e6a17f Merge pull request #160 from hikhvar/dependabot/go_modules/golang.org/x/crypto-0.31.0
Bump golang.org/x/crypto from 0.0.0-20210616213533-5ff15b29337e to 0.31.0
2024-12-27 20:19:06 +01:00
Christoph Petrausch
3737608799 Merge pull request #150 from hikhvar/renovate/prom-prometheus-2.x
Update dependency prom/prometheus to v2.52.0
2024-12-27 20:09:58 +01:00
Christoph Petrausch
fe7ac1c9d6 Merge pull request #153 from hikhvar/renovate/golang-1.x
Update dependency golang to v1.23
2024-12-27 20:09:31 +01:00
Christoph Petrausch
defc591c1e Merge pull request #158 from hikhvar/dependabot/go_modules/google.golang.org/protobuf-1.33.0
Bump google.golang.org/protobuf from 1.26.0-rc.1 to 1.33.0
2024-12-27 20:09:19 +01:00
dependabot[bot]
b9c15e86b6 Bump golang.org/x/crypto
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.0.0-20210616213533-5ff15b29337e to 0.31.0.
- [Commits](https://github.com/golang/crypto/commits/v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-27 19:05:54 +00:00
dependabot[bot]
e04788d0ef Bump google.golang.org/protobuf from 1.26.0-rc.1 to 1.33.0
Bumps google.golang.org/protobuf from 1.26.0-rc.1 to 1.33.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-27 19:05:53 +00:00
Christoph Petrausch
4b0085b8cc Merge pull request #156 from fatpat/update-expr
update expr to 1.16.9
2024-12-27 20:05:03 +01:00
Jérôme LOYET
6ff26135b2 update expr to 1.16.9
- update minimal go version from 1.16 to 1.18 (like expr)
- update test from go 1.16 to 1.23
2024-12-27 08:39:41 +01:00
Renovate Bot
7a8e831a6d chore(deps): update dependency prom/prometheus to v2.55.1 2024-12-26 14:33:11 +00:00
Renovate Bot
d729a8b608 chore(deps): update dependency golang to v1.23 2024-12-26 14:33:09 +00:00
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