fix: update UI metric names from JMX to Micrometer convention
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user