Documentation
¶
Overview ¶
Package papdashboard forwards taskqueue facts to a PapDashboard instance: a dead-lettered task becomes an alert (alert.triggered), and if the task later completes (e.g. after tq dlq --rescue), that alert is resolved (alert.resolved). The bridge consumes the same journal seam as tq tail, so it works against any Store and never mutates queue state.
Delivery semantics: at-least-once within a bridge process lifetime — the journal watermark only advances after PapDashboard accepts a fact, and the Idempotency-Key header (derived from the fact sequence) makes retries safe. Across restarts the bridge starts at the journal head: incidents that fired while the bridge was down are not replayed (review them with tq dlq); a completion that would resolve a pre-restart alert is not seen, so those alerts stay open for a human.
Index ¶
Constants ¶
const DefaultPollInterval = 5 * time.Second
DefaultPollInterval is how often the journal is tailed.
const SourceApp = "go-taskqueue"
SourceApp is the default sourceApp stamped on ingested alerts.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
Bridge tails the taskqueue journal and mirrors dead-letter incidents into PapDashboard alerts.
func New ¶
func New(store FactSource, cfg Config) *Bridge
New builds a Bridge. Call Run to start tailing.
type Config ¶
type Config struct {
// Endpoint is PapDashboard's base URL, e.g. http://localhost:8080.
Endpoint string
// APIKey is the Bearer token protecting PapDashboard's ingest route.
APIKey string
// SourceApp overrides the default sourceApp ("go-taskqueue").
SourceApp string
// Severity is the alert severity for dead-lettered tasks.
// Default "critical".
Severity string
// PollInterval tails the journal this often. Default 5s.
PollInterval time.Duration
// FromSeq, when set, starts forwarding AFTER this fact sequence instead
// of the journal head (replay mode).
FromSeq *int64
// Client overrides the HTTP client.
Client *http.Client
// Logger receives bridge diagnostics. Default slog.Default().
Logger *slog.Logger
}
Config controls a Bridge. Endpoint and APIKey come from the PapDashboard deployment (its public /api/ingest route and the PAP_API_KEY value).