Skip to main content

Metrics (Prometheus)

The gateway exposes a /metrics endpoint that returns metrics in Prometheus exposition format. This enables integration with monitoring systems like Prometheus, Grafana, and other observability tools.

Endpoint

No authentication is required. The endpoint is intended for internal/local monitoring use.

Available Metrics

Gateway Metrics

Labels:
  • channel: The messaging channel (e.g., telegram)
  • type: Message type (text, media, command) or error type (processing, network, timeout)

Telegram Metrics

Labels:
  • type: Message type (text, media, command)
  • reason: Reconnection reason (network, conflict, timeout)
Histogram Buckets: 10ms, 50ms, 100ms, 250ms, 500ms, 1s, 2.5s, 5s, 10s

Node.js Runtime Metrics

Standard Node.js runtime metrics are also exposed with nodejs_ and process_ prefixes:
  • process_cpu_user_seconds_total - CPU time in user mode
  • process_cpu_system_seconds_total - CPU time in system mode
  • process_resident_memory_bytes - Resident memory size
  • process_heap_bytes - Heap memory size
  • nodejs_active_handles_total - Active libuv handles
  • nodejs_eventloop_lag_seconds - Event loop lag
  • And more…

Example Output

Prometheus Configuration

Add the gateway to your Prometheus scrape config:

Grafana Dashboard

Example queries for a Grafana dashboard:

Health vs Metrics

  • /health - Simple JSON health check for platform probes (Fly.io, Docker, k8s)
  • /metrics - Full Prometheus metrics for detailed observability
Use /health for liveness/readiness probes and /metrics for monitoring dashboards.