UNPKG

@gati-framework/runtime

Version:

Gati runtime execution engine for running handler-based applications

40 lines 1.17 kB
/** * @module runtime/observability-factory * @description Factory for creating observability providers */ /** * Adapter that wraps IMetricsProvider to implement MetricsClient interface */ export class MetricsClientAdapter { provider; constructor(provider) { this.provider = provider; } incrementCounter(name, labels, value) { this.provider.incrementCounter(name, labels, value); } setGauge(name, value, labels) { this.provider.setGauge(name, value, labels); } recordHistogram(name, value, labels) { this.provider.recordHistogram(name, value, labels); } createSpan() { return { end: () => { }, setStatus: () => { }, recordException: () => { }, spanContext: () => ({}) }; } async withSpan(name, fn) { return fn(this.createSpan()); } logWithContext() { } recordAudit() { } } /** * Create metrics client from configuration */ export function createMetricsClient(config) { if (config?.metrics?.provider) { return new MetricsClientAdapter(config.metrics.provider); } return undefined; } //# sourceMappingURL=observability-factory.js.map