Repository navigation
Add Datadog GitHub health metrics sync - #61
Merged
Merged
Conversation
pront
approved these changes
Sep 1, 2026
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
push-metricsto produce repository-health gauge snapshots for Datadogcreated_atandclosed_atdatasync-metricsto fetch a complete GitHub snapshot into temporary local storage, rebuild the database, and produce metrics--output-jsonso a Datadog workflow can submit size-safe/api/v2/seriesbodies through its managed HTTP connectiongithub.health.v2metric namespace and document the backfill/update procedureThis is a separate implementation that builds on and supersedes the direction explored in #15; it does not modify or close that PR.
Historical behavior
lookback/historycontrols the period reconstructed at daily UTC timestamps.activity_windowindependently controls the rolling period summarized by closed-item metrics. Everysync-metricsrun performs a complete GitHub fetch into temporary storage, so correctness does not depend on persisting refreshed snapshots in this repository.Recommended operation for a new metric prefix:
github.health.v2in Datadog.Backlog membership is reconstructed from
created_atandclosed_at. Historical labels, issue types, PR draft transitions, discussion categories/answer state, and close/reopen cycles use the latest fetched state because GitHub's current-item snapshot does not contain complete timelines for those dimensions. A future incompatible dimension change should use a new prefix version rather than rewriting the existing namespace.Metrics
All metrics are gauges and use deterministic, deduplicated tag ordering. Dashboard totals should use
sum:, because each metric is split into dimension-specific series.github.health.v2.issues— open issues at each snapshotgithub.health.v2.prs— open, non-draft pull requests at each snapshotgithub.health.v2.discussions— open discussions at each snapshotgithub.health.v2.issues.closed— issues closed in the rolling activity window ending at each snapshotgithub.health.v2.prs.closed— pull requests closed or merged in the rolling activity window ending at each snapshotgithub.health.v2.discussions.closed— discussions closed in the rolling activity window ending at each snapshotClosed metrics are sparse and are omitted when no matching item closed in the selected activity window.
Datadog Workflow behavior
The repository does not contain a GitHub composite action or shell wrapper for synchronization. Datadog Workflow Automation owns the trigger and schedule.
Run
github-tools sync-metrics ... --output-jsonfrom Bits Code. The command performs the temporary fetch and reconstruction, then emits a compact JSON envelope withbatches. Each batch is an exact request body forPOST /api/v2/series; the workflow submits it through the managed Datadog Metrics API connection.--output-jsonnever reads a Datadog API key or submits metrics itself. Without that flag, direct CLI submission remains available for local use.Simplification and review pass
MetricsOptionsstruct--activity-windowname in both metric commandsVerification
cargo test --locked— 6 tests passedcargo clippy --locked --all-targets -- -D warnings -A clippy::unnecessary-sort-by— passed (the allowed lint is pre-existing in chart generation code)git diff --check— passedgithub.health.v2.*series, with the expected Datadog{ "series": [...] }request shapeA previous full run produced Quickwit metrics visible in this dashboard.