From 0b19fe83195b76928387423d4f7eefe555c91112 Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Sun, 12 Apr 2026 18:35:29 +0200 Subject: [PATCH] fix: update UI metric names from JMX to Micrometer convention MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Agent team migrated from JMX to Micrometer metrics. Update the 5 hardcoded metric names in AgentInstance.tsx JVM charts: - jvm.cpu.process → process.cpu.usage.value - jvm.memory.heap.used → jvm.memory.used.value - jvm.memory.heap.max → jvm.memory.max.value - jvm.threads.count → jvm.threads.live.value - jvm.gc.time → jvm.gc.pause.total_time Server backend is unaffected (generic MetricsSnapshot storage). CLAUDE.md updated with full agent metric name reference. Co-Authored-By: Claude Opus 4.6 (1M context) --- CLAUDE.md | 41 +++++++++++++++++++- ui/src/pages/AgentInstance/AgentInstance.tsx | 18 ++++----- 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 6a25c07a..cdae314a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -335,6 +335,45 @@ Server exposes `/api/v1/prometheus` (unauthenticated, Prometheus text format). S All containers also get `prometheus.scrape=true`. These labels enable Prometheus `docker_sd_configs` auto-discovery. +### Agent Metric Names (Micrometer) + +Agents send `MetricsSnapshot` records with Micrometer-convention metric names. The server stores them generically (ClickHouse `agent_metrics.metric_name`). The UI references specific names in `AgentInstance.tsx` for JVM charts. + +**JVM metrics (used by UI):** + +| Metric name | UI usage | +|---|---| +| `process.cpu.usage.value` | CPU % stat card + chart | +| `jvm.memory.used.value` | Heap MB stat card + chart (tags: `area=heap`) | +| `jvm.memory.max.value` | Heap max for % calculation (tags: `area=heap`) | +| `jvm.threads.live.value` | Thread count chart | +| `jvm.gc.pause.total_time` | GC time chart | + +**Camel route metrics (stored, queried by dashboard):** + +| Metric name | Type | Tags | +|---|---|---| +| `camel.exchanges.succeeded.count` | counter | `routeId`, `camelContext` | +| `camel.exchanges.failed.count` | counter | `routeId`, `camelContext` | +| `camel.exchanges.total.count` | counter | `routeId`, `camelContext` | +| `camel.exchanges.failures.handled.count` | counter | `routeId`, `camelContext` | +| `camel.route.policy.count` | count | `routeId`, `camelContext` | +| `camel.route.policy.total_time` | total | `routeId`, `camelContext` | +| `camel.route.policy.max` | gauge | `routeId`, `camelContext` | +| `camel.routes.running.value` | gauge | — | + +Mean processing time = `camel.route.policy.total_time / camel.route.policy.count`. Min processing time is not available (Micrometer does not track minimums). + +**Cameleer agent metrics:** + +| Metric name | Type | Tags | +|---|---|---| +| `cameleer.chunks.exported.count` | counter | `instanceId` | +| `cameleer.chunks.dropped.count` | counter | `instanceId`, `reason` | +| `cameleer.sse.reconnects.count` | counter | `instanceId` | +| `cameleer.taps.evaluated.count` | counter | `instanceId` | +| `cameleer.metrics.exported.count` | counter | `instanceId` | + ## Disabled Skills - Do NOT use any `gsd:*` skills in this project. This includes all `/gsd:` prefixed commands. @@ -342,7 +381,7 @@ All containers also get `prometheus.scrape=true`. These labels enable Prometheus # GitNexus — Code Intelligence -This project is indexed by GitNexus as **cameleer3-server** (6012 symbols, 15283 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. +This project is indexed by GitNexus as **cameleer3-server** (6021 symbols, 15284 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. > If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first. diff --git a/ui/src/pages/AgentInstance/AgentInstance.tsx b/ui/src/pages/AgentInstance/AgentInstance.tsx index a1dfe6c3..5e0b6987 100644 --- a/ui/src/pages/AgentInstance/AgentInstance.tsx +++ b/ui/src/pages/AgentInstance/AgentInstance.tsx @@ -57,18 +57,18 @@ export default function AgentInstance() { // Stat card metrics (latest 1 bucket) const { data: latestMetrics } = useAgentMetrics( agent?.instanceId || null, - ['jvm.cpu.process', 'jvm.memory.heap.used', 'jvm.memory.heap.max'], + ['process.cpu.usage.value', 'jvm.memory.used.value', 'jvm.memory.max.value'], 1, ); - const cpuPct = latestMetrics?.metrics?.['jvm.cpu.process']?.[0]?.value; - const heapUsed = latestMetrics?.metrics?.['jvm.memory.heap.used']?.[0]?.value; - const heapMax = latestMetrics?.metrics?.['jvm.memory.heap.max']?.[0]?.value; + const cpuPct = latestMetrics?.metrics?.['process.cpu.usage.value']?.[0]?.value; + const heapUsed = latestMetrics?.metrics?.['jvm.memory.used.value']?.[0]?.value; + const heapMax = latestMetrics?.metrics?.['jvm.memory.max.value']?.[0]?.value; const memPct = heapMax ? (heapUsed! / heapMax) * 100 : undefined; // Chart metrics (60 buckets) const { data: jvmMetrics } = useAgentMetrics( agent?.instanceId || null, - ['jvm.cpu.process', 'jvm.memory.heap.used', 'jvm.memory.heap.max', 'jvm.threads.count', 'jvm.gc.time'], + ['process.cpu.usage.value', 'jvm.memory.used.value', 'jvm.memory.max.value', 'jvm.threads.live.value', 'jvm.gc.pause.total_time'], 60, ); @@ -102,25 +102,25 @@ export default function AgentInstance() { // JVM chart series helpers const cpuSeries = useMemo(() => { - const pts = jvmMetrics?.metrics?.['jvm.cpu.process']; + const pts = jvmMetrics?.metrics?.['process.cpu.usage.value']; if (!pts?.length) return null; return [{ label: 'CPU %', data: pts.map((p: any, i: number) => ({ x: i, y: p.value * 100 })) }]; }, [jvmMetrics]); const heapSeries = useMemo(() => { - const pts = jvmMetrics?.metrics?.['jvm.memory.heap.used']; + const pts = jvmMetrics?.metrics?.['jvm.memory.used.value']; if (!pts?.length) return null; return [{ label: 'Heap MB', data: pts.map((p: any, i: number) => ({ x: i, y: p.value / (1024 * 1024) })) }]; }, [jvmMetrics]); const threadSeries = useMemo(() => { - const pts = jvmMetrics?.metrics?.['jvm.threads.count']; + const pts = jvmMetrics?.metrics?.['jvm.threads.live.value']; if (!pts?.length) return null; return [{ label: 'Threads', data: pts.map((p: any, i: number) => ({ x: i, y: p.value })) }]; }, [jvmMetrics]); const gcSeries = useMemo(() => { - const pts = jvmMetrics?.metrics?.['jvm.gc.time']; + const pts = jvmMetrics?.metrics?.['jvm.gc.pause.total_time']; if (!pts?.length) return null; return [{ label: 'GC ms', data: pts.map((p: any, i: number) => ({ x: String(i), y: p.value })) }]; }, [jvmMetrics]);