chore(ci): track Docker Hub pulls in download stats gist#592
Merged
Conversation
The Update Download Stats workflow runs every 6 hours and snapshots binary / PyPI / npm cumulative counts into the badge gist. Docker Hub pulls were not captured, so the gist's `docker` field was always 0 and none of our analytics could reconstruct Docker history. Docker Hub only exposes a cumulative `pull_count` (no daily/historical endpoint on free tier), so the only way to build a daily series is to snapshot it ourselves. This change adds a Docker Hub fetch alongside the existing sources, includes it in `stats.json.sources.docker`, and rolls it into the displayed total. Failures are non-fatal — the workflow still updates with `docker: 0` if Docker Hub is unreachable. Verified the JS body end-to-end against a mock github SDK and a live Docker Hub call (11,298 pulls returned at time of validation).
Member
Author
|
@AbirAbbas can you validate this? Checked but not super familiar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
update-download-stats.yml(the 6-hourly job that writes the badge gist) was capturing GitHub releases / PyPI / npm but not Docker Hub.stats.json.sources.dockerwas always0, and every analytics script that reads the gist history (e.g.marketing/analytics/gist_download_analysis.py) had no Docker series to plot.pull_count— there is no daily/historical endpoint on the free tier. The only way to reconstruct a daily Docker series is to snapshot it ourselves every few hours, which is exactly what this workflow already does for every other channel.Change
Adds a Docker Hub fetch to the inline script:
https://hub.docker.com/v2/repositories/agentfield/control-plane/and readspull_count.stats.json.sources.docker.docker: 0without failing the job.After this lands, every 6-hour gist snapshot will carry a real Docker number, and the marketing analytics will be able to chart Docker pulls over time (going forward — there is no way to recover the ~5 months of pre-existing history).
Verification
githubSDK and a live Docker Hub call:pull_countreturned: 11,298stats.jsonpayload shape:{ "total": 229874, "sources": { "github": 180, "pypi": 184754, "npm": 33642, "docker": 11298 }, "lastUpdated": "..." }dockerkey present, numeric, total = sum of sources.Test plan
stats.jsoncontainssources.dockerwith a non-zero value.marketing/analytics/gist_download_analysis.py --from-gistpicks up the populateddockercolumn on the next refresh.