midi-bridge: add prometheus metrics on :9091/metrics
- midi_messages_total: all MIDI messages - midi_notes_on/off_total: note-on/off counts - midi_last_status/note/velocity: last message tokens - midi_last_time_unix: epoch of last message - Removed MIDI counters from prometheus-exporter (bridge owns them)
This commit is contained in:
@@ -11,11 +11,6 @@ SSH_KEY = os.environ.get("SSH_KEY", "/home/david/.ssh/unoq_deploy_key")
|
||||
BOARD = os.environ.get("BOARD_HOST", "127.0.0.1")
|
||||
COLLECT_INTERVAL = 5 # seconds between metric collections
|
||||
|
||||
# ── Counters ──
|
||||
midi_notes_on = 0
|
||||
midi_notes_off = 0
|
||||
midi_errors = 0
|
||||
|
||||
# ── Gauges (updated by collector) ──
|
||||
metrics = {
|
||||
"synth_alsa_running": 0,
|
||||
@@ -119,18 +114,6 @@ def collect_metrics():
|
||||
|
||||
def format_metrics():
|
||||
lines = []
|
||||
lines.append("# HELP synth_midi_notes_on_total Total MIDI note-on messages received")
|
||||
lines.append("# TYPE synth_midi_notes_on_total counter")
|
||||
lines.append(f"synth_midi_notes_on_total {midi_notes_on}")
|
||||
|
||||
lines.append("# HELP synth_midi_notes_off_total Total MIDI note-off messages received")
|
||||
lines.append("# TYPE synth_midi_notes_off_total counter")
|
||||
lines.append(f"synth_midi_notes_off_total {midi_notes_off}")
|
||||
|
||||
lines.append("# HELP synth_midi_errors_total Total MIDI parse errors")
|
||||
lines.append("# TYPE synth_midi_errors_total counter")
|
||||
lines.append(f"synth_midi_errors_total {midi_errors}")
|
||||
|
||||
lines.append("# HELP synth_alsa_running Whether ALSA device is RUNNING")
|
||||
lines.append("# TYPE synth_alsa_running gauge")
|
||||
lines.append(f"synth_alsa_running {metrics['synth_alsa_running']}")
|
||||
|
||||
Reference in New Issue
Block a user