Skip to content

Implement DDM Telemetry Logging and CSV Export #3

@josiah-nelson

Description

@josiah-nelson

Overview

Implement Digital Diagnostics Monitoring (DDM) telemetry capture and historical logging with CSV export functionality. This allows users to monitor and track SFP module health metrics over time.

Current State

  • Basic DDM line detection exists (/ddm:/i.test())
  • DDM samples are captured to ddmSamples array but not persisted
  • No parsing of DDM values
  • No UI for viewing or exporting DDM data
  • TODO comment: "Accumulate DDM samples for CSV export (future)"

Background: SFP DDM/DOM

Digital Diagnostics Monitoring (DDM), also called Digital Optical Monitoring (DOM), provides real-time monitoring of SFP parameters:

  • Temperature (°C)
  • Voltage (V)
  • TX Bias Current (mA)
  • TX Power (dBm)
  • RX Power (dBm)

These values are typically found in EEPROM address A2h (bytes 96-105) per SFF-8472 spec.

Proposed Solution

Phase 1: DDM Parsing

  • Parse DDM telemetry from BLE notifications
  • Extract numeric values for each metric
  • Store with timestamp in structured format
  • Handle units and scaling per SFF-8472 spec

Phase 2: In-Memory Storage & UI Display

  • Maintain rolling buffer of recent DDM samples (e.g., last 1000)
  • Add "DDM Monitor" section to UI showing:
    • Current values (live update)
    • Min/Max values
    • Simple line charts (optional, using Chart.js or similar)
  • Show module health status (within spec / warning / alarm)

Phase 3: CSV Export

  • Export time-series DDM data to CSV format
  • Include columns: timestamp, temperature, voltage, tx_bias, tx_power, rx_power
  • Allow filtering by date range
  • Support export of all modules or selected module

Phase 4: Backend Persistence (Optional)

  • Add backend table for DDM samples
  • API endpoints:
    • POST /api/ddm - Store DDM sample
    • GET /api/ddm/{module_id} - Retrieve samples for module
    • GET /api/ddm/export.csv - Export all DDM data
  • Implement data retention policy (e.g., 30 days)

Implementation Tasks

  • Research SFP Wizard's DDM broadcast format from BLE logs
  • Implement DDM message parser
  • Create DDM data structure/class
  • Add rolling buffer for DDM samples (in-memory)
  • Create "DDM Monitor" UI section
  • Implement real-time value display
  • Add CSV export function (frontend)
  • Add date range picker for export filtering
  • Test with live DDM data from device
  • Document DDM format in code comments
  • (Optional) Add backend persistence
  • (Optional) Add simple charting for trends

Acceptance Criteria

  • DDM telemetry is correctly parsed from BLE notifications
  • Current DDM values are displayed in the UI
  • Users can export DDM history to CSV file
  • CSV format is compatible with Excel/Google Sheets
  • Proper handling when DDM is not available (older SFP modules)
  • Documentation explains DDM feature and interpretation

Technical Notes

DDM Format Example (hypothetical)

ddm: temp=45.2°C vcc=3.3V tx_bias=30.5mA tx_pwr=-2.3dBm rx_pwr=-3.1dBm

CSV Format

timestamp,module_id,module_name,temperature_c,voltage_v,tx_bias_ma,tx_power_dbm,rx_power_dbm
2025-11-01T12:00:00Z,1,Cisco 10G,45.2,3.3,30.5,-2.3,-3.1

Performance Considerations

  • Use circular buffer to limit memory usage
  • Throttle UI updates (max 1 update per second)
  • CSV generation should be non-blocking

Dependencies

None - standalone feature

Priority

Medium - Valuable diagnostic feature but not critical for basic operation

Labels

enhancement, frontend, backend, feature

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions