# Metrics

**URL:** https://heroiclabs.com/docs/nakama/getting-started/metrics/
**Summary:** The available metrics produced by Nakama and available for export to Prometheus.
**Keywords:** prometheus, metrics, metrics
**Categories:** nakama, metrics, getting-started

---


# Prometheus Metrics

This page provides a reference for the metrics collected by Nakama and available for export to Prometheus.

## Snapshot Metrics

| Name                | Type  | Description                                                          | Usage                                                                     |
|---------------------|-------|----------------------------------------------------------------------|---------------------------------------------------------------------------|
| `SnapshotLatencyMs` | Gauge | Average latency of requests in milliseconds over a snapshot period.  | Identifying average request time, indicating system performance.           |
| `SnapshotRateSec`   | Gauge | Number of requests per second in the snapshot interval.              | Tracking the request rate, understanding system load.                     |
| `SnapshotRecvKbSec` | Gauge | Rate of data received in kilobytes per second.                       | Monitoring incoming traffic rate, bandwidth management, performance tuning.|
| `SnapshotSentKbSec` | Gauge | Rate of data sent in kilobytes per second.                           | Assessing outgoing traffic, system output performance.                    |

## API Metrics

| Name                 | Type         | Description                                                                  | Usage                                                          |
|----------------------|--------------|------------------------------------------------------------------------------|----------------------------------------------------------------|
| `Api`                | Counter, Timer| Metrics for API calls: request count, latency, bytes received/sent, errors. | Comprehensive view of API performance and error rates.         |
| `ApiRpc`             | Counter, Timer| Similar to `Api`, specific to RPC calls with `rpc_id` tagging.                | Detailed insights into RPC call performance.                   |
| `ApiBefore`          | Counter, Timer| Metrics for pre-processing phases of API calls.                              | Analyzing overhead or actions before main API processing.      |
| `ApiAfter`           | Counter, Timer| Metrics for post-processing phases of API calls.                             | Understanding post-processing steps in API execution.          |

## Message Metrics

| Name                   | Type    | Description                                            | Usage                                                    |
|------------------------|---------|--------------------------------------------------------|----------------------------------------------------------|
| `Message`              | Counter | Count and size of received messages and error occurrences. | Monitoring volume and health of message traffic.         |
| `MessageBytesSent`     | Counter | Total bytes sent in messages.                           | Tracking amount of data sent in messages.                |

## Gauge Metrics

| Name                        | Type  | Description                                        | Usage                                                      |
|-----------------------------|-------|----------------------------------------------------|------------------------------------------------------------|
| `GaugeRuntimes`             | Gauge | Current value for runtime gauges.                  | Tracking number of runtime instances.                      |
| `GaugeLuaRuntimes`          | Gauge | Number of Lua runtime VMs.                         | Lua VM management, resource usage and bottleneck analysis. |
| `GaugeJsRuntimes`           | Gauge | Count of JavaScript runtime VMs.                   | JavaScript VM performance and resource allocation monitoring. |
| `GaugeAuthoritativeMatches` | Gauge | Current count of authoritative matches.            | Load balancing and resource allocation for gaming servers. |
| `GaugeSessions`             | Gauge | Number of active sessions.                         | Understanding user engagement and server load.             |
| `GaugePresences`            | Gauge | Number of user presences.                          | Tracking active user interactions, real-time features.     |
| `GaugeStorageIndexEntries`  | Gauge | Count of entries in a specific storage index.      | Database performance and index management.                 |

## Count Metrics

| Name                      | Type    | Description                                     | Usage                                                       |
|---------------------------|---------|-------------------------------------------------|-------------------------------------------------------------|
| `CountDroppedEvents`      | Counter | Increments count of dropped events.             | Identifying issues with event handling.                     |
| `CountWebsocketOpened`    | Counter | Number of opened WebSocket connections.         | Monitoring WebSocket connection stability and usage.        |
| `CountWebsocketClosed`    | Counter | Number of closed WebSocket connections.         | Analyzing WebSocket disconnections.                         |
| `StorageWriteRejectCount` | Counter | Count of rejected storage write operations.     | Data integrity monitoring, storage operation issues.        |

## Custom Metrics

| Name             | Type    | Description                                       | Usage                                              |
|------------------|---------|---------------------------------------------------|----------------------------------------------------|
| `CustomCounter`  | Counter | Custom counter with specified name and tags.      | Tracking specific metrics tailored to application. |
| `CustomGauge`    | Gauge   | Custom gauge metrics.                             | Monitoring specific custom application scenarios.  |
| `CustomTimer`    | Timer   | Custom timer metrics.                             | Measuring specific time-bound operations.          |

