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:
@@ -90,6 +90,12 @@ if __name__ == "__main__":
|
||||
help='Expect raw PCM int16 audio from clients instead of float32. '
|
||||
'Audio will be normalized to float32 range [-1.0, 1.0].'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--metrics_port',
|
||||
type=int,
|
||||
default=0,
|
||||
help='Port for Prometheus /metrics endpoint. 0 = disabled (default). Requires prometheus_client.'
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.backend == "tensorrt":
|
||||
@@ -120,4 +126,5 @@ if __name__ == "__main__":
|
||||
batch_max_size=args.batch_max_size,
|
||||
batch_window_ms=args.batch_window_ms,
|
||||
raw_pcm_input=args.raw_pcm_input,
|
||||
metrics_port=args.metrics_port,
|
||||
)
|
||||
Reference in New Issue
Block a user