This application queries CloudFlare Analytics API to get key metrics, and pushes them to AWS CloudWatch Metrics.
Current metric collectors are:
- Cache Statistics
The application requires the following environment variables be set:
CLOUDFLARE_ENDPOINT_URLThe CloudFlare graphql endpoint e.g. https://api.cloudflare.com/client/v4/graphql
CLOUDFLARE_API_TOKENYour CloudFlare API token with
CLOUDFLARE_ZONE_TAGThe Zone Tag to query.
CLOUDFLARE_HOSTNAMEThe hostname to filter by.
PERIOD_SECONDSThe number of seconds between metric collection (minimum 60 seconds).
METRICS_NAMESPACEThe AWS CloudWatch Metric namespace to use.
local.env and set variables.
Use the following make commands:
make build make lint make vet make test
The application is released as a docker image when a new tag is created.
You can test the release process locally using:
goreleaser build --snapshot --rm-dist
Simplify and reduce number of metrics
Dramatically reduce the number of generated metrics by using less dimensions and fetching less data.
Also added tests for each collector using http test server.