Skip to content

feat(app): show GPU metrics in log side panel infrastructure section - #2897

Draft
MikeShi42 wants to merge 5 commits into
mainfrom
cursor/gpu-metrics-infra-panel-5abf
Draft

feat(app): show GPU metrics in log side panel infrastructure section#2897
MikeShi42 wants to merge 5 commits into
mainfrom
cursor/gpu-metrics-infra-panel-5abf

Conversation

@MikeShi42

@MikeShi42 MikeShi42 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds GPU utilization and GPU memory utilization charts to the Infrastructure tab of the log/span side panel, using the OpenTelemetry hardware semantic conventions (hw.gpu.*).

Design

GPU registers as a descriptor in infraCorrelations.ts alongside Pod and Node — not as a separate component. The extended InfraChartSpec type supports:

  • groupBy — per-chart SQL expressions for multi-GPU series labeling
  • where — per-chart Lucene filter (ANDed with the correlation WHERE)
  • metricType'Gauge' (default) or 'Sum'

The InfraCorrelation type gains requiresMetricAvailability: boolean. When set, an AvailabilityGatedGroup wrapper checks metric existence before rendering — the entire group is hidden (returns null) when no GPU metrics exist.

Correlation & labeling

  • GPU metrics correlate at node level via k8s.node.name (same as the existing Node group).
  • Series are labeled by concat(hw.id, hw.name, hw.model) so multi-GPU nodes show identifiable per-device lines.

Metric existence check (useGpuMetricsAvailability)

  • Pushes MetricName:hw.gpu.* prefix filter into the ClickHouse query so the result set is bounded regardless of how many other metrics the source has.
  • Queries only the gauge table (GPU utilization metrics are Gauges per OTel semconv).
  • Results are cached via useGetKeyValues (5 min staleTime).

Charts

Chart Metric Filter Table
GPU utilization hw.gpu.utilization hw.gpu.task:"general" OR NOT hw.gpu.task:* Gauge
GPU memory utilization hw.gpu.memory.utilization Gauge

Graceful degradation

  • Section is fully hidden when no GPU metrics exist — no empty state, no layout gap (empty wrapper divs return null before rendering)
  • Partial availability: only charts with data render
  • Non-GPU users see exactly what they saw before

Out of scope (follow-up)

The hw.gpu.memory.usage / hw.gpu.memory.limit fallback from the original issue is deferred. It requires ratio chart support over Sum metrics, which doesn't work today due to three independent issues in convertV1ChartConfigToV2 and renderChartConfig (seriesReturnType dropped for metrics, second series silently discarded, counter-increase semantics applied to UpDownCounters). Filed as a follow-up on HDX-5102.

Screenshots or video

N/A — GPU metrics require an OTel-semconv-compliant GPU collector. The preview demo has no GPU data, so the section remains hidden by design.

How to test on Vercel preview

N/A — non-UI change for environments without hw.gpu.* metrics.

References

Linear Issue: HDX-5102

Open in Web Open in Cursor 

Add GPU utilization and GPU memory utilization charts to the Infrastructure
tab of the log/span side panel, using OTel hardware semantic conventions
(hw.gpu.*).

- Add useGpuMetricsAvailability hook for cheap metric existence check
  (queries MetricName values from gauge table, cached 5 min)
- Add GpuInfraSection component with per-GPU series via hw.id groupBy
- Add getGpuCorrelationWhere to build resource correlation filter
  (prefers k8s.node.name, falls back to host.name)
- Section is fully hidden when no GPU metrics exist for the correlated
  resource; partial availability renders only available charts
- GPU utilization chart filters to hw.gpu.task:general (or unset) to
  avoid mixing encoder/decoder series

HDX-5102

Co-authored-by: Mike Shi <mike@hyperdx.io>
@changeset-bot

changeset-bot Bot commented Aug 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0e95137

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/app Minor
@hyperdx/api Minor
@hyperdx/otel-collector Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Aug 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hyperdx-oss Ready Ready Preview Aug 13, 2026 7:15am
hyperdx-storybook Ready Ready Preview Aug 13, 2026 7:15am

Request Review

@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds availability-gated GPU utilization charts to the log/span Infrastructure panel. The filtered metric discovery remains capped and can hide supported charts on sources with a sufficiently broad GPU metric namespace.

  • Adds GPU correlation and per-device chart grouping.
  • Adds a metadata lookup that gates charts by metric availability.
  • Refactors infrastructure chart configuration to support per-chart filters, grouping, and metric types.

Confidence Score: 4/5

The PR is not yet safe to merge because capped GPU metric discovery can hide supported charts and, in some cases, the entire GPU section.

The availability lookup narrows results to GPU metrics but still accepts the metadata helper's 20-value aggregation limit, so supported metric names can be omitted from the set used to decide whether charts render.

Files Needing Attention: packages/app/src/hooks/useGpuMetricsAvailability.ts

Important Files Changed

Filename Overview
packages/app/src/hooks/useGpuMetricsAvailability.ts Adds GPU metric discovery, but the metadata aggregation can truncate the filtered metric-name set and hide supported charts.
packages/app/src/components/DBInfraPanel.tsx Adds availability gating and generalized chart configuration; the control-handler assertions remain an incomplete non-blocking type-safety fix.
packages/app/src/components/infraCorrelations.ts Defines the GPU correlation, chart filters, formatting, and per-device grouping.
packages/app/src/components/tests/infraCorrelations.test.ts Covers GPU descriptors, chart specifications, grouping expressions, and primary-metric availability resolution.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Event[Log or span with k8s.node.name] --> Availability[Query hw.gpu.* metric names]
  Availability --> Gate{Supported metric returned?}
  Gate -->|Yes| Charts[Render available GPU charts]
  Gate -->|No| Hidden[Hide GPU section]
  Availability -. 20-name cap .-> Gate
Loading

Fix All in Greploop

Fix All in Claude Code Fix All in Conductor Fix All in Cursor Fix All in Codex

Reviews (5): Last reviewed commit: "fix(app): drop broken memory fallback, f..." | Re-trigger Greptile

Comment thread packages/app/src/hooks/useGpuMetricsAvailability.ts Outdated
Comment thread packages/app/src/hooks/useGpuMetricsAvailability.ts Outdated
Comment thread packages/app/src/components/GpuInfraSection.tsx Outdated
Use specific type assertions instead of 'as any' to stay within the
max-warnings threshold. Fix import sort order in test file.

Co-authored-by: Mike Shi <mike@hyperdx.io>
@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

E2E Test Results

All tests passed • 282 passed • 1 skipped • 1069s

Status Count
✅ Passed 282
❌ Failed 0
⚠️ Flaky 0
⏭️ Skipped 1

Tests ran across 4 shards in parallel.

View full report →

Use the stable NOW constant from config instead of new Date() in the
GPU infra section's date range calculation, matching the project's
date hygiene rules.

Co-authored-by: Mike Shi <mike@hyperdx.io>
Structural:
- Extend InfraChartSpec with optional groupBy, where, metricType, and
  fallback fields so GPU registers as a descriptor rather than a
  separate component
- Delete GpuInfraSection.tsx; InfraSubpanelGroup now handles both k8s
  and GPU charts via the descriptor data
- Add requiresMetricAvailability flag to InfraCorrelation; gated groups
  only render when metric existence is confirmed
- Add AvailabilityGatedGroup wrapper that checks availability before
  rendering

Bug fixes:
- Fix _exists_ syntax (unsupported) → hw.gpu.task:* per query parser
- Push MetricName:hw.gpu.* prefix filter into the availability query
  so limit doesn't produce false negatives on metric-heavy nodes
- Check both gauge and sum tables for availability
- Drop host.name fallback (unreachable: tab requires k8s attributes)

Acceptance criteria:
- Series grouped by concat(hw.id, hw.name, hw.model) for richer labels
- hw.gpu.memory.usage / hw.gpu.memory.limit fallback via ratio chart
  when hw.gpu.memory.utilization isn't emitted
- resolveChartAvailability tested for primary, fallback, none, and
  partial cases

Minor:
- Use live new Date() (eslint-disable) matching sibling InfraSubpanelGroup
- Move GPU_UTILIZATION_NUMBER_FORMAT to ChartUtils for consistency
- Remove empty select comment (now annotated in the hook)

HDX-5102

Co-authored-by: Mike Shi <mike@hyperdx.io>
Remove the hw.gpu.memory.usage / hw.gpu.memory.limit fallback:
convertV1ChartConfigToV2 drops seriesReturnType for metrics, the
renderer discards the second series, and Sum uses counter-increase
semantics on a non-monotonic UpDownCounter. All three failures are in
the renderer and out of scope for this PR.

Changes:
- Remove InfraChartFallback type and fallback field from InfraChartSpec
- Simplify resolveChartAvailability to return boolean (available / not)
- Remove sum-table query from useGpuMetricsAvailability (halves cost)
- Simplify buildChartConfig (no mode parameter)
- Fix 40px empty-div gap: return null from the correlation map entry
  when both metricsGroup and timeline render nothing, so no empty flex
  child is emitted into Stack

Follow-up: HDX-5102 — support ratio charts over Sum metrics for GPU
memory fallback (requires changes to convertV1ChartConfigToV2,
renderChartConfig metric select handling, and Sum aggFn projection).

HDX-5102

Co-authored-by: Mike Shi <mike@hyperdx.io>
Comment on lines +53 to +56

const { data, isLoading } = useGetKeyValues(
{ chartConfig, keys: ['MetricName'], disableRowLimit: true },
{ enabled: enabled && !!chartConfig },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Metric-name cap still hides charts

If a correlated node has more than 20 distinct hw.gpu.* gauge metric names, disableRowLimit still leaves the metadata query's default groupUniqArray(20) cap in place. The result can omit hw.gpu.utilization or hw.gpu.memory.utilization, causing an available chart—or the entire GPU section—to remain hidden.

Knowledge Base Used: App Components and Charts

Fix in Claude Code Fix in Conductor Fix in Cursor Fix in Codex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants