feat: add Prometheus metrics instrumentation
- New whisper_live/metrics.py with Counter, Gauge, Histogram metrics - Track connections (opened/closed/rejected), transcription latency, audio processed, segments emitted, REST requests, and errors - All metric helpers are no-ops when prometheus_client not installed - --metrics_port CLI flag to expose /metrics endpoint (0 = disabled) - Metrics integrated into server.py, base.py at key instrumentation points - 17 new tests in tests/test_metrics.py (178 total passing)
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import sys
|
||||
from whisper_live.client import TranscriptionClient
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: python transcribe_file.py <path_to_audio_file>")
|
||||
sys.exit(1)
|
||||
|
||||
audio_file = sys.argv[1]
|
||||
|
||||
client = TranscriptionClient(
|
||||
"localhost",
|
||||
9090,
|
||||
lang="en",
|
||||
translate=False,
|
||||
model="small", # also support hf_model => `Systran/faster-whisper-small`
|
||||
use_vad=False,
|
||||
save_output_recording=True, # Only used for microphone input, False by Default
|
||||
output_recording_filename="./output_recording.wav", # Only used for microphone input
|
||||
mute_audio_playback=False, # Only used for file input, False by Default
|
||||
enable_translation=True,
|
||||
target_language="hi",
|
||||
)
|
||||
|
||||
# Transcribe the offline audio file
|
||||
client(audio_file)
|
||||
Reference in New Issue
Block a user