AlexanderThaller / prometheus_exporter

Helper libary to export prometheus metrics using tiny_http and rust-prometheus.
MIT License
28 stars 10 forks source link

Any way to indicate scrape error? #32

Closed ndevenish closed 1 year ago

ndevenish commented 2 years ago

As per https://prometheus.io/docs/instrumenting/writing_exporters/#failed-scrapes it's acceptable to return a 500 error in cases where the metric is unavailable (e.g. I'm scraping a service that doesn't have it's own exporter, and it might be down). Terminating the exporter and allowing it to be restarted works, but isn't very clean (and leaves a truncated response instead of a clean return code).

Is there a way to indicate this with prometheus_exporter? If not, what would be a prometheus_exporter-idiomatic way to extend it to support this?

AlexanderThaller commented 1 year ago

Will check should be possible.

AlexanderThaller commented 1 year ago

@ndevenish You can check the attached pullrequest if you want to see if that would work for you. Let me know if anything is unclear.