Skip to content

feature: regex-based field matching for telemetry tables#658

Merged
harp-intel merged 4 commits intomainfrom
feature/regex-match-telemetry-tables
Mar 6, 2026
Merged

feature: regex-based field matching for telemetry tables#658
harp-intel merged 4 commits intomainfrom
feature/regex-match-telemetry-tables

Conversation

@harp-intel
Copy link
Contributor

Summary

  • Add TurbostatPackageRowsByRegexMatch to dynamically discover package-level turbostat fields via regex, matching the existing TurbostatPlatformRowsByRegexMatch pattern
  • Update powerTelemetryTableValues to use the new regex-match function, dynamically building fields from the header instead of hardcoding "Package N" / "DRAM N"
  • Update temperatureTelemetryTableValues to use TurbostatPlatformRowsByRegexMatch, dynamically discovering temperature fields instead of hardcoding "CoreTmp" / "PkgTmp"

Test plan

  • Verify power telemetry table renders correctly with single and multi-socket systems
  • Verify temperature telemetry table renders correctly
  • Verify that systems with varying watt/temperature fields (e.g., missing RAMWatt) are handled gracefully
  • Run go build ./... and go vet ./... — both pass

🤖 Generated with Claude Code

Add TurbostatPackageRowsByRegexMatch to dynamically discover package-level
fields via regex, mirroring TurbostatPlatformRowsByRegexMatch. Update
powerTelemetryTableValues and temperatureTelemetryTableValues to use
regex-match variants for dynamic field discovery instead of hardcoded names.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds regex-based turbostat field discovery so telemetry tables can adapt to varying turbostat headers across platforms, reducing hardcoded field assumptions.

Changes:

  • Introduces TurbostatPackageRowsByRegexMatch to extract per-package turbostat rows based on regex-matched fields (mirroring existing platform regex matching).
  • Updates the Power telemetry table to derive watt metrics dynamically from the turbostat header.
  • Updates the Temperature telemetry table to derive temperature metrics dynamically from platform rows.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
internal/extract/turbostat.go Adds package-level regex-based turbostat row extraction with per-package headers.
cmd/telemetry/telemetry_tables.go Switches power/temperature telemetry field construction from hardcoded columns to header-driven dynamic columns.

- Fix nil placeholder bug: initialize gap entries with header row instead
  of nil, and guard the else branch for late-initialized packages
- Fix getPkgAveragePower: match fields by "PkgWatt" suffix instead of
  "Package" prefix to avoid including RAMWatt in the average
- Fix getPkgAverageTemperature: match "PkgTmp" field name instead of
  "Package" prefix since fields are now named from turbostat headers
- Add nil/empty guards in powerTelemetryTableValues to skip packages
  with no data rows
- Add unit tests for TurbostatPackageRowsByRegexMatch covering happy
  paths, field ordering, error cases, and edge cases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

harp-intel and others added 2 commits March 5, 2026 16:47
- Clarify error message when no rows found (vs no package rows)
- Wrap Atoi error with %w in package number parsing
- Update getPkgAverageTemperature comment to reflect platform-level PkgTmp

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…es in a row

Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
@harp-intel harp-intel merged commit 1c30e7a into main Mar 6, 2026
5 checks passed
@harp-intel harp-intel deleted the feature/regex-match-telemetry-tables branch March 6, 2026 17:04
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