{"id":13613093,"url":"https://github.com/fastly/fastly-exporter","last_synced_at":"2025-11-12T22:00:56.250Z","repository":{"id":37461200,"uuid":"129769938","full_name":"fastly/fastly-exporter","owner":"fastly","description":"A Prometheus exporter for the Fastly Real-time Analytics API","archived":false,"fork":false,"pushed_at":"2025-11-10T21:04:09.000Z","size":3403,"stargazers_count":104,"open_issues_count":12,"forks_count":45,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-11-10T22:20:49.246Z","etag":null,"topics":["fastly-oss-tier1","tool"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fastly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-04-16T15:59:25.000Z","updated_at":"2025-11-10T21:04:12.000Z","dependencies_parsed_at":"2024-05-20T21:38:47.869Z","dependency_job_id":"a2914581-f4d5-4e79-860d-41d3619614ff","html_url":"https://github.com/fastly/fastly-exporter","commit_stats":null,"previous_names":["peterbourgon/fastly-exporter"],"tags_count":49,"template":false,"template_full_name":null,"purl":"pkg:github/fastly/fastly-exporter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastly%2Ffastly-exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastly%2Ffastly-exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastly%2Ffastly-exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastly%2Ffastly-exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fastly","download_url":"https://codeload.github.com/fastly/fastly-exporter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastly%2Ffastly-exporter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284115869,"owners_count":26949957,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-12T02:00:06.336Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastly-oss-tier1","tool"],"created_at":"2024-08-01T20:00:39.597Z","updated_at":"2025-11-12T22:00:56.244Z","avatar_url":"https://github.com/fastly.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# fastly-exporter [![Latest Release](https://img.shields.io/github/release/fastly/fastly-exporter.svg?style=flat-square)](https://github.com/fastly/fastly-exporter/releases/latest) [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Ffastly%2Ffastly-exporter%2Fbadge%3Fref%3Dmain\u0026style=flat-square)](https://actions-badge.atrox.dev/fastly/fastly-exporter/goto?ref=main)\n\nThis program consumes from the [the Fastly API][api] and makes\nthe data available to [Prometheus][prom]. It should behave like you expect:\ndynamically adding new services, removing old services, and reflecting changes\nto service metadata like name and version.\n\nFastly APIs consumed:\n\n* [Real-time Analytics API][rt]\n* [Service list][svc]\n* [Custom TLS Certificates][certs]\n* [POPs][pops]\n\n[api]: https://www.fastly.com/documentation/reference/api/\n[rt]: https://www.fastly.com/documentation/reference/api/metrics-stats/realtime/\n[svc]: https://www.fastly.com/documentation/reference/api/services/service/#list-services\n[pops]: https://www.fastly.com/documentation/reference/api/utils/pops/\n[certs]: https://www.fastly.com/documentation/reference/api/tls/custom-certs/\n\n[prom]: https://prometheus.io\n\n# Installation\n\n## Binary\n\nGo to the [releases page][releases].\n\n[releases]: https://github.com/fastly/fastly-exporter/releases\n\n## Docker\n\nAvailable on the [packages page][pkg] as [fastly/fastly-exporter][img].\n\n[pkg]: https://github.com/fastly/fastly-exporter/packages\n[img]: https://github.com/fastly/fastly-exporter/pkgs/container/fastly-exporter\n\n```sh\ndocker pull ghcr.io/fastly/fastly-exporter:latest\n```\n\nNote that version `latest` will track RCs, alphas, etc. -- always use an\nexplicit version in production.\n\n## Helm chart\n\n[Helm](https://helm.sh) must be installed to use the [prometheus-community/fastly-exporter](https://github.com/prometheus-community/helm-charts/tree/main/charts/prometheus-fastly-exporter) chart.\nPlease refer to Helm's [documentation](https://helm.sh/docs/) to get started.\n\nOnce Helm is set up properly, add the repo as follows:\n\n```sh\nhelm repo add prometheus-community https://prometheus-community.github.io/helm-charts\n```\n\nAnd install:\n\n```sh\nhelm upgrade --install fastly-exporter prometheus-fastly-exporter --namespace monitoring --set token=\"fastly_api_token\"\n```\n\n## Source\n\nIf you have a working Go installation, you can clone the repo and install the\nbinary from any revision, including HEAD.\n\n```sh\ngit clone git@github.com:fastly/fastly-exporter\ncd fastly-exporter\ngo build ./cmd/fastly-exporter\n./fastly-exporter -h\n```\n\n# Using the Exporter\n\n## Authentication\n\nA valid Fastly API token is required to use the exporter. [See this link][token]\nfor information on creating API tokens. The token can be provided via the\n`-token` flag or the `FASTLY_API_TOKEN` environment variable.\n\nIf you would like to export TLS certificate metrics the token will need TLS Management permissions:\n* If you are using a [user token][token] the user must have TLS Management permissions. [See this link][user_perms] for how to update this access permissions.\n* If you are using an [automation token][auto_token] it must have TLS Management permissions.\n\n[token]: https://www.fastly.com/documentation/guides/account-info/account-management/using-api-tokens/#creating-api-tokens\n[auto_token]: https://www.fastly.com/documentation/guides/account-info/account-management/using-api-tokens/#creating-automation-tokens\n[user_perms]: https://www.fastly.com/documentation/guides/account-info/user-access-and-control/configuring-user-roles-and-permissions/#changing-user-roles-and-access-permissions-for-existing-users\n\n## Basic\n\nFor simple use cases, all you need is a Fastly API token.\n\n```sh\nfastly-exporter -token XXX\n```\n\nThis will collect real-time stats for all Fastly services visible to your token,\nand make them available as Prometheus metrics on [127.0.0.1:8080/metrics][local].\n\n[local]: http://127.0.0.1:8080/metrics\n\n## Filtering services\n\nBy default, all services available to your token will be exported. You can\nspecify an explicit set of service IDs to export by using the `-service xxx`\nflag. (Service IDs are available at the top of your [Fastly dashboard][db].) You\ncan also include only those services whose name matches a regex by using the\n`-service-allowlist '^Production'` flag, or exclude any service whose name matches\na regex by using the `-service-blocklist '.*TEST.*'` flag.\n\n[db]: https://manage.fastly.com/services/all\n\nFor tokens with access to a lot of services, it's possible to \"shard\" the\nservices among different fastly-exporter instances by using the `-service-shard`\nflag. For example, to shard all services between 3 exporters, you would start\neach exporter as\n\n```sh\nfastly-exporter [common flags] -service-shard 1/3\nfastly-exporter [common flags] -service-shard 2/3\nfastly-exporter [common flags] -service-shard 3/3\n```\n\n## Filtering metrics\n\nBy default, all metrics provided by the Fastly real-time stats API are exported\nas Prometheus metrics. You can export only those metrics whose name matches a\nregex by using the `-metric-allowlist 'bytes_total$'` flag, or exclude any metric\nwhose name matches a regex by using the `-metric-blocklist imgopto` flag.\n\n## Filter semantics\n\nAll flags that filter services or metrics are repeatable. Repeating the same\nflag causes its condition to be combined with OR semantics. For example,\n`-service A -service B` would include both services A and B (but not service C).\nOr, `-service-blocklist Test -service-blocklist Staging` would skip any service\nwhose name contained Test or Staging.\n\nDifferent flags (for the same filter target) combine with AND semantics. For\nexample, `-metric-allowlist 'bytes_total$' -metric-blocklist imgopto` would only\nexport metrics whose names ended in bytes_total, but didn't include imgopto.\n\n## Metrics Grouping: by datacenter or aggregate\n\nThe Fastly real-time stats API returns measurements grouped by datacenter as\nwell as aggregated measurements for all datacenters. By default, exported\nmetrics are grouped by datacenter. The response body size of the metrics\nendpoint can potentially be very large. This will be exacerbated when using\nthe exporter with many services, many origins with Origin Inspector, and many\ndomains with Domain Inspector. One way to reduce the output size of the\nmetrics endpoint is by using the `-aggregate-only` flag. When this flag is\nused only the `aggregated` metrics from the real-time stats API will be\nexported. Metrics will still include the datacenter label but it will always\nbe set to \"aggregate\".\n\n## Service discovery\n\nPer-service metrics are available via `/metrics?target=\u003cservice ID\u003e`. Available\nservices are enumerated as targets on the `/sd` endpoint, which is compatible\nwith the [generic HTTP service discovery][httpsd] feature of Prometheus. An\nexample Prometheus scrape config for the Fastly exporter follows.\n\n[httpsd]: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#http_sd_config\n\n```yaml\nscrape_configs:\n  - job_name: fastly-exporter\n    http_sd_configs:\n      - url: http://127.0.0.1:8080/sd\n    relabel_configs:\n      - source_labels: [__address__]\n        target_label: __param_target\n      - source_labels: [__param_target]\n        target_label: service\n      - target_label: __address__\n        replacement: 127.0.0.1:8080\n```\n\n## Dashboards and Alerting\n\nData from the the Fastly exporter can be used to build dashboards and alerts with [Grafana][grafana] and [Alertmanager][alertmanager]. For a fully working example see [fastly-dashboards][dashboards] created by [@mrnetops][mrnetops]. Fastly-dashboards contains a Docker Compose setup, which boots up a full fastly-exporter + Prometheus + Alertmanager + Grafana + Fastly dashboard stack with Slack alerting integration.\n\n[grafana]: https://grafana.com\n[alertmanager]: https://prometheus.io/docs/alerting/latest/alertmanager/\n[mrnetops]: https://github.com/mrnetops\n[dashboards]: https://github.com/mrnetops/fastly-dashboards\n\n# Maintainers\n\n## Releases\n\nTo make a new release:\n\n1. Push a new git tag, e.g. `git tag v9.4.0 -m'v9.4.0'; git push --tags`\n1. GitHub Actions drafts the new release\n1. Click the \"[Generate release notes](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#creating-automatically-generated-release-notes-for-a-new-release)\" in GitHub\n1. Publish the new release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffastly%2Ffastly-exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffastly%2Ffastly-exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffastly%2Ffastly-exporter/lists"}