/** * SMI-1018: Prometheus Metrics Exporter * * Exports Skillsmith metrics in Prometheus text exposition format. * Integrates with existing MetricsRegistry for monitoring dashboards. * * @see https://prometheus.io/docs/instrumenting/exposition_formats/ */ import type { MetricsSnapshot } from './metrics.js'; /** * Prometheus export options */ export interface PrometheusExportOptions { /** Include TYPE and HELP comments (default: true) */ includeMetadata?: boolean; /** Prefix for all metric names (default: none) */ prefix?: string; /** Custom labels to add to all metrics */ globalLabels?: Record; /** Timestamp for all metrics (epoch ms, default: current time) */ timestamp?: number; } /** * Export metrics snapshot to Prometheus text format * * @param snapshot - Metrics snapshot from MetricsRegistry.getSnapshot() * @param options - Export options * @returns Prometheus text exposition format string * * @example * ```typescript * const metrics = getMetrics() * const snapshot = metrics.getSnapshot() * const prometheusText = exportToPrometheus(snapshot) * // Returns: * // # HELP skillsmith_mcp_request_total Total number of MCP tool requests * // # TYPE skillsmith_mcp_request_total counter * // skillsmith_mcp_request_total 42 * ``` */ export declare function exportToPrometheus(snapshot: MetricsSnapshot, options?: PrometheusExportOptions): string; /** * Get current metrics in Prometheus format * Convenience function that combines getSnapshot() and exportToPrometheus() * * @param options - Export options * @returns Prometheus text exposition format string * * @example * ```typescript * // In an HTTP handler: * app.get('/metrics', (req, res) => { * res.set('Content-Type', 'text/plain; version=0.0.4') * res.send(getPrometheusMetrics()) * }) * ``` */ export declare function getPrometheusMetrics(options?: PrometheusExportOptions): string; /** * Prometheus HTTP endpoint handler * * Creates a handler function suitable for Express/Koa/etc. * * @param options - Export options * @returns Handler function (req, res) => void * * @example * ```typescript * // Express * import express from 'express' * import { createPrometheusHandler } from '@skillsmith/core' * * const app = express() * app.get('/metrics', createPrometheusHandler()) * ``` */ export declare function createPrometheusHandler(options?: PrometheusExportOptions): (req: unknown, res: { set: (k: string, v: string) => void; send: (body: string) => void; }) => void; //# sourceMappingURL=prometheus.d.ts.map