Metrics #

Pragma Engine supports exporting operational metrics for consumption by another service, such as a data visualization tool (such as Grafana) or an Application Performance Management (APM) service (such as Datadog). These metrics can be used to give you insight into the running state of your application, such as memory, CPU usage, and number of players on the platform.

You can customize your metrics to be exported, but beware of high costs. Consider rolling your own open-source stack or using a managed service provider.

Quick Guides #

Configuring metrics #

We currently use Micrometer for our metrics library. On their Concepts page, you can see descriptions of their supported monitoring systems.

Vendors can be supported by implementing the MetricsPlugin. Several options are available out-of-box using Pragma-provided implementations utilized through configuration, such as:

In each section, we’ll provide all potential config values (if relevant) and a quick default sample if you’d like to plug and play as quickly as possible.

Datadog #

Enable Datadog on the MetricsNodeService via plugin config using MetricsNodeService.datadogRegistryProvider.

The only required config value is apiKey.
Configuration
class Config(mode: BackendMode, type: BackendType) : PluginConfig<Config>(mode, type) {
   override val description = "Configuration for the Datadog"

   var apiKey by types.encryptedString("Datadog API key")
   var applicationKey by types.encryptedString("Datadog application key")
   var descriptions by types.boolean("Whether or not to send descriptions metadata")
   var hostTag by types.string("Host tag when shipping metrics")
   var uri by types.string("URI to ship metrics to")
}
Basic Sample Config
pluginConfigs:
  MetricsNodeService.datadogRegistryProvider:
    class: "DatadogRegistryProvider"
    config:
      apiKey: "<MyEncryptedApiKey>"

Statsd #

Enable Statsd on the MetricsNodeService via plugin config using MetricsService.statsdRegistryProvider.

To integrate with Datadog, set the flavor value to DATADOG.
Configuration
class Config(mode: BackendMode, type: BackendType) : PluginConfig<Config>(mode, type) {
   override val description = "Configuration for the Statsd metrics registry provider"

   var flavor by types.enum(StatsdFlavor::class, "Flavor of statsd")
   var host by types.string("Host to send stats")
   var port by types.int("Port to send stats")
   var protocol by types.enum(StatsdProtocol::class, "Protocol to send stats")
   var maxPacketLength by types.int("Max packet length to send stats")
   var pollingFrequencySeconds by types.int("Polling frequency to send stats")
   var stepSeconds by types.int("Step size to compute windowed statistics ")
   var publishUnchangedMeters by types.boolean("Whether or not to publish unchanged meters")
   var buffered by types.boolean("Whether or not to buffer metrics sent")
Basic Sample Config
pluginConfigs:
  MetricsNodeService.statsdRegistryProvider:
    class: "StatsdRegistryProvider"

Prometheus #

Enable the Prometheus scrapable metrics endpoint on the MetricsNodeService via plugin config using MetricsService.prometheusGatewayModuleProvider. Metrics are available on the respective Operator endpoints, at /metrics.

Sample Config
pluginConfigs:
  MetricsNodeService.prometheusGatewayModuleProvider:
    class: "PrometheusGatewayModuleProvider"