Skip to content

Tech debt: convert localStats / hostMetrics / trafficManagementStats serial ingest onto buildCanonicalMetrics #3515

Description

@Yeraze

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions