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
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
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
This commit is contained in:
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