Collect metrics on scrape instead of timer
The prometheus docs on exporters say:
Metrics should only be pulled from the application when Prometheus scrapes them, exporters should not perform scrapes based on their own timers. That is, all scrapes should be synchronous.
The very first example provided by this repository goes against those docs by just spamming the same function on a timer.
Can anyone provide a basic example that shows how to start a metrics collection only when prometheus connects to the exporter, as it's actually supposed to be done? Because christ, it's faster to just set up a flask server with a custom /metrics endpoint than actually figure out how to do so using this framework.
If you are interested in creating an exporter see the custom collectors section of the docs: https://prometheus.github.io/client_python/collector/custom/.