Skip to content
A Prometheus exporter for the Fastly Real-time Analytics API
Go Other
  1. Go 98.8%
  2. Other 1.2%
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.

fastly-exporter Latest Release status Docker Status

This program consumes from the Fastly Real-time Analytics API and makes the data available to Prometheus. It should behave like you expect: dynamically adding new services, removing old services, and reflecting changes to service metadata like name and version.



Go to the releases page.


Avaliable as mrnetops/fastly-exporter from Docker Hub.

docker pull mrnetops/fastly-exporter


If you have a working Go installation, you can install the latest revision from HEAD.

go get



For simple use cases, all you need is a Fastly API token. See this link for information on creating API tokens. The token can be provided via the -token flag or the FASTLY_API_TOKEN environment variable.

fastly-exporter -token XXX

This will collect real-time stats for all Fastly services visible to your token, and make them available as Prometheus metrics on


  fastly-exporter [flags]

  -api-refresh 1m0s                        how often to poll for updated service metadata
  -api-timeout 15s                         HTTP client timeout for requests (5–60s)
  -debug false                             Log debug information
  -endpoint  Prometheus /metrics endpoint
  -name-exclude-regex ...                  if set, ignore any service whose name matches this regex
  -name-include-regex ...                  if set, only include services whose names match this regex
  -namespace fastly                        Prometheus namespace
  -rt-timeout 45s                          HTTP client timeout for requests (45–120s)
  -service ...                             if set, only include this service ID (repeatable)
  -shard ...                               if set, only include services whose hashed IDs modulo m equal n-1 (format 'n/m')
  -subsystem rt                            Prometheus subsystem
  -token ...                               Fastly API token (required; also via FASTLY_API_TOKEN)
  -version false                           print version information and exit

By default, all services available to your token will be exported. You can specify an explicit set of service IDs by using the -service xxx flag. (Service IDs are available at the top of your Fastly dashboard.) You can also include only those services whose name matches a regex by using the -name-include-regex '^Production' flag, or reject any service whose name matches a regex by using the -name-exclude-regex '.*TEST.*' flag.

For tokens with access to a lot of services, it's possible to "shard" the services among different instances of the fastly-exporter by using the -shard flag. For example, to shard all services between 3 exporters, you would start each exporter as

fastly-exporter [common flags] -shard 1/3
fastly-exporter [common flags] -shard 2/3
fastly-exporter [common flags] -shard 3/3

Flags which restrict the services that are exported combine with AND semantics. That is, -service A -service B -name-include-regex 'Foo' would only export data for service A and/or B if their names also matched "Foo". Or, specifying -name-include-regex 'Prod' -name-exclude-regex '^test-' would only export data for services whose names contained "Prod" and did not start with "test-".


This repo contains a Dockerfile if you want to build and package it yourself. You can also use a third-party Docker image.

docker run -p 8080:8080 mrnetops/fastly-exporter -token $MY_TOKEN

This repo also contains a Docker Compose file, which boots up a full fastly-exporter + Prometheus + Grafana + Fastly dashboard stack.

env FASTLY_API_TOKEN=$MY_TOKEN docker-compose up

Access the Grafana dashboard at http://localhost:3000.

Fastly Dashboard in Grafana

You can’t perform that action at this time.