feat(metrics): record eventsourced pg outbox publishes and retries #182

Merged
argoyle merged 1 commits from feat/outbox-metrics into main 2026-09-17 11:54:07 +00:00
Owner

Why

authz-service now publishes through pg/v2's transactional outbox, and nothing measured it: NewEventsourcedMetrics ignored the pg.Outbox* metrics. Without them a failing or abandoned publish (a lost privilege revocation for running authz_clients) can't be alerted on.

What

  • pg.OutboxPublish → histogram eventsourced.outbox.publish.duration (event.type, success)
  • pg.OutboxRetry → counter eventsourced.outbox.retries (event.type, permanent)
  • pg.OutboxBatch / pg.OutboxCleanup stay ignored.

otelsetup now imports codeberg.org/eventsourced/pg/v2 v2.1.1 (go directive becomes 1.26.0; grpc patch bump via MVS). All current consumers already depend on pg/v2; a release raises their minimum to v2.1.1.

Tests

go test -race ./... green; the contract test records both new metrics.

Review

Go Backend expert reviewed: no Critical/High. Noted: the test checks instrument names only, not attributes; the pg/v2 dependency is worth a line in the release notes.

🤖 Generated with Claude Code

https://claude.ai/code/session_013DJouG8ZZZxKtodF9kDvzj

## Why authz-service now publishes through pg/v2's transactional outbox, and nothing measured it: `NewEventsourcedMetrics` ignored the `pg.Outbox*` metrics. Without them a failing or abandoned publish (a lost privilege revocation for running authz_clients) can't be alerted on. ## What - `pg.OutboxPublish` → histogram `eventsourced.outbox.publish.duration` (`event.type`, `success`) - `pg.OutboxRetry` → counter `eventsourced.outbox.retries` (`event.type`, `permanent`) - `pg.OutboxBatch` / `pg.OutboxCleanup` stay ignored. otelsetup now imports `codeberg.org/eventsourced/pg/v2` v2.1.1 (`go` directive becomes 1.26.0; grpc patch bump via MVS). All current consumers already depend on pg/v2; a release raises their minimum to v2.1.1. ## Tests `go test -race ./...` green; the contract test records both new metrics. ## Review Go Backend expert reviewed: no Critical/High. Noted: the test checks instrument names only, not attributes; the pg/v2 dependency is worth a line in the release notes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_013DJouG8ZZZxKtodF9kDvzj
argoyle added 1 commit 2026-09-17 11:48:21 +00:00
feat(metrics): record eventsourced pg outbox publishes and retries
otelsetup / test (push) Skipped
otelsetup / vulnerabilities (push) Skipped
pre-commit / pre-commit (push) Skipped
otelsetup / vulnerabilities (pull_request) Successful in 53s
otelsetup / test (pull_request) Successful in 1m9s
pre-commit / pre-commit (pull_request) Successful in 2m48s
bbf27f9089
NewEventsourcedMetrics now handles pg.OutboxPublish (eventsourced.outbox.publish.duration, by event.type and success) and pg.OutboxRetry (eventsourced.outbox.retries, by event.type and permanent), so a service using the pg/v2 outbox can alert on failing or abandoned publishes. OutboxBatch and OutboxCleanup stay ignored.

otelsetup now imports codeberg.org/eventsourced/pg/v2 (v2.1.1). Every current consumer already depends on it; a release raises their minimum to v2.1.1.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013DJouG8ZZZxKtodF9kDvzj
argoyle scheduled this pull request to auto merge when all checks succeed 2026-09-17 11:50:53 +00:00

Coverage Report

Total coverage: 22%

## Coverage Report Total coverage: **22%**
argoyle merged commit 88dde56687 into main 2026-09-17 11:54:07 +00:00
argoyle deleted branch feat/outbox-metrics 2026-09-17 11:54:08 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shiny/otelsetup#182