Skip to main content

Module telemetry

Module telemetry 

Source
Expand description

Solver telemetry — structured event hooks for external analytics.

The solver chain already logs to tracing and updates the [PatternStore] for routing decisions, but neither is suitable for durable metrics: tracing output is operator-facing text, and the pattern store is a learned-routing cache that prunes old entries. Production users want to know per-solver success rates, p50/p95 solve times, fallback rates per domain, and time-series trends.

SolverTelemetry is a tiny trait the chain calls at every solver-attempt outcome. The default implementation is a no-op, so adding telemetry is opt-in: pass an Arc<dyn SolverTelemetry> via [CaptchaSolverChain::with_telemetry] and your impl receives every event.

Implementations are free to: write to Prometheus, push to a statsd/OTel collector, batch into SQLite, post to Sentry, mirror into the pattern store, or ignore the events entirely. The trait is intentionally allocation-light — events borrow strings where possible — so a high-throughput impl can avoid heap churn.

Structs§

NoopTelemetry
Default zero-overhead implementation — drops every event.
SolveEvent
One solver attempt’s telemetry event. Borrowed where possible so hot-path implementations can avoid allocation.

Enums§

SolveOutcome
What happened during a single solver attempt.

Traits§

SolverTelemetry
Hook the solver chain calls at every attempt outcome.