Skip to content

Structured logging with the X-GitHub-Delivery correlation id #102

Description

@BKPepe

Two independent reviews landed on the same gap: logging is bare console.log/warn/error with ad-hoc prefixes ([Stale Bot], GitHub API call failed...), and the correlation id GitHub hands us for free — the X-GitHub-Delivery header — is never read.

Proposal: one log(level, event, fields) helper emitting a single JSON object per line, which Cloudflare indexes:

{ "level": "warn", "event": "github_api_retry", "delivery": "8ad0...",
  "repo": "openwrt/packages", "pr": 1234, "installation": 456,
  "method": "GET", "endpoint": "/repos/.../commits", "status": 503,
  "attempt": 2, "budget_used": 31, "deploy": "d8f0c4e" }

Worth carrying on every line: delivery id, event/action, repo, PR or issue number, installation id, head SHA, and for API calls the operation, attempt, status and remaining budget. That turns "why did this PR behave oddly" into one filter on delivery=... covering the whole lifecycle — token, config, commits, validators, labels, comment, check-runs.

Not urgent, but it is the difference between reading logs and grepping them.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions