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
Available Metrics
Gateway Metrics
| Metric | Type | Labels | Description |
|---|---|---|---|
crocbot_uptime_seconds | Gauge | - | Gateway uptime in seconds since startup |
crocbot_messages_total | Counter | channel, type | Total messages processed |
crocbot_errors_total | Counter | channel, type | Total errors encountered |
channel: The messaging channel (e.g.,telegram)type: Message type (text,media,command) or error type (processing,network,timeout)
Telegram Metrics
| Metric | Type | Labels | Description |
|---|---|---|---|
crocbot_telegram_latency_seconds | Histogram | type | Message handling latency in seconds |
crocbot_telegram_reconnects_total | Counter | reason | Total reconnection attempts |
type: Message type (text,media,command)reason: Reconnection reason (network,conflict,timeout)
Node.js Runtime Metrics
Standard Node.js runtime metrics are also exposed withnodejs_ and process_ prefixes:
process_cpu_user_seconds_total- CPU time in user modeprocess_cpu_system_seconds_total- CPU time in system modeprocess_resident_memory_bytes- Resident memory sizeprocess_heap_bytes- Heap memory sizenodejs_active_handles_total- Active libuv handlesnodejs_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
/health for liveness/readiness probes and /metrics for monitoring dashboards.