Observability
KeySpot includes three tracing tiers — from zero-overhead noop to full OpenTelemetry.
ConsoleTracer
import { ConsoleTracer, setGlobalTracer } from '@roadsidelab/keyspot-sdk';
setGlobalTracer(new ConsoleTracer('keyspot'));
// Logs span start/end with duration in milliseconds
KeySpotTracer
Wraps core operations (checkpoint, scan, vault.write) with span timing. Active by default — falls back to a noop tracer if none is configured.
OtelTracer
Auto-bridges to @opentelemetry/api when available. Spans are exported as keyspot.{operation}.
const guard = new KeySpot({
enableOpenTelemetry: true,
});
Span Interface
interface Span {
end(): void;
setAttribute(key: string, value: string | number | boolean): void;
addEvent(name: string, attributes?: Record<string, unknown>): void;
}
Server Metrics (Prometheus)
The @roadsidelab/keyspot-server package exposes Prometheus-format metrics at /metrics:
checkpoint_total— checkpoint countcheckpoint_duration_ms— checkpoint latency histogramscan_total— scan countsecrets_found_total— secrets detectedvault_writes_total— vault writesprompt_validation_total— PromptShield evaluationshttp_request_duration_ms— HTTP request latency