Skip to main content

Overview

CloudGaming provides multi-layer monitoring across WebRTC streaming, signaling infrastructure, and host health. This guide covers all available metrics, health checks, and monitoring best practices.

WebRTC Statistics

Real-Time Transport Metrics

The Go/Pion WebRTC implementation tracks comprehensive transport statistics: Packet Loss and Retransmission
Available Metrics:
  • Packet Loss - Percentage of lost RTP packets
  • RTT (Round-Trip Time) - Network latency in milliseconds
  • Jitter - Packet arrival time variance
  • NACK Count - Number of retransmission requests
  • PLI Count - Number of keyframe requests
  • Send Bitrate - Current video bitrate in kbps
  • Pacer Queue Length - Number of frames waiting to send

Stats Monitoring Implementation

RTCP Feedback

RTCP (RTP Control Protocol) provides real-time feedback:
Log Example:

Audio Queue Monitoring

Queue Health Metrics

Audio queue depth indicates network congestion:
Health Status Thresholds:
  • GOOD: Average queue depth < 2.0 packets
  • WARNING: Average queue depth > 2.0 packets
  • CRITICAL: Average queue depth > 2.8 packets
Log Example:

Buffer Pool Health

Memory Management Monitoring

The tiered buffer pool tracks allocation efficiency:
Performance Indicators:
  • Hit Rate 95%+: Excellent - minimal allocations
  • Hit Rate 90-95%: Good - some allocations expected
  • Hit Rate 80-90%: Moderate - consider pool tuning
  • Hit Rate below 80%: Poor - high GC pressure
Log Example:

Signaling Server Metrics

Prometheus Metrics Endpoint

The signaling server exposes metrics at /metrics:

Available Metrics

Connection Metrics:
Message Processing:
Redis Health:
Fanout Performance:

Implementation Reference

See Server/metrics.js:1-117 for the complete metrics implementation.

Matchmaker Monitoring

Host Health Tracking

The matchmaker monitors host heartbeats: Heartbeat Endpoint:
Response:

Host TTL Monitoring

Response:
Stale Host Pruning:

Health Check Endpoints

Signaling Server

Liveness Probe:
Readiness Probe:

Matchmaker

Health Endpoints:
All return 200 OK immediately to prevent Railway from killing the container.

Host Configuration Monitoring

Monitor these key settings from config.json:

Video Configuration

Capture Settings

Audio Configuration

Redis Monitoring

Circuit Breaker

Protects against Redis failures:
When circuit opens:
  • New connections rejected with 1013 Service unavailable
  • Existing connections continue working
  • Circuit auto-closes after timeout

Connection Status

Monitoring Best Practices

Alerting Thresholds

Critical Alerts:
  • WebRTC packet loss > 5%
  • RTT > 150ms for sustained period
  • Audio queue depth > 2.8 (CRITICAL)
  • Buffer pool hit rate < 80%
  • Redis circuit breaker open
  • Signaling server Redis disconnected
Warning Alerts:
  • WebRTC packet loss > 2%
  • RTT > 100ms
  • Audio queue depth > 2.0 (WARNING)
  • Buffer pool hit rate < 90%
  • Host heartbeat TTL < 10 seconds
  • Rate limit drops increasing

Log Aggregation

Key Log Patterns:

Grafana Dashboard Example

Panels to Include:
  1. Active connections (signaling_active_connections)
  2. Message throughput (rate(signaling_messages_forwarded_total[1m]))
  3. Redis latency (signaling_redis_cmd_latency_seconds)
  4. WebRTC packet loss percentage
  5. Audio queue depth over time
  6. Buffer pool hit rate
  7. Host heartbeat count

Next Steps