feat: add Metrics page, remove app bar badge, fix sidebar label

- Add src/api/metrics.ts: Prometheus text parser + fetchGpuPluginMetrics()
  fetching from Intel GPU device plugin pods (port 9090). Extracts engine
  utilization (active/total ticks → %), boost frequency (MHz), VRAM and
  system memory usage, cumulative energy (µJ).

- Add src/components/MetricsPage.tsx: per-card metrics display with inline
  utilization bars, graceful fallback when enableMonitoring is not set.

- Register Metrics sidebar entry (mdi:chart-line) and route /intel-gpu/metrics.

- Remove registerAppBarAction and AppBarGpuBadge (colored info bubble).

- Fix sidebar parent label: 'Intel GPU' → 'intel-gpu'.

- Bump to v0.2.0; update artifacthub-pkg.yml with new archive URL and checksum.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
2026-02-18 21:23:36 -05:00
parent 3c045e54be
commit a226f0191c
5 changed files with 607 additions and 23 deletions
+25 -17
View File
@@ -1,20 +1,17 @@
/**
* headlamp-intel-gpu-plugin — entry point.
*
* Registers sidebar entries, routes, detail view sections, table column
* processors, and app bar action for Intel GPU device plugin visibility
* in Headlamp.
* Registers sidebar entries, routes, detail view sections, and table column
* processors for Intel GPU device plugin visibility in Headlamp.
*
* Surfaces Intel GPU information in the following places:
* - Dedicated sidebar section: Overview / Device Plugins / Nodes / Pods
* - Dedicated sidebar section: Overview / Device Plugins / Nodes / Pods / Metrics
* - Native Node detail page: Intel GPU section (capacity, utilization, pods)
* - Native Pod detail page: GPU resource requests per container
* - Native Nodes table: GPU Type and GPU Devices columns
* - App bar: health badge (hidden when plugin not installed)
*/
import {
registerAppBarAction,
registerDetailsViewSection,
registerResourceTableColumnsProcessor,
registerRoute,
@@ -22,9 +19,9 @@ import {
} from '@kinvolk/headlamp-plugin/lib';
import React from 'react';
import { IntelGpuDataProvider } from './api/IntelGpuDataContext';
import AppBarGpuBadge from './components/AppBarGpuBadge';
import DevicePluginsPage from './components/DevicePluginsPage';
import { buildNodeGpuColumns } from './components/integrations/NodeColumns';
import MetricsPage from './components/MetricsPage';
import NodeDetailSection from './components/NodeDetailSection';
import NodesPage from './components/NodesPage';
import OverviewPage from './components/OverviewPage';
@@ -38,7 +35,7 @@ import PodsPage from './components/PodsPage';
registerSidebarEntry({
parent: null,
name: 'intel-gpu',
label: 'Intel GPU',
label: 'intel-gpu',
url: '/intel-gpu',
icon: 'mdi:gpu',
});
@@ -75,6 +72,14 @@ registerSidebarEntry({
icon: 'mdi:cube-outline',
});
registerSidebarEntry({
parent: 'intel-gpu',
name: 'intel-gpu-metrics',
label: 'Metrics',
url: '/intel-gpu/metrics',
icon: 'mdi:chart-line',
});
// ---------------------------------------------------------------------------
// Routes
// ---------------------------------------------------------------------------
@@ -127,6 +132,18 @@ registerRoute({
),
});
registerRoute({
path: '/intel-gpu/metrics',
sidebar: 'intel-gpu-metrics',
name: 'intel-gpu-metrics',
exact: true,
component: () => (
<IntelGpuDataProvider>
<MetricsPage />
</IntelGpuDataProvider>
),
});
// ---------------------------------------------------------------------------
// Detail view section — Node pages
// Inject Intel GPU section into native Node detail page for GPU nodes.
@@ -164,12 +181,3 @@ registerResourceTableColumnsProcessor(({ id, columns }) => {
return columns;
});
// ---------------------------------------------------------------------------
// App bar action — Intel GPU health badge
// ---------------------------------------------------------------------------
registerAppBarAction(() => (
<IntelGpuDataProvider>
<AppBarGpuBadge />
</IntelGpuDataProvider>
));