diff --git a/README.md b/README.md index 9fee4e9..204fad0 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ scrape. | `github_runner_busy` | `runner`, `os` | 1 if the runner is currently executing a job, 0 if idle | | `github_org_up` | | 1 if the last org/repo stats poll succeeded, 0 if a stale cache is being served or the first poll is still running (about a minute after startup at ~25 repos) | | `github_org_info` | `org` | Always 1; the org this exporter watches. The dashboard reads it to link to github.com | -| `github_org_repos_total` | `visibility` | Number of non-archived repos, by `public`/`private` | +| `github_org_repos` | `visibility` | Number of non-archived repos, by `public`/`private` | | `github_rate_limit_remaining` | | Remaining core API budget in the scarcest active window: the one that runs out first | | `github_rate_limit_limit` | | Total core API budget of that window | | `github_rate_limit_window_remaining` | `reset` | Remaining budget per active core window, labelled with its reset time. GitHub counts per region, so one token can have several windows at once, and which one a call counts against depends on the endpoint. A window's series disappears once it resets | @@ -56,6 +56,8 @@ scrape. | `github_workflow_runs_total` | `repo`, `workflow`, `conclusion` | Counter: completed workflow runs, once per run attempt | | `github_repo_dependabot_alerts_open` | `repo`, `severity` | Open Dependabot alerts by severity. Absent for a severity with zero open alerts | +> **Renamed:** `github_org_repos_total` is now `github_org_repos` (it is a gauge, and `_total` is reserved for counters), and `github_release_asset_downloads` is now the counter `github_release_asset_downloads_total`. Update custom queries and re-import the dashboards. + ## Run history Each org refresh lists every repo's runs created since a per-repo @@ -112,7 +114,7 @@ traffic; nothing is collected from the tracked project's users. | --- | --- | --- | | `github_adoption_up` | | 1 if the last poll succeeded, 0 if stale | | `github_repo_stars`, `_forks`, `_watchers`, `_open_issues` | `repo` | Counts; open issues exclude PRs | -| `github_release_asset_downloads` | `repo`, `tag`, `asset` | Cumulative `download_count` per release asset (drafts skipped). Chart with `increase()` | +| `github_release_asset_downloads_total` | `repo`, `tag`, `asset` | Cumulative `download_count` per release asset (drafts skipped). Chart with `increase()` | | `github_repo_traffic_ok` | `repo` | 0 if the token lacks push access, so the traffic metrics below are absent | | `github_repo_traffic_views_daily`, `_view_uniques_daily`, `_clones_daily`, `_clone_uniques_daily` | `repo`, `date` | One series per UTC day; today's is partial | | `github_repo_traffic_referrer_views`, `_referrer_uniques` | `repo`, `referrer` | Top 10 referrers, last 14 days | diff --git a/dashboards/github-actions-runner-exporter.json b/dashboards/github-actions-runner-exporter.json index 46ec134..fd3c06d 100644 --- a/dashboards/github-actions-runner-exporter.json +++ b/dashboards/github-actions-runner-exporter.json @@ -601,7 +601,7 @@ }, "targets": [ { - "expr": "max by (visibility) (github_org_repos_total{visibility=\"public\"})", + "expr": "max by (visibility) (github_org_repos{visibility=\"public\"})", "instant": true, "range": false, "refId": "A" @@ -629,7 +629,7 @@ }, "targets": [ { - "expr": "max by (visibility) (github_org_repos_total{visibility=\"private\"})", + "expr": "max by (visibility) (github_org_repos{visibility=\"private\"})", "instant": true, "range": false, "refId": "A" diff --git a/dashboards/github-repo-traffic-downloads.json b/dashboards/github-repo-traffic-downloads.json index 30f454c..1052e82 100644 --- a/dashboards/github-repo-traffic-downloads.json +++ b/dashboards/github-repo-traffic-downloads.json @@ -308,7 +308,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "sum(github_release_asset_downloads{repo=~\"$repo\",asset!~\".*(checksums|\\\\.sbom|\\\\.sig|\\\\.pem|\\\\.json).*\"})", + "expr": "sum(github_release_asset_downloads_total{repo=~\"$repo\",asset!~\".*(checksums|\\\\.sbom|\\\\.sig|\\\\.pem|\\\\.json).*\"})", "instant": true, "range": false } @@ -355,7 +355,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "sum(increase(github_release_asset_downloads{repo=~\"$repo\",asset!~\".*(checksums|\\\\.sbom|\\\\.sig|\\\\.pem|\\\\.json).*\"}[$__range]))", + "expr": "sum(increase(github_release_asset_downloads_total{repo=~\"$repo\",asset!~\".*(checksums|\\\\.sbom|\\\\.sig|\\\\.pem|\\\\.json).*\"}[$__range]))", "instant": true, "range": false } @@ -415,7 +415,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "sum by (asset) (label_replace(increase(github_release_asset_downloads{repo=~\"$repo\",asset!~\".*(checksums|\\\\.sbom|\\\\.sig|\\\\.pem|\\\\.json).*\"}[1d]), \"asset\", \"$1$2\", \"asset\", \"(.*?)[_-]v?[0-9]+\\\\.[0-9]+\\\\.[0-9]+(.*)\"))", + "expr": "sum by (asset) (label_replace(increase(github_release_asset_downloads_total{repo=~\"$repo\",asset!~\".*(checksums|\\\\.sbom|\\\\.sig|\\\\.pem|\\\\.json).*\"}[1d]), \"asset\", \"$1$2\", \"asset\", \"(.*?)[_-]v?[0-9]+\\\\.[0-9]+\\\\.[0-9]+(.*)\"))", "legendFormat": "{{asset}}" } ], @@ -465,7 +465,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "sum by (tag) (github_release_asset_downloads{repo=~\"$repo\",asset!~\".*(checksums|\\\\.sbom|\\\\.sig|\\\\.pem|\\\\.json).*\"})", + "expr": "sum by (tag) (github_release_asset_downloads_total{repo=~\"$repo\",asset!~\".*(checksums|\\\\.sbom|\\\\.sig|\\\\.pem|\\\\.json).*\"})", "instant": true, "range": false, "format": "table" @@ -534,7 +534,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "sum by (tag, asset) (github_release_asset_downloads{repo=~\"$repo\"})", + "expr": "sum by (tag, asset) (github_release_asset_downloads_total{repo=~\"$repo\"})", "instant": true, "range": false, "format": "table" diff --git a/internal/collector/adoption.go b/internal/collector/adoption.go index dbf5178..eeb1c28 100644 --- a/internal/collector/adoption.go +++ b/internal/collector/adoption.go @@ -35,7 +35,7 @@ func NewAdoption(f *fetch.Fetcher[adoption.Summary], ttl time.Duration) *Adoptio forks: d("repo", "forks", "Forks.", "repo"), watchers: d("repo", "watchers", "Watchers (subscribers).", "repo"), openIssues: d("repo", "open_issues", "Open issues, excluding pull requests.", "repo"), - downloads: d("release", "asset_downloads", "Cumulative download count of a release asset. Chart with increase(), not raw.", + downloads: d("release", "asset_downloads_total", "Cumulative download count of a release asset. Chart with increase(), not raw.", "repo", "tag", "asset"), trafficOK: d("repo", "traffic_ok", "Whether the traffic API answered (1) or the token lacks push access (0).", "repo"), @@ -79,7 +79,7 @@ func (a *Adoption) Collect(ch chan<- prometheus.Metric) { g(a.watchers, float64(r.Watchers), r.Name) g(a.openIssues, float64(r.OpenIssues), r.Name) for _, x := range r.Downloads { - g(a.downloads, float64(x.Count), r.Name, x.Tag, x.Asset) + ch <- prometheus.MustNewConstMetric(a.downloads, prometheus.CounterValue, float64(x.Count), r.Name, x.Tag, x.Asset) } if !r.TrafficOK { diff --git a/internal/collector/collector.go b/internal/collector/collector.go index 4d1bc71..e8f076d 100644 --- a/internal/collector/collector.go +++ b/internal/collector/collector.go @@ -64,7 +64,7 @@ func New(org string, runnerFetcher *fetch.Fetcher[runners.Summary], orgFetcher * // lets dashboards build github.com links without a hand-set variable orgInfo: desc("org", "info", "Always 1; the GitHub org this exporter watches is in the org label.", []string{"org"}), - reposTotal: desc("org", "repos_total", + reposTotal: desc("org", "repos", "Number of non-archived repos in the org."+orgNote, []string{"visibility"}), rateLimit: desc("rate_limit", "remaining", "Remaining core API rate-limit budget, as of the latest GitHub response.", nil),