micw / homedatabroker

A middleware that reads, converts and publishes metrics from various sources to various targets
14 stars 3 forks source link

Scrape-endpoint for input-metrics #7

Closed hkuehl closed 8 months ago

hkuehl commented 9 months ago

This is a follow up to https://github.com/micw/tibber-pulse-reader/issues/23.

I checked out your feature-build at https://github.com/micw/homedatabroker/tree/feature/webui?tab=readme-ov-file#web-ui. Awesome work and very quick! Thanks!

My Tibber exports the following values when checking the UI-page:

Source | Metric | Value | Unit | Last updated
-- | -- | -- | -- | --
pulse | energyExportTotal | 769006.2 | WATT_HOUR | 2023-12-10T22:10:02.065358268+01:00
pulse | energyImportTotal | 606587.6 | WATT_HOUR | 2023-12-10T22:10:02.065330857+01:00
pulse | powerTotal | 217 | WATT | 2023-12-10T22:10:02.065362427+01:00

Checking the openmetrics-endpoint at /metrics/sources I get the same value but the metrics are not typed. It is just the plain stuff:

pulse_energyExportTotal 769006.2 1702242154
pulse_powerTotal 248 1702242154
pulse_energyImportTotal 606557.4 1702242154

For best user experience when querying the data, the first and last value should be of type counter and the middle one should be a gauge. The middle one should also be renamed to with a suffix "Current" since it is not a "Total" in the prometheus-sense.

Couple of minor things for Home Data Broker: the docs are not so intuitive. I had to add my own config.yaml and reference it in the docker-config which I wasn't aware of.

hkuehl commented 9 months ago

I also added the /metrics/sources endpoint to my prometheus config. 2 of the 3 metrics-series are created but have no values. Need to investigate further.

hkuehl commented 8 months ago

Closing this one. I will go down the route of exposing prometheus metrics of your other tibber-exporter. It is simpler for me and exactly what I need.