import type { Request, Response, NextFunction } from 'express'; import { Registry, Gauge } from 'prom-client'; /** * Register the `secret_rotation_previous_set{secret}` gauge on `registry`: 1 * while a secret's `*_PREVIOUS` rotation value is still set, 0 otherwise. The * value is read from api-core's probe registry at scrape time, so it always * reflects the live process. Exported so platform (own registry) exposes the * identical series; the `SecretRotationPreviousLingering` alert keys on it. */ export declare function registerSecretRotationGauge(registry: Registry): Gauge<'secret'>; /** * Express middleware that records request duration and count. * * Must be registered before route handlers so `res.on('finish')` fires * after the response is sent. */ export declare function metricsMiddleware(): (req: Request, res: Response, next: NextFunction) => void; /** * Express handler that returns Prometheus metrics in text exposition format. */ export declare function metricsHandler(): (_req: Request, res: Response) => Promise; /** * Increment a business counter, creating it on first use. * * @example * ```typescript * incCounter('pipelines_generated_total', { provider: 'anthropic' }); * incCounter('plugin_builds_total', { status: 'completed' }); * incCounter('quota_threshold_crossed_total', { type: 'aiCalls', tier: 'pro' }); * incCounter('compliance_violations_found_total', { severity: 'critical' }); * ``` */ export declare function incCounter(name: string, labels?: Record, value?: number): void; /** * Record an observation on a business histogram, creating it on first use. * Use for durations, sizes, anything where percentiles matter. * * @example * ```typescript * observe('ai_generation_duration_seconds', { provider: 'anthropic', model: 'sonnet' }, durationSec); * observe('plugin_build_duration_seconds', { buildType: 'docker' }, durationSec); * ``` */ export declare function observe(name: string, labels: Record, value: number): void; /** * Set the value of a business gauge, creating it on first use. Use for * point-in-time observations sampled by a scraper — queue depth, active * connection counts, in-flight requests. * * @example * ```typescript * setGauge('plugin_queue_jobs', { queue: 'plugin-build', state: 'waiting' }, 12); * setGauge('plugin_queue_jobs', { queue: 'plugin-build', state: 'active' }, 3); * ``` */ export declare function setGauge(name: string, labels: Record, value: number): void;