Documentation Index
Fetch the complete documentation index at: https://mintlify.com/renja-g/RiftRelay/llms.txt
Use this file to discover all available pages before exploring further.
Overview
RiftRelay exposes operational metrics in Prometheus format, providing insights into request rates, queue depth, admission times, and upstream response codes. These metrics are essential for monitoring performance and troubleshooting issues.Metrics collection is disabled by default. Enable it by setting
ENABLE_METRICS=true.Endpoint
Configuration
Enable metrics in your environment configuration:Authentication
No authentication required when enabled.Response Format
Metrics are returned in Prometheus text exposition format:Available Metrics
Request Metrics
Total number of HTTP requests received by RiftRelayThis counter increments for every request, including health checks and metrics requests.
Current number of requests being processedUseful for monitoring concurrency and identifying request backlog.
Admission Metrics
Average admission wait time in millisecondsCalculated as:
total_admission_wait_ns / admission_count / 1,000,000Higher values indicate requests are waiting longer in the queue, possibly due to rate limits.Total admission attempts by outcomeLabels:
outcome="allowed"- Request was admitted and forwardedoutcome="rejected"- Request was rejected (queue full or timeout)
Queue Metrics
Current queue depth per bucket and priorityLabels:
bucket- Rate limit bucket (e.g.,"na1:lol/summoner/v4/summoners/by-name/{summonerName}")priority- Request priority ("normal"or"high")
Upstream Response Metrics
Total upstream responses by HTTP status codeLabels:
code- HTTP status code (e.g.,"200","404","429","502")
Example Response
Prometheus Configuration
Add RiftRelay to your Prometheus scrape configuration:Grafana Dashboard
Example Queries
Request Rate (per second):Sample Dashboard Panels
Requests Per Second:Alerting Rules
High Rejection Rate
Alert when more than 10% of requests are rejected:High Queue Depth
Alert when queue depth exceeds threshold:Upstream Error Rate
Alert when upstream error rate is elevated:Implementation Details
Metrics are collected by themetrics.Collector struct and exposed via HTTP handler.
Source: internal/metrics/metrics.go:79-138
Metric Collection Points
Request Middleware: Tracks total requests and inflight count (internal/metrics/metrics.go:38-45)
Admission Observer: Records queue depth, admission wait time, and outcomes (internal/metrics/metrics.go:47-71)
Upstream Observer: Tracks response status codes (internal/metrics/metrics.go:73-77)
Thread Safety
All metrics use atomic operations or mutex-protected maps for thread-safe concurrent access.Examples
Fetch Metrics
Monitor Specific Metric
Filter for admission metrics only:Export to File
Save metrics snapshot for analysis:Custom Monitoring Script
Related Endpoints
- Health Check - Service availability check
- Proxy Endpoint - Main API proxy interface