Skip to main content

Overview

This page focuses on collecting and validating Lightning ASR metrics with Prometheus and exposing them through the Prometheus Adapter.
Autoscaling documentation is currently under active development. Use this page as a metrics reference. If you need autoscaling now, configure your own HPA/KEDA rules using these metrics.

Architecture

/* The original had a syntax error in Mermaid—edges must connect nodes, not labels. “Metrics” is now a node, and edge directions/names are consistent. */

Components

Prometheus

Collects and stores metrics from Lightning ASR pods. Included in chart:
values.yaml

ServiceMonitor

CRD that tells Prometheus which services to scrape. Enabled for Lightning ASR:
values.yaml

Prometheus Adapter

Converts Prometheus metrics to Kubernetes custom metrics API. Configuration:
values.yaml

Available Metrics

Lightning ASR exposes the following metrics:
MetricTypeDescription
asr_active_requestsGaugeActive batch requests currently being processed on GPU
asr_batch_queue_depthGaugeRequests waiting in the batch queue
asr_active_streamsGaugeActive streaming sessions
asr_stream_queue_depthGaugePending sessions in the streaming Redis queue

Verify Metrics Setup

Check Prometheus

Forward Prometheus port:
Open http://localhost:9090 and verify:
  1. Status → Targets: Lightning ASR endpoints should be “UP”
  2. Graph: Query asr_active_requests or asr_batch_queue_depth - should return data
  3. Status → Service Discovery: Should show ServiceMonitor

Check ServiceMonitor

Expected output:
Describe ServiceMonitor:
Should show:

Check Prometheus Adapter

Verify custom metrics are available:
Expected output:
Query specific metric:

Custom Metric Configuration

Add New Custom Metrics

To expose additional metrics for your own autoscaling setup:
values.yaml

Prometheus Configuration

Retention Policy

Configure how long metrics are stored:
values.yaml

Storage

Persist Prometheus data:
values.yaml

Scrape Interval

Adjust how frequently metrics are collected:
values.yaml
Lower intervals (e.g., 15s) provide faster metrics response but increase storage.

Recording Rules

Pre-compute expensive queries:
Use recording rules in your autoscaling queries for better performance.

Alerting Rules

Create alerts for anomalies:

Debugging Metrics

Check Metrics Endpoint

Directly query Lightning ASR metrics:
Expected output:

Test Prometheus Query

Access Prometheus UI and test queries:

Check Prometheus Targets

Navigate to: http://localhost:9090/targets Verify Lightning ASR targets are “UP”

View Prometheus Logs

Look for scrape errors.

Troubleshooting

Metrics Not Appearing

Check ServiceMonitor is created:
Check Prometheus is discovering:
Check service has metrics port:
Should show:

Custom Metrics Not Available

Check Prometheus Adapter logs:
Verify adapter configuration:
Test API manually:

High Cardinality Issues

If Prometheus is using too much memory:
  1. Reduce label cardinality
  2. Increase retention limits
  3. Use recording rules for complex queries

Best Practices

Pre-compute expensive queries:
Then use this in your autoscaling logic instead of a raw query
Balance responsiveness vs storage:
  • Fast autoscaling: 15s
  • Normal: 30s
  • Cost-optimized: 60s
Always persist Prometheus data:
Track Prometheus performance:
  • Query duration
  • Scrape duration
  • Memory usage
  • TSDB size
Don’t rely on Prometheus UIUse Grafana dashboards for opsSee Grafana Dashboards

What’s Next?

Grafana Dashboards

Visualize metrics