timoschlueter / nightscout-librelink-up

Script written in TypeScript that uploads CGM readings from LibreLink Up to Nightscout.
MIT License
208 stars 259 forks source link

Add Prometheus endpoint #90

Open solsson opened 1 year ago

solsson commented 1 year ago

See #89 for example Kubernetes yaml.

Remaining decisions:

timoschlueter commented 1 year ago

Thank you for this amazing addition. Here are a few thoughts:

Which value to pick. Are .glucoseMeasurement and .glucoseItem equivalent? Or maybe it's better to use the newest .graphData entry instead?

The glucoseMeasurement which also contains a trend-arrow is the latest value available in the LibreLink Up app. Its a "raw" value that has not been smoothed and might spike up and down a lot. I think this should be the value that should be exported via the exporter.

_I haven't had the chance to test with no sensor values yet. What should be exported then? If using Prometheus alerts, exporting zeroes is impractical. Alert definitions should be as simple as possible, for example glucose_value < 3.5. Maybe glucose_low=0, glucose_high=0 and not exporting glucose_value or glucosetrend? Prometheus can alert on absent metrics.

I think your suggestion is good. Exporting low/high as 0 and no value for "value" and "trend" should work for most use cases.

What do we know about the TrendArrow value (present in glucoseItem but not in graphData)? It's constantly been 3 since I started testing.

The trend arrow does work. In the glucoseMeasurement entry it reflects the current state of the latest measurement. It is not available in graphData since those values have been "smoothed" on Abbots side and are only there for historical reasons (displaying the graph in the app). You can't check the trend arrow for historical data within the app. The trend is only available for the latest, raw value, which comes in the glucoseMeasurement entry.

_What to do in SINGLESHOT mode with prometheus enabled? Writing a json file should be enough.

timoschlueter commented 1 year ago

@solsson: what is your opinion on my suggestions? I still think this feature would be a great addition! :)

solsson commented 1 year ago

Thanks a lot for your comments. Unfortunately I no longer have Libre sensors. Even more unfortunately I failed to see the notification for your April 6th response. Sorry.

I don't think I can meaningfully test any further changes to this PR, but of course anyone is welcome to continue from the current state.