Watch
0
0
Fork
You've already forked hyperhive
0

swarm-controller: count default-branch merges and lines per repo

This commit is contained in:
atlas 2026-11-08 12:08:46 +01:00 • committed by mara
commit 2e23f3debf

View file

@ -580,6 +580,27 @@ store either a commit or a push anywhere as a row to count.
| `hyperhive.vcs.commit.count` | — | counter | `repo` (`org/repo`) |
| `hyperhive.vcs.push.count` | — | counter | `repo` (`org/repo`) |
Three more counters count what lands on each repo's default branch. A push
to any other ref adds nothing to them, and neither does deleting the default
branch.
| Metric | Unit | Kind | Attributes |
| -------------------------------------------- | ---- | ------- | ------------------- |
| `hyperhive.vcs.default_branch.merges` | — | counter | `repo` (`org/repo`) |
| `hyperhive.vcs.default_branch.lines_added` | — | counter | `repo` (`org/repo`) |
| `hyperhive.vcs.default_branch.lines_deleted` | — | counter | `repo` (`org/repo`) |
`merges` counts every such push. The line counters sum the per-commit stats
of the forge's compare of the push's `before...after`, so a line one commit
adds and a later one removes counts in both. A push that creates the branch
has no `before` and adds to `merges` only. When the compare fails,
`swarm-controller` logs a warning and the push adds to `merges` only. A
force-push counts the commits the compare returns, which are those reachable
from the new tip and not the old one; the commits it discards aren't
subtracted. The compare runs after the webhook has answered, so a slow forge
never delays a delivery. The counters start at zero on deploy and aren't
backfilled. The forge dashboard's content tab charts them per repo.
A push with zero commits (a branch delete, or a force-push that doesn't add
new commits) still increments `push.count`; `commit.count` only advances
when the delivery actually carries commits. Same enable signal (`OTEL_EXPORTER_OTLP_ENDPOINT`), fixed 60s cadence