syncguard
Version:
Functional TypeScript library for distributed locking across microservices. Prevents race conditions with Redis, PostgreSQL, Firestore, and custom backends. Features automatic lock management, timeout handling, and extensible architecture.
13 lines (12 loc) • 657 B
TypeScript
import type { BackendCapabilities, LockBackend, TelemetryOptions } from "./types.js";
/**
* Wraps a LockBackend with telemetry hooks for observability.
* Zero-cost abstraction: no performance impact when not used.
*
* @param backend - Base backend to instrument
* @param options - Telemetry configuration with event callback
* @returns Instrumented backend with same capabilities
* @see docs/specs/interface.md Usage patterns and examples
* @see docs/adr/007-opt-in-telemetry.md for opt-in design rationale
*/
export declare function withTelemetry<C extends BackendCapabilities>(backend: LockBackend<C>, options: TelemetryOptions): LockBackend<C>;