feat(app): show GPU metrics in log side panel infrastructure section - #2897
Draft
MikeShi42 wants to merge 6 commits into
Draft
feat(app): show GPU metrics in log side panel infrastructure section#2897MikeShi42 wants to merge 6 commits into
MikeShi42 wants to merge 6 commits into
Conversation
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 detectedLatest commit: 6aa74d5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Greptile SummaryThe PR adds availability-gated GPU utilization charts to the log/span infrastructure panel while preserving the existing Pod and Node groups.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| packages/app/src/components/DBInfraPanel.tsx | Refactors infrastructure groups into a shared renderer and gates GPU charts using exact supported-metric availability. |
| packages/app/src/hooks/useAvailableMetricNames.ts | Queries only candidate gauge metric names before bounded distinct-value aggregation, resolving the previously reported truncation and unsupported-metric cases. |
| packages/app/src/components/infraCorrelations.ts | Adds the GPU correlation descriptor, chart filters, formatting, and per-device grouping configuration. |
| packages/app/src/components/tests/DBInfraPanel.buildChartConfig.test.ts | Covers metric config construction, GPU filtering and grouping, source wiring, and renamed Kubernetes CPU metrics. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Row[Selected log or span] --> Node[k8s.node.name]
Node --> Availability[Query supported GPU metric names]
Availability -->|No supported names| Hidden[Render no GPU group]
Availability -->|Utilization available| Util[GPU utilization chart]
Availability -->|Memory utilization available| Memory[GPU memory utilization chart]
Util --> Charts[DBTimeChart]
Memory --> Charts
Reviews (6): Last reviewed commit: "refactor(app): build v2 chart configs di..." | Re-trigger Greptile
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>
Contributor
E2E Test Results✅ All tests passed • 282 passed • 1 skipped • 1069s
Tests ran across 4 shards in parallel. |
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>
Greptile findings:
- Metric-name cap could hide GPU charts. useGetKeyValues aggregates with
groupUniqArray(limit) even when disableRowLimit is set, so an open-ended
MetricName lookup can drop the name being looked for on a metric-heavy
host. Now the query asks only about the candidate metric names (derived
from the chart specs) and sizes the limit to match, so truncation is
impossible. This also replaces the unanchored MetricName:hw.gpu.* ILIKE
scan with exact equality.
- hasAny was true for any hw.gpu.* metric, so a host emitting only
hw.gpu.io could render GPU controls over an empty grid. Asking only
about chartable metrics removes the failure mode structurally; the
separate hasAny flag is gone.
Drop convertV1ChartConfigToV2 for infra charts and build the v2
BuilderChartConfig directly. The v1 layer was a lossy round trip for
metrics: 'name - Gauge' string-split and re-parsed into an enum, a
table:'metrics' discriminator that only picks a branch, a
seriesReturnType that is silently dropped, a groupBy array joined to a
string via a startsWith('k8s') rewrite, and a valueExpression the
renderer overwrites. getMetricNameSql is now called directly so the k8s
cpu.utilization -> cpu.usage rename still matches both names; a test
pins that.
Also:
- Collapse AvailabilityGatedGroup and InfraSubpanelGroup into one
InfraCorrelationGroup that owns its wrapper, so a group with nothing
to show renders no DOM. The previous fix was ineffective: a React
element is always truthy, so the empty-wrapper check never fired and
the 40px Stack gap remained.
- Gate the availability loading state to gated groups only, so Pod/Node
are not held back by a query they do not run.
- Preserve the pre-existing behavior of dropping a group whose correlate
attribute is present but empty.
- Rename useGpuMetricsAvailability to useAvailableMetricNames; nothing
in it is GPU-specific.
- Add DBInfraPanel.buildChartConfig tests asserting the produced config
rather than an intermediate decision.
HDX-5102
Co-authored-by: Mike Shi <mike@hyperdx.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tsalongside Pod and Node — no separate component.InfraChartSpecsupports:groupBy— per-chart SQL expressions for multi-GPU series labelingwhere— per-chart Lucene filter (ANDed with the correlation WHERE)metricType— a realMetricsDataType, defaulting to GaugeInfraCorrelationgainsrequiresMetricAvailability. A singleInfraCorrelationGroupcomponent renders every group (Pod / Node / GPU) and owns its own wrapper, so a group with nothing to show renders no DOM at all rather than an empty flex child.Charts
hw.gpu.utilizationhw.gpu.task:"general" OR NOT hw.gpu.task:*hw.gpu.memory.utilizationCorrelated at node level via
k8s.node.name. Series are labeled byconcat(hw.id, hw.name, hw.model)so multi-GPU nodes show identifiable per-device lines.Metric existence check
useAvailableMetricNamesasks which of a given candidate list exist for the correlated resource. It queries only the candidate names rather than enumerating every distinctMetricNameon the host — the metadata layer aggregates withgroupUniqArray(limit)even whendisableRowLimitis set, so an open-ended lookup can silently drop the name being looked for on a metric-heavy host and hide a chart that does have data. Bounding the universe to the candidates and sizing the limit to match makes truncation impossible, and replaces an unanchoredILIKEscan with exact equality. Cached 5 min.Direct v2 chart configs
Infra charts no longer go through
convertV1ChartConfigToV2. For metrics that layer was a lossy round trip: a'name - Gauge'string split and re-parsed into an enum, atable: 'metrics'discriminator that only selects a branch, aseriesReturnTypethat is accepted and silently dropped, agroupByarray joined into a string via astartsWith('k8s')rewrite, and avalueExpressionthe renderer overwrites.buildChartConfignow emitsBuilderChartConfigWithDateRangedirectly and callsgetMetricNameSqlitself, so the k8scpu.utilization→cpu.usagerename still matches both names — pinned by a test.Graceful degradation
Out of scope (follow-up)
The
hw.gpu.memory.usage / hw.gpu.memory.limitfallback is deferred. It needs ratio-over-Sum support, which is broken in three independent places (seriesReturnTypedropped for metrics inconvertV1ChartConfigToV2; the second select silently discarded inrenderChartConfig; counter-increase semantics applied to non-monotonic UpDownCounters). Tracked 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 stays hidden by design.
How to test on Vercel preview
N/A — no user-visible change without
hw.gpu.*metrics.References
Linear Issue: HDX-5102