eodag
eodag copied to clipboard
prometheus metrics for server mode
trafficstars
Implement prometheus metrics for server mode
Should be configurable as needed only in containers.
measure data downloaded from each provider measure product types searched ?
check https://github.com/trallnag/prometheus-fastapi-instrumentator
additional suggested measures:
- count of available providers
- count of available product types
Metrics should be OpenTelemetry as it's more general and the new standard way of doing things.
Metrics are implemented with OpenTelemetriy automatic instrumentation (https://opentelemetry.io/docs/instrumentation/python/automatic/).
TODO:
- Compare with https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/CONTRIBUTING.md#guideline-for-instrumentations
- Handle exceptions raised in the metric's code. Write a log message with the error.
- Add test.
- Cleanup of the code. For example,
_instrument_searchand_instrument_downloadused to be independent of each other (you could call_instrument_searchwithout calling_instrument_download) but this is not the case anymore. This is not clear for the code and it should be rewritten. - Fix
EODAGInstrumentor_uninstrument. The callback functions continue to be called after calling_uninstrument