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
18 lines (17 loc) • 744 B
JavaScript
/**
* Shared OTel Resource construction for all signal providers.
*
* Centralizes the Resource identity (service.name, service.namespace,
* service.version, service.instance.id) so that adding a new attribute
* requires touching one file instead of three.
*/
import { Resource } from "@opentelemetry/resources";
import { ATTR_SERVICE_NAME } from "@opentelemetry/semantic-conventions";
export function createOtelResource(config) {
return new Resource({
[ATTR_SERVICE_NAME]: "openclaw",
"service.namespace": "grafana-lens",
...(config.serviceVersion ? { "service.version": config.serviceVersion } : {}),
...(config.serviceInstanceId ? { "service.instance.id": config.serviceInstanceId } : {}),
});
}