Engine metrics #
Pragma records metrics for its own runtime alongside your custom metrics. This page covers the built-in metrics most useful for diagnosing node health and service behavior. It isn’t an exhaustive list.
Pragma provides Grafana dashboards that chart many of these metrics, including memory, garbage collection pauses, thread states, PlayerData operations, and cache activity. Use this page to interpret those panels or to query metrics the dashboards don’t chart.
Prometheus metrics are recorded by default and don’t require extra configuration. But other vendors can be configured. See: reporting backend.
Names are shown as exported to Prometheus, which is what you query in Grafana. The suffix tells you the metric type:
- Counters end in
_totaland only increase. Query them withrate()orincrease(). - Timers are exported as a family of series,
_seconds_bucket,_seconds_count,_seconds_sum, and_seconds_max, shown below as_seconds_*. - Gauges report a current value. They have no
_totalor timer suffix, though some end in a unit such as_bytesor_seconds.
Datadog and StatsD use the registered name instead, with dots in place of underscores and without the unit or _total suffixes. For example, pragma_engine_messages_outbound_total is pragma.engine.messages.outbound.
Common tags #
Every metric carries these tags, so you can filter or group any query by node:
| Tag | Description |
|---|---|
clusterName | The cluster the node belongs to. |
backendType | The node’s backend type, such as GAME or SOCIAL. |
nodeName | The node’s name. |
The Grafana dashboards use these tags for their Backend Type, Node Prefix, and Node Name filters. Node Prefix narrows the Node Name list to nodes whose names start with the selected value.
JVM and process #
Every node reports the standard Micrometer JVM and system metrics:
| Area | Metrics |
|---|---|
| Memory | jvm_memory_*, plus jvm_memory_usage_after_gc: the fraction of long-lived heap still in use after garbage collection. |
| Garbage collection | jvm_gc_*, plus jvm_gc_overhead: the fraction of recent CPU time spent in garbage collection. |
| Threads | jvm_threads_live, jvm_threads_daemon, jvm_threads_peak, and jvm_threads_states (tagged state). |
| File descriptors | process_files_open_files and process_files_max_files. Reported on Linux and macOS only. |
| Uptime | process_uptime_seconds and process_start_time_seconds. |
| JIT compilation | jvm_compilation_time_ms_total. |
| Other | Class loading (jvm_classes_*), CPU (system_cpu_*, process_cpu_*), and log events (logback_events_total). |
A sustained rise in jvm_memory_usage_after_gc or jvm_gc_overhead indicates heap pressure. process_files_open_files approaching process_files_max_files indicates the node is close to running out of sockets and file handles.
Internal message routing #
These metrics cover messages passed between services, both within a node and between nodes.
| Metric | Tags | Description |
|---|---|---|
pragma_engine_messages_outbound_total | route, messageType, type | Messages sent to another service. route is local when the target service is on the same node, external when it’s on another node. |
pragma_engine_messages_inbound_total | messageType, type | Messages received from another service. |
pragma_engine_serviceRpc_response_seconds_* | type | Round-trip time of service-to-service RPCs, from send to response. |
pragma_engine_serviceRpc_timedOut_total | requestType, targetInstanceId | Service-to-service RPCs that received no response before timing out. |
messageType is request, response, notification, or serviceError. type is the message’s proto name.
A high share of external routes means services that call each other often are on different nodes, and every call crosses the network.
PlayerData operations #
| Metric | Tags | Description |
|---|---|---|
pragma_playerdata_operation_seconds_* | method, sessionType, inBatch, result | Time to run a single PlayerData operation. inBatch is true for operations run as part of a batch. |
pragma_playerdata_batch_operations_seconds_* | sessionType, operationCount, result | Time to run a batch of operations. |
result records how the operation ended:
| Value | Meaning |
|---|---|
OK | The operation succeeded. |
APPLICATION_ERROR | The operation threw an application error, which is returned to the caller. |
SERVICE_ERROR | The operation threw a service error. |
INTERNAL_ERROR | The operation threw any other exception. |
Cancelled operations aren’t recorded. Filter on result="OK" when charting latency so fast failures don’t pull the numbers down.
Caches #
Engine caches, such as parties in PartyService and gameInstances in GameInstanceService, report these metrics, tagged cacheName, service, and instanceId:
| Metric | Description |
|---|---|
pragma_caches_cacheSize | Number of entries in the cache. |
pragma_caches_cacheAdd_total | Entries added. |
pragma_caches_cacheAccess_total | Cache reads. |
pragma_caches_cacheMiss_total | Reads that found no entry, so the cache loaded it or handled the unknown key. |
pragma_caches_cacheRemovals_total | Entries deleted by the service, such as when a party disbands. |
pragma_caches_cacheEvictions_total | Entries removed by an evicting cache’s sweep because they weren’t accessed within maxTimeBetweenAccessMillis. Sweeps only evict once the cache exceeds its configured size. |
pragma_caches_cacheSweepItems_total | All removal attempts from any source, including removals and evictions, and attempts that found no entry. |
Removals and evictions are counted separately. A rising eviction rate with steady removals means entries are expiring rather than being cleaned up by the service that owns them.