UNPKG

openclaw-grafana-lens

Version:

OpenClaw plugin that gives AI agents full Grafana access — 18 composable tools for PromQL/LogQL/TraceQL queries, dashboard creation, alerting, SRE investigation, security monitoring, data collection pipeline management via Grafana Alloy (29 recipes), and

31 lines (30 loc) 1.14 kB
/** * OTLP Logs Provider * * Central LoggerProvider lifecycle module. Creates an OpenTelemetry * LoggerProvider that pushes structured log records via OTLP HTTP/JSON * to the configured collector (LGTM stack, Grafana Cloud, etc.). * * Mirrors the otel-metrics.ts pattern exactly: * - Local provider only (NO global registration — avoids conflict with diagnostics-otel) * - Fire-and-forget emission via BatchLogRecordProcessor * - Same shared resource identity (service.name=openclaw, service.namespace=grafana-lens) * * Data flow: * Diagnostic events / tool calls → OTel LogRecord → OTLP exporter → Collector → Loki → Grafana */ import type { Logger } from "@opentelemetry/api-logs"; import { SeverityNumber } from "@opentelemetry/api-logs"; export { SeverityNumber }; export type OtelLogsConfig = { endpoint: string; headers?: Record<string, string>; serviceVersion?: string; serviceInstanceId?: string; }; export type OtelLogs = { logger: Logger; forceFlush(): Promise<void>; shutdown(): Promise<void>; }; export declare function createOtelLogs(config: OtelLogsConfig): OtelLogs;