Follow-up from PR #3514 (#3506) review.
#3506 unified the device / environment / airQuality / power telemetry branches of processTelemetryMessageProtobuf onto the shared buildCanonicalMetrics() helper (iterate decoded fields → canonicalTelemetryType/canonicalTelemetryUnit). The remaining three branches — localStats, hostMetrics, and trafficManagementStats — still use inline hand-maintained { type, value, unit } lists.
These are not currently affected by the protobuf.js underscore-before-digit quirk (no _<digit> fields), so this is not a bug — purely a consistency / maintainability item.
Scope
- Add the localStats / host / trafficManagement type→unit entries to
CANONICAL_TELEMETRY_UNITS in src/server/utils/telemetryKeys.ts (note: these use group-prefixed semantics today, e.g. health.*; decide whether they join STRIP_GROUPS or stay dotted before converting).
- Convert the three branches in
meshtasticManager.ts to this.saveTelemetryMetrics(this.buildCanonicalMetrics(group, decoded), …).
- Verify units/labels are unchanged (these include non-physical units like
packets, nodes, bytes).
Caveat
buildCanonicalMetrics only emits leaves with a known canonical unit, so every currently-stored type must be present in the units map before converting — otherwise data silently stops being stored. Add a test asserting parity (every type the old static list stored is still stored) before/after.
🤖 Generated with Claude Code
Follow-up from PR #3514 (#3506) review.
#3506 unified the device / environment / airQuality / power telemetry branches of
processTelemetryMessageProtobufonto the sharedbuildCanonicalMetrics()helper (iterate decoded fields →canonicalTelemetryType/canonicalTelemetryUnit). The remaining three branches — localStats, hostMetrics, and trafficManagementStats — still use inline hand-maintained{ type, value, unit }lists.These are not currently affected by the protobuf.js underscore-before-digit quirk (no
_<digit>fields), so this is not a bug — purely a consistency / maintainability item.Scope
CANONICAL_TELEMETRY_UNITSinsrc/server/utils/telemetryKeys.ts(note: these use group-prefixed semantics today, e.g.health.*; decide whether they joinSTRIP_GROUPSor stay dotted before converting).meshtasticManager.tstothis.saveTelemetryMetrics(this.buildCanonicalMetrics(group, decoded), …).packets,nodes,bytes).Caveat
buildCanonicalMetricsonly emits leaves with a known canonical unit, so every currently-stored type must be present in the units map before converting — otherwise data silently stops being stored. Add a test asserting parity (every type the old static list stored is still stored) before/after.🤖 Generated with Claude Code