feature: regex-based field matching for telemetry tables#658
Merged
harp-intel merged 4 commits intomainfrom Mar 6, 2026
Merged
feature: regex-based field matching for telemetry tables#658harp-intel merged 4 commits intomainfrom
harp-intel merged 4 commits intomainfrom
Conversation
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>
Contributor
There was a problem hiding this comment.
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
TurbostatPackageRowsByRegexMatchto 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>
- 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>
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
TurbostatPackageRowsByRegexMatchto dynamically discover package-level turbostat fields via regex, matching the existingTurbostatPlatformRowsByRegexMatchpatternpowerTelemetryTableValuesto use the new regex-match function, dynamically building fields from the header instead of hardcoding "Package N" / "DRAM N"temperatureTelemetryTableValuesto useTurbostatPlatformRowsByRegexMatch, dynamically discovering temperature fields instead of hardcoding "CoreTmp" / "PkgTmp"Test plan
go build ./...andgo vet ./...— both pass🤖 Generated with Claude Code