{"id":15178795,"url":"https://github.com/rare-magma/github-exporter","last_synced_at":"2026-04-05T00:02:30.507Z","repository":{"id":252515140,"uuid":"840474590","full_name":"rare-magma/github-exporter","owner":"rare-magma","description":"CLI tool that uploads the Github traffic and statistics API data to InfluxDB on a daily basis ","archived":false,"fork":false,"pushed_at":"2026-02-01T09:43:50.000Z","size":482,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-01T19:55:48.988Z","etag":null,"topics":["github","go","golang","grafana","grafana-dashboard","influxdb"],"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/rare-magma.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":"CODEOWNERS","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":"2024-08-09T19:44:25.000Z","updated_at":"2026-02-01T09:43:47.000Z","dependencies_parsed_at":"2024-09-23T10:30:38.554Z","dependency_job_id":"dd08bedd-0ecd-4e47-b391-27a8fcad41d0","html_url":"https://github.com/rare-magma/github-exporter","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"ffc0ff5677c1ee0613b7aa99f209569c2cf944ea"},"previous_names":["rare-magma/github-exporter"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rare-magma/github-exporter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rare-magma%2Fgithub-exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rare-magma%2Fgithub-exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rare-magma%2Fgithub-exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rare-magma%2Fgithub-exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rare-magma","download_url":"https://codeload.github.com/rare-magma/github-exporter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rare-magma%2Fgithub-exporter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30073785,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T05:31:57.858Z","status":"ssl_error","status_checked_at":"2026-03-04T05:31:38.462Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["github","go","golang","grafana","grafana-dashboard","influxdb"],"created_at":"2024-09-27T15:23:15.402Z","updated_at":"2026-03-04T06:07:16.788Z","avatar_url":"https://github.com/rare-magma.png","language":"Go","readme":"# github-exporter\n\nCLI tool that uploads the Github traffic and statistics API data to influxdb on a daily basis\n\n## Dependencies\n\n- [go](https://go.dev/)\n- Optional:\n  - [make](https://www.gnu.org/software/make/) - for automatic installation support\n  - [docker](https://docs.docker.com/)\n  - [systemd](https://systemd.io/)\n\n## Relevant documentation\n\n- [Github API](https://docs.github.com/en/rest/quickstart?apiVersion=2022-11-28)\n- [InfluxDB API](https://docs.influxdata.com/influxdb/v2.6/write-data/developer-tools/api/)\n- [Systemd Timers](https://www.freedesktop.org/software/systemd/man/systemd.timer.html)\n- [reddec/compose-scheduler](https://github.com/reddec/compose-scheduler)\n\n## Installation\n\n### With Docker\n\n#### docker-compose\n\n1. Configure `github_exporter.json` (see the configuration section below).\n1. Run it.\n\n   ```bash\n   docker compose up --detach\n   ```\n\n#### docker build \u0026 run\n\n1. Build the docker image.\n\n   ```bash\n   docker build . --tag github-exporter\n   ```\n\n1. Configure `github_exporter.json` (see the configuration section below).\n1. Run it.\n\n   ```bash\n    docker run --rm --tty --interactive --read-only --cap-drop ALL --security-opt no-new-privileges:true --cpus 2 -m 64m --pids-limit 16 --volume ./github_exporter.json:/app/github_exporter.json:ro ghcr.io/rare-magma/github-exporter:latest\n    ```\n\n### With the Makefile\n\nFor convenience, you can install this exporter with the following command or follow the manual process described in the next paragraph.\n\n```bash\nmake build\nmake install\n$EDITOR $HOME/.config/github_exporter.json\n```\n\n### Manually\n\n1. Build `github_exporter` with:\n\n   ```bash\n   go build -ldflags=\"-s -w\" -o github_exporter main.go\n   ```\n\n2. Copy `github_exporter` to `$HOME/.local/bin/`.\n\n3. Copy `github_exporter.json` to `$HOME/.config/`, configure them (see the configuration section below) and make them read only.\n\n4. Copy the systemd unit and timer to `$HOME/.config/systemd/user/`:\n\n   ```bash\n   cp github-exporter.* $HOME/.config/systemd/user/\n   ```\n\n5. and run the following command to activate the timer:\n\n   ```bash\n   systemctl --user enable --now github-exporter.timer\n   ```\n\nIt's possible to trigger the execution by running manually:\n\n```bash\nsystemctl --user start github-exporter.service\n```\n\n### Config file\n\nThe config file has a few options:\n\n```json\n{\n \"InfluxDBHost\": \"influxdb.example.com\",\n \"InfluxDBApiToken\": \"ZXhhbXBsZXRva2VuZXhhcXdzZGFzZGptcW9kcXdvZGptcXdvZHF3b2RqbXF3ZHFhc2RhCg==\",\n \"Org\": \"home\",\n \"Bucket\": \"github\",\n \"GithubApiToken\": \"ZXhhbXBsZXRva2VuZXhhcXdzZGFzZGptcW9kcXdvZGptcXdvZHF3b2RqbXF3ZHFhc2RhCg==\"\n}\n```\n\n- `InfluxDBHost` should be the FQDN of the influxdb server.\n- `Org` should be the name of the influxdb organization that contains the github data bucket defined below.\n- `Bucket` should be the name of the influxdb bucket that will hold the github data.\n- `InfluxDBApiToken` should be the influxdb API token value.\n  - This token should have write access to the `BUCKET` defined above.\n- `GithubApiToken` should be the Github API token value.\n  - This token should be assigned the \"Administration\" repository permissions (read) permission.\n\n## Troubleshooting\n\nCheck the systemd service logs and timer info with:\n\n```bash\njournalctl --user --unit github-exporter.service\nsystemctl --user list-timers\n```\n\n## Exported metrics\n\n- github_stats_clones: Number of unique git clones and total count per repo\n- github_stats_paths: Number of unique views and total count per path in each repo\n- github_stats_referrals: Number of unique referrals and total count per repo\n- github_stats_views: Number of unique views and total count per repo\n- github_stats_stars: Number of stars per repo\n- github_stats_forks: Number of forks per repo\n- github_stats_actions: Total duration in seconds of a workflow run per repo\n\n## Exported metrics example\n\n```bash\ngithub_stats_clones,repo=rare-magma/guitos count=1,uniques=1 1722124800\ngithub_stats_paths,repo=rare-magma/guitos,path=/rare-magma/guitos/blob/main/docs/images/tooltip.png count=2,uniques=1 1723285062\ngithub_stats_referrals,repo=rare-magma/guitos,referrer=github.com count=74,uniques=23 1723285062\ngithub_stats_views,repo=rare-magma/guitos count=1,uniques=1 1723161600\ngithub_stats_stars,repo=rare-magma/guitos count=30 1723285063\ngithub_stats_forks,repo=rare-magma/guitos count=3 1723285063\ngithub_stats_actions,repo=rare-magma/guitos,workflow=Dependabot\\ Updates duration=46 1723285063\n```\n\n## Example grafana dashboard\n\nIn `github-dashboard.json` there is an example of the kind of dashboard that can be built with `github-exporter` data:\n\n\u003cimg src=\"dashboard-screenshot.png\" alt=\"Grafana dashboard screenshot\" title=\"Example grafana dashboard\" width=\"100%\"\u003e\n\nImport it by doing the following:\n\n1. Create a dashboard\n2. Click the dashboard's settings button on the top right.\n3. Go to JSON Model and then paste there the content of the `github-dashboard.json` file.\n\n## Uninstallation\n\n### With the Makefile\n\nFor convenience, you can uninstall this exporter with the following command or follow the process described in the next paragraph.\n\n```bash\nmake uninstall\n```\n\n### Manually\n\nRun the following command to deactivate the timer:\n\n```bash\nsystemctl --user disable --now github-exporter.timer\n```\n\nDelete the following files:\n\n```bash\n~/.local/bin/github_exporter\n~/.config/github_exporter.json\n~/.config/systemd/user/github-exporter.timer\n~/.config/systemd/user/github-exporter.service\n```\n\n## Credits\n\n- [reddec/compose-scheduler](https://github.com/reddec/compose-scheduler)\n- [google/go-github](https://github.com/google/go-github)\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frare-magma%2Fgithub-exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frare-magma%2Fgithub-exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frare-magma%2Fgithub-exporter/lists"}