Consume the Fastly Real-time Analytics API and export data via a Prometheus metrics endpoint.
- Prometheus, metrics output validation
- shellcheck, bash linting
- Docker
FASTLY_API_KEY="${fastly_api_token}" bash loop.sh
Will start endpoint.py
to serve the metrics files, and make a loop calling collect_rt_metrics.py
which download
the metrics and will format the output to be suitable with Prometheus.
See metrics_list.txt
metrics names are prefixed with fastly_
and are exported as counter
Contributions are subjected to reviews, please submit a pull request.
Verify your submission with:
- shellcheck
- flake8
- pylint (in case of conflict flake8 take precedence)
check formatter output with
promtool check metrics < output
Configurables:
- Endpoint port (currently only port 5000)
- loop pause
Improvement
- Better control of loop length (exact requested time, instead of execution time + sleep)
- use temp file name and storage
- logging