{"id":26454161,"url":"https://github.com/coolapso/prometheus-twitch-exporter","last_synced_at":"2026-05-20T06:07:53.081Z","repository":{"id":252204117,"uuid":"839547362","full_name":"coolapso/prometheus-twitch-exporter","owner":"coolapso","description":"A Twitch exporter for prometheus","archived":false,"fork":false,"pushed_at":"2024-11-17T17:31:52.000Z","size":80,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-17T18:20:19.711Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coolapso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"coolapso","buy_me_a_coffee":"coolapso"}},"created_at":"2024-08-07T20:50:12.000Z","updated_at":"2024-11-17T17:31:55.000Z","dependencies_parsed_at":"2024-10-22T13:20:11.454Z","dependency_job_id":"47b56d53-ef27-40f0-8f63-f7e50b316ebc","html_url":"https://github.com/coolapso/prometheus-twitch-exporter","commit_stats":null,"previous_names":["coolapso/prometheus-twitch-exporter"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coolapso%2Fprometheus-twitch-exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coolapso%2Fprometheus-twitch-exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coolapso%2Fprometheus-twitch-exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coolapso%2Fprometheus-twitch-exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coolapso","download_url":"https://codeload.github.com/coolapso/prometheus-twitch-exporter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244292653,"owners_count":20429709,"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","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":[],"created_at":"2025-03-18T19:44:38.148Z","updated_at":"2026-05-20T06:07:53.043Z","avatar_url":"https://github.com/coolapso.png","language":"Go","funding_links":["https://github.com/sponsors/coolapso","https://buymeacoffee.com/coolapso","https://www.buymeacoffee.com/coolapso"],"categories":[],"sub_categories":[],"readme":"# PROMETHEUS TWITCH EXPORTER\n\n[![release](https://github.com/coolapso/prometheus-twitch-exporter/actions/workflows/release.yaml/badge.svg)](https://github.com/coolapso/prometheus-twitch-exporter/actions/workflows/release.yaml)\n![GitHub Tag](https://img.shields.io/github/v/tag/coolapso/prometheus-twitch-exporter?logo=semver\u0026label=semver\u0026labelColor=gray\u0026color=green)\n[![Docker image version](https://img.shields.io/docker/v/coolapso/twitch-exporter/latest?logo=docker)](https://hub.docker.com/r/coolapso/twitch-exporter)\n[![Go Report Card](https://goreportcard.com/badge/github.com/coolapso/prometheus-twitch-exporter)](https://goreportcard.com/report/github.com/coolapso/prometheus-twitch-exporter)\n![GitHub Sponsors](https://img.shields.io/github/sponsors/coolapso?style=flat\u0026logo=githubsponsors)\n\nPrometheus twitch exporter to monitor twitch streams with prometheus. With support Oauth support, for both user and application tokens. \n\n## Install\n\nCurrently you can only grab one of the binaries provided in the releases page, or run it using docker. Check each use case examples for more details.\n\n## Exported Metrics\n\n| Metric | Meaning | Labels | type |\n| ------ | ------- | ------ | ---- |\n| twitch_is_live | If twitch channel is broadcasting | name | gauge |\n| twitch_viewer_total | Channel current viewer count | name | gauge |\n| twitch_channel_followers_total | The number of channel followers | name | gauge |\n| twitch_channel_subscribers_total | The number of channel subscribers | name | gauge |\n\n## Usage\n\n```\nUsage:\n  twitch-exporter [flags]\n\nFlags:\n      --access.token string       twitch user access token\n      --address string            The address to access the exporter used for oauth redirect uri (default \"localhost\")\n      --client.id string          twitch client id\n      --client.secret string      twitch client secret\n  -h, --help                      help for twitch-exporter\n      --listen.port string        Port to listen at (default \"9184\")\n      --log.format string         Exporter log format, text or json (default \"text\")\n      --log.level string          Exporter log level (default \"info\")\n      --metrics.path string       Path to expose metrics at (default \"/metrics\")\n      --refresh.token string      twitch refresh token\n      --twitch.channels strings   List of channels to get basic metrics from\n      --twitch.user string        The user associated with the user token to get extra metrics from\n      --user.token                If going to use the provided token as a user token\n```\n\nYou can also use environment variables. The most accurate list for them is available [here](cmd/root.go).\n\nTwitch provides two types of authentication methods:\n\n### Using Application Tokens\n\nWhen using an application token, you are only granted access to some generic public endpoints. This exporter can only gather a basic set of metrics from any channel available on Twitch.\n\n1. Go to the [Twitch Developer Portal](https://dev.twitch.tv/), log in, and register a new application.\n2. The OAuth Redirect URL doesn't matter, but you can add the address to twitch exporter `http://\u003cexporterAddress\u003e:9184`.\n3. Manage your application, copy the client ID, and generate a new secret.\n4. Start the exporter and provide the `--client.id \u003cClientID\u003e`, `--client.secret \u003cClientSecret\u003e`, and the `--twitch.channels \u003cChannelsList\u003e` you wish to monitor.\n5. Access the exporter at `http://\u003cexporterAddress\u003e:9184/metrics`.\n\n#### Examples\n\nUsing flags:\n```\n./twitch-exporter --client.id \u003cClientID\u003e --client.secret \u003cClientSecret\u003e --twitch.channels \"chan1,chan2,chan3\"\n```\n\nUsing environment variables:\n```\nTWITCH_CLIENT_ID=\"\u003cClientID\u003e\" TWITCH_CLIENT_SECRET=\"\u003cClientSecret\u003e\" TWITCH_CHANNELS=\"chan1 chan2 chan3\" ./twitch-exporter\n```\n\nWith Docker, using flags:\n```\ndocker run -d -p 9184:9184 \\\n        coolapso/twitch-exporter \\\n        --client.id=\u003cClientID\u003e \\\n        --client.secret=\u003cClientSecret\u003e \\\n        --twitch.channels=\"chan1,chan2,chan3\"\n```\n\nWith Docker, using environment variables:\n```\ndocker run -d -p 9184:9184 \\\n        -e TWITCH_CLIENT_ID=\u003cClientID\u003e \\\n        -e TWITCH_CLIENT_SECRET=\u003cClientSecret\u003e \\\n        -e TWITCH_CHANNELS=\"chan1 chan2 chan3\" \\\n        coolapso/twitch-exporter\n```\n\n### Using User Tokens\n\nWhen using user tokens, you are granted access to all features and metrics available for application tokens, plus information specific to your own channel/username.\n\n1. Go to the [Twitch Developer Portal](https://dev.twitch.tv/), log in, and register a new application.\n2. Fill in the OAuth Redirect URL correctly, as it is used to redirect you to the Prometheus Twitch exporter to finish the user authentication flow. You should use the address where the exporter will be reachable (from your browser).\n    * http://localhost:9184\n    * http://\u003cMachineIP\u003e:9184\n    * http://twitchexporter.mydomain.com:9184\n3. Manage your application, copy the client ID, and generate a new secret.\n4. Start the exporter and provide the `--client.id \u003cClientID\u003e`, `--client.secret \u003cClientSecret\u003e`, set the `--user.token` flag, and provide the username associated with the OAuth token with the `--twitch.user \u003cUserName\u003e`.\n5. Grab the authentication URL from the logs or from `http://\u003cExporterAddress\u003e:9184/` and complete the authentication flow.\n6. You can also monitor other Twitch channels at the same time; however, you can only get basic metrics for those channels.\n\n#### Examples\n\nUsing flags:\n```\n./twitch-exporter --client.id \u003cClientID\u003e --client.secret \u003cClientSecret\u003e --twitch.channels \"chan1,chan2,chan3\" --user.token --twitch.user cool4pso \n```\n\nUsing environment variables:\n```\nTWITCH_CLIENT_ID=\"\u003cClientID\u003e\" TWITCH_CLIENT_SECRET=\"\u003cClientSecret\u003e\" TWITCH_USER_TOKEN=true TWITCH_USER=cool4pso TWITCH_CHANNELS=\"chan1 chan2 chan3\" ./twitch-exporter\n```\n\nWith Docker, using flags:\n```\ndocker run -d -p 9184:9184 \\\n        coolapso/twitch-exporter \\\n        --address=\"192.168.1.5\"\n        --client.id=\u003cClientID\u003e \\\n        --client.secret=\u003cClientSecret\u003e \\\n        --twitch.channels=\"chan1,chan2,chan3\" \\\n        --user.token \\\n        --twitch.user cool4pso\n```\n\nWith Docker, using environment variables:\n```\ndocker run -d -p 9184:9184 \\\n        -e ADDRESS=\"192.168.1.5\"\n        -e TWITCH_CLIENT_ID=\u003cClientID\u003e \\\n        -e TWITCH_CLIENT_SECRET=\u003cClientSecret\u003e \\\n        -e TWITCH_CHANNELS=\"chan1 chan2 chan3\" \\\n        -e TWITCH_USER_TOKEN=true \\\n        coolapso/twitch-exporter\n```\n\n#### Pre-generated access token\n\nYou can also pre-generate the access token and refresh token, for example with Twitch CLI:\n\n```\ntwitch token get -u --scopes \"channel:read:subscriptions\"\n```\n\nThen provide them to the application using the flags or corresponding environment variables. This way, you won't have to handle the authentication flow every time.\n\n# Contributions\n\nImprovements and suggestions are always welcome, feel free to check for any open issues, open a new Issue or Pull Request\n\nIf you like this project and want to support / contribute in a different way you can always [:heart: Sponsor Me](https://github.com/sponsors/coolapso) or\n\n\u003ca href=\"https://www.buymeacoffee.com/coolapso\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-yellow.png\" alt=\"Buy Me A Coffee\" style=\"height: 51px !important;width: 217px !important;\" /\u003e\n\u003c/a\u003e\n\n# Related projects \n\n* [twitch_exporter](https://github.com/damoun/twitch_exporter)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoolapso%2Fprometheus-twitch-exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoolapso%2Fprometheus-twitch-exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoolapso%2Fprometheus-twitch-exporter/lists"}