flat-bear-40398
12/02/2025, 6:36 AMtall-airline-16756
12/02/2025, 6:37 AMtall-airline-16756
12/02/2025, 6:37 AMwhip_bypass_transcoding_cpu_cost (and whip_cpu_cost) so WHIP bypass sessions reserve a distinct, lower CPU cost.
• Monitor livekit_ingress_available and use the configured CPU costs to infer how many bypass (non‑transcoding) WHIP sessions are consuming capacity.
• Emit and capture Ingress lifecycle events (use the ingress_started / ingress_ended webhooks) or log/scrape Ingress start/stop info to record enable_transcoding: false for each session.
• Correlate Prometheus-derived capacity changes with your webhook/log records externally to compute exact WHIP-without-transcoding usage.
If you want, I can:
• Outline the exact data points to record from webhooks and how to correlate them with livekit_ingress_available, or
• Provide a short example workflow (webhook event fields + Prometheus query) to calculate usage. Which would help you more? Sources: Self-hosting the Ingress Service | LiveKit docs | Webhooks | LiveKit docsflat-bear-40398
12/02/2025, 6:40 AMtall-airline-16756
12/02/2025, 6:40 AMflat-bear-40398
12/02/2025, 8:08 AMtall-airline-16756
12/02/2025, 8:09 AMbandwidthIn and bandwidthOut (bytes) per session. This is available to LiveKit Cloud customers on the Scale plan or higher.
• SFU telemetry / track-level stats — realtime track metrics (bitrate, packets) available from the SFU; you can aggregate these per session to compute bytes in/out for self-hosted setups.
• Exporting telemetry — self-hosted servers can export the same telemetry data for custom processing and dashboards.
If you want, I can:
• Show the exact fields returned by the Analytics API and an example aggregation, or
• Suggest how to aggregate track-level stats into session bytes for a self-hosted deployment.
Which would you like?
Sources: Announcing LiveKit Cloud | Analytics API | LiveKit docsflat-bear-40398
12/02/2025, 8:09 AMtall-airline-16756
12/02/2025, 8:09 AMlivekit_track_bitrate_bps{track_id,session_id,...} sampled as an instant:
◦ Bytes over last minute per track:
▪︎ (livekit_track_bitrate_bps{session_id="S"} / 8) * 60
◦ Session ingress bytes (last minute):
▪︎ sum((livekit_track_bitrate_bps{session_id="S",role="publisher"} / 8) * 60)
• If exporter exposes cumulative bytes `livekit_track_bytes_total`:
◦ Bytes per minute per track:
▪︎ increase(livekit_track_bytes_total{session_id="S"}[1m])
◦ Session ingress bytes per minute:
▪︎ sum(increase(livekit_track_bytes_total{session_id="S",role="publisher"}[1m]))
Practical script example (pseudo-Python)
• Poll Prometheus or scrape telemetry at fixed interval (e.g., 15s or 60s).
• Keep last value per track_id to compute deltas.
• Convert deltas to bytes if needed, then aggregate per session_id.
Pseudo:
# on each poll:
for sample in samples: # sample includes track_id, session_id, metric_value, timestamp
prev = last_seen.get(sample.track_id)
if prev:
delta = sample.value - prev.value
if delta < 0: delta += counter_reset_correction
bytes = delta # if metric is bytes; if bitrate, bytes = (value/8) * interval_seconds
session_sum[sample.session_id] += bytes
last_seen[sample.track_id] = sample
Edge cases & tips
• Handle counter resets and restarts.
• Align sampling interval and bitrate-to-bytes math to avoid off-by-one.
• Distinguish publisher vs subscriber direction when labeling metrics (role or direction label).
• Include track lifecycle: drop tracks no longer published to avoid double-counting.
• Use webhooks (ingress_started/ended) to finalize session totals and detect sessions that have no explicit end.
• Choose aggregation window (1m common) for smoothness vs. real-time granularity.
If you want, I can:
• Provide exact Prometheus queries tailored to the metric names your exporter exposes, or
• Convert the pseudo script into a runnable Python example that queries Prometheus and writes per-session totals to a CSV or DB.
Which would you like?flat-bear-40398
12/02/2025, 8:16 AMtall-airline-16756
12/02/2025, 8:16 AMlivekit_track_bytes_total or livekit_track_bitrate_bps), I’ll give exact Prometheus queries or the Analytics API call you should use.flat-bear-40398
12/02/2025, 8:17 AMtall-airline-16756
12/02/2025, 8:18 AMlivekit_track* metrics. That explains why you don’t yet see per‑track bytes/bitrate out of the box. Here’s exactly what to do next to get track‑level bytes in/out without heavy custom code.
What’s missing
• Your current metrics list (livekit_track_publish_counter, livekit_track_published_total, livekit_track_subscribe_counter, livekit_track_subscribed_total) are counters for publish/subscribe events, not byte or bitrate telemetry.
Options to get track bytes/bitrate
• Enable the SFU telemetry exporter that exposes track bitrate or cumulative bytes. The SFU can emit track telemetry (bitrate, packets, cumulative bytes) when telemetry/export is enabled.
• If using Prometheus, enable the exporter or build that exposes metrics like:
◦ livekit_track_bitrate_bps{track_id,...} or
◦ livekit_track_bytes_total{track_id,...}
Prometheus queries once those metrics exist
• From bitrate (bps) to bytes over 1 minute:
◦ (livekit_track_bitrate_bps{track_id="..."} / 8) * 60
• From cumulative bytes:
◦ increase(livekit_track_bytes_total{track_id="..."}[1m])
• Session totals (sum tracks by session_id or room label):
◦ sum(increase(livekit_track_bytes_total{session_id="S"}[1m])) by (session_id)
◦ sum((livekit_track_bitrate_bps{session_id="S"} / 8) * 60) by (session_id)
Practical steps
1. Confirm SFU telemetry/exporter is enabled in your config and scraping endpoint is reachable by Prometheus.
2. Restart SFU if you change telemetry flags so the exporter exposes the new metrics.
3. Verify available metric names in Prometheus (use label values/filtering) and then run the sample queries above.
4. If your exporter exposes only bitrate, use the bitrate→bytes formula; if it exposes cumulative bytes, prefer increase() for correctness.
If you want, tell me:
• the SFU config you’re running (telemetry/export flags) or
• the exact metric names you see after enabling telemetry
I’ll give the exact config lines to add and the precise Prometheus queries tailored to those metric names.