UNPKG

@inso_web/els-mcp

Version:

MCP-сервер поверх INSO Error Logs Service. Read-only tools (search, analytics, fingerprinting, correlations) для подключения Claude Desktop/Code и ChatGPT к логам ошибок. Streamable HTTP transport + stdio для npx-запуска.

49 lines 3.3 kB
import { Registry, Counter, Histogram, Gauge } from 'prom-client'; /** * Prometheus metrics для MCP-сервера. * * Источник истины по именам — `todo/error-logs-service/mcp/07-observability.md` * § 1. Категории: * - RED (rate / errors / duration) — `mcp_requests_total`, `mcp_request_duration_seconds`, `mcp_errors_total` * - Cache — `mcp_cache_hits_total`, `mcp_cache_misses_total`, `mcp_cache_hit_ratio` * - Upstream (ELS) — `mcp_els_upstream_errors_total` * - SSE / sessions — `mcp_sse_connections_active` * - Security — `mcp_redaction_applied_total` * - Billing — `mcp_billing_events_total` * * Регистр — singleton (один на процесс). Endpoint `/els/metrics` сериализует * текущее состояние в Prometheus text format. */ export declare const registry: Registry<"text/plain; version=0.0.4; charset=utf-8">; export declare const mcpRequestsTotal: Counter<"status" | "tool" | "cached">; export declare const mcpRequestDuration: Histogram<"tool">; export declare const mcpErrorsTotal: Counter<"code" | "tool">; export declare const mcpCacheHitsTotal: Counter<"tool_class">; export declare const mcpCacheMissesTotal: Counter<"tool_class">; export declare const mcpCacheHitRatio: Gauge<"tool_class">; export declare const mcpElsUpstreamErrorsTotal: Counter<"endpoint" | "status">; export declare const mcpSseConnectionsActive: Gauge<string>; export declare const mcpRedactionAppliedTotal: Counter<"field">; export declare const mcpAuthRejectionsTotal: Counter<"reason">; export declare const mcpPromptInjectionBlockedTotal: Counter<"rule">; export declare const mcpSseConnectionsActiveByApp: Gauge<"appSlug">; export declare const mcpSseRejectionsTotal: Counter<"reason" | "appSlug">; export declare const mcpBillingEventsTotal: Counter<"appSlug" | "tier">; export declare function recordCacheHit(toolClass: string): void; export declare function recordCacheMiss(toolClass: string): void; export declare function recordToolRequest(tool: string, status: 'ok' | 'error' | 'timeout', cached: boolean, durationSec: number): void; export declare function recordToolError(tool: string, code: string): void; export declare function recordUpstreamError(endpoint: string, status: number | string): void; export declare function recordRedaction(field: string): void; export declare function recordBillingEvent(appSlug: string, tier: string): void; export declare function recordAuthRejection(reason: string): void; export declare function recordPromptInjectionBlocked(rule: string): void; export declare function incSseActive(appSlug: string): void; export declare function decSseActive(appSlug: string): void; export declare function recordSseRejection(reason: string, appSlug: string): void; /** Сброс per-process состояния (для тестов). */ export declare function resetMetricsForTests(): void; /** Сериализация в Prometheus text format. */ export declare function getMetricsText(): Promise<string>; export declare function getMetricsContentType(): string; //# sourceMappingURL=metrics.d.ts.map