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

36 lines (35 loc) 1.39 kB
/** * GrafanaClientRegistry — manages named GrafanaClient instances. * * Replaces the pattern of each tool factory creating its own GrafanaClient. * Clients are created once at startup and looked up by name at tool-call time. * * For single-instance setups, `get()` with no argument returns the sole client. * For multi-instance setups, `get("prod")` targets a specific instance while * `get()` returns the configured default. */ import { GrafanaClient } from "./grafana-client.js"; import type { ValidatedGrafanaLensConfig } from "./config.js"; export type InstanceInfo = { name: string; url: string; isDefault: boolean; }; export declare class GrafanaClientRegistry { private clients; private defaultName; constructor(config: ValidatedGrafanaLensConfig); /** * Get a client by instance name. Pass `undefined` or omit for the default. * Throws with available instance names if the name is unknown. */ get(name?: string): GrafanaClient; /** Name of the default instance. */ getDefaultName(): string; /** All registered instances with metadata for agent discovery. */ listInstances(): InstanceInfo[]; /** True when more than one instance is configured. */ isMultiInstance(): boolean; /** Human-readable list of instance names for error messages and descriptions. */ formatInstanceNames(): string; }