Skip to content

chore(ci): track Docker Hub pulls in download stats gist#592

Merged
AbirAbbas merged 1 commit into
mainfrom
chore/track-docker-pulls-in-download-stats
May 29, 2026
Merged

chore(ci): track Docker Hub pulls in download stats gist#592
AbirAbbas merged 1 commit into
mainfrom
chore/track-docker-pulls-in-download-stats

Conversation

@santoshkumarradha
Copy link
Copy Markdown
Member

Summary

  • update-download-stats.yml (the 6-hourly job that writes the badge gist) was capturing GitHub releases / PyPI / npm but not Docker Hub.
  • As a result stats.json.sources.docker was always 0, and every analytics script that reads the gist history (e.g. marketing/analytics/gist_download_analysis.py) had no Docker series to plot.
  • Docker Hub's public API only exposes a cumulative 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:

  • Hits https://hub.docker.com/v2/repositories/agentfield/control-plane/ and reads pull_count.
  • Rolls the value into the total and into stats.json.sources.docker.
  • Wrapped in try/catch — a Docker Hub outage falls back to docker: 0 without 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

  • Validated the workflow YAML parses cleanly.
  • Ran the inline script body in Node 25 against a mocked github SDK and a live Docker Hub call:
    • Live pull_count returned: 11,298
    • Generated stats.json payload shape:
      {
        "total": 229874,
        "sources": { "github": 180, "pypi": 184754, "npm": 33642, "docker": 11298 },
        "lastUpdated": "..."
      }
    • Asserted: docker key present, numeric, total = sum of sources.

Test plan

  • Merge and either wait for the next scheduled 6h run or trigger the workflow manually via the Actions tab.
  • Confirm the new gist commit's stats.json contains sources.docker with a non-zero value.
  • Confirm marketing/analytics/gist_download_analysis.py --from-gist picks up the populated docker column on the next refresh.

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).
@santoshkumarradha santoshkumarradha requested review from a team and AbirAbbas as code owners May 26, 2026 03:22
@santoshkumarradha
Copy link
Copy Markdown
Member Author

@AbirAbbas can you validate this? Checked but not super familiar

@AbirAbbas AbirAbbas merged commit e8afb67 into main May 29, 2026
17 checks passed
@AbirAbbas AbirAbbas deleted the chore/track-docker-pulls-in-download-stats branch May 29, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants