feat(metrics): record eventsourced pg outbox publishes and retries (#182)
Unbound Release / Check Preconditions (push) Successful in 22s
Unbound Release / Create Tag (push) Skipped
Unbound Release / Create Release (push) Successful in 23s
otelsetup / test (push) Successful in 58s
otelsetup / vulnerabilities (push) Successful in 53s
Unbound Release / Generate Changelog and Handle PR (push) Successful in 37s
Release / release (push) Successful in 1m2s
pre-commit / pre-commit (push) Successful in 2m45s
Unbound Release / Check Preconditions (push) Successful in 22s
Unbound Release / Create Tag (push) Skipped
Unbound Release / Create Release (push) Successful in 23s
otelsetup / test (push) Successful in 58s
otelsetup / vulnerabilities (push) Successful in 53s
Unbound Release / Generate Changelog and Handle PR (push) Successful in 37s
Release / release (push) Successful in 1m2s
pre-commit / pre-commit (push) Successful in 2m45s
## 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 Reviewed-on: https://gitea.unbound.se/shiny/otelsetup/pulls/182
This commit was merged in pull request #182.
This commit is contained in:
1 parent
e9a2dcf720
commit
88dde56687
4 files changed
+79
-9
No files matched your search
@@ -7,6 +7,7 @@ import (
|
||||
"time"
|
||||
|
||||
"codeberg.org/eventsourced/eventsourced"
|
||||
"codeberg.org/eventsourced/pg/v2"
|
||||
"go.opentelemetry.io/otel"
|
||||
sdkmetric "go.opentelemetry.io/otel/sdk/metric"
|
||||
"go.opentelemetry.io/otel/sdk/metric/metricdata"
|
||||
@@ -33,6 +34,8 @@ func TestNewEventsourcedMetrics_RecordsContract(t *testing.T) {
|
||||
eventsourced.SnapshotStored{AggregateType: "Entry", Duration: time.Millisecond, Success: true},
|
||||
eventsourced.SnapshotLoaded{AggregateType: "Entry", Found: false, Duration: time.Millisecond},
|
||||
eventsourced.IdempotencyCheck{AggregateType: "Entry", Hit: true},
|
||||
pg.OutboxPublish{EventType: "EntryAdded", Success: false, Duration: time.Millisecond},
|
||||
pg.OutboxRetry{EventType: "EntryAdded", RetryCount: 1},
|
||||
unknownMetric{},
|
||||
} {
|
||||
r.Record(context.Background(), m)
|
||||
@@ -57,6 +60,8 @@ func TestNewEventsourcedMetrics_RecordsContract(t *testing.T) {
|
||||
"eventsourced.snapshot.store.duration",
|
||||
"eventsourced.snapshot.load.duration",
|
||||
"eventsourced.idempotency.checks",
|
||||
"eventsourced.outbox.publish.duration",
|
||||
"eventsourced.outbox.retries",
|
||||
}
|
||||
var missing []string
|
||||
for _, w := range want {
|
||||
|
||||
Reference in new issue
Block a user