Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Prometheus endpoint #90

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

solsson
Copy link

@solsson solsson commented Apr 2, 2023

See #89 for example Kubernetes yaml.

Remaining decisions:

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

  • 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 glucose_trend? Prometheus can alert on absent metrics.

    • I'll add unit tests for the strategy we pick.

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

  • What to do in SINGLE_SHOT mode with prometheus enabled?

    • Stay running and export the first metric?
    • Support push?
    • Do nothing?
    • Write the response to a json file (as is done now). Was useful for me to get started.

@timoschlueter
Copy link
Owner

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 glucose_trend? 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 SINGLE_SHOT mode with prometheus enabled?
Writing a json file should be enough.

@timoschlueter
Copy link
Owner

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

@solsson
Copy link
Author

solsson commented Jun 16, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants