Skip to main content
Version: Current

Enabling metrics

To enable metrics on your application, add the following settings to your system definition file:

item(name = "MetricsEnabled", value = "true")
item(name = "MetricsReportType", value = "{see below for details}")
item(name = "MetricsClassLoaderStatsEnabled", value = "true")
item(name = "MetricsProcessorStatsEnabled", value = "true")
PropertyDefaultExplanation
MetricsEnabledfalseenables metrics for your application
MetricsReportTypen/aa comma-separated list of metrics reporters
MetricsProcessorStatsEnabledfalseenables additional process metrics
MetricsClassLoaderStatsEnabledfalseenables additional classloader metrics

Metric names

The framework provides an abstraction on top of the reporters. A single interface is used, regardless of how the metrics are reported.

Each metric has an identifier that consists of a name and a series of tags.

The framework provides these tags for every metric:

MetricExplanation
groupNameprocess group, e.g. GENESIS or AUTH
processNamethe name of the process e.g. GENESIS_ROUTER
hostnamethe hostname e.g. TAM_PROD1

In addition to these tags, each metric can provide additional tags. How these tags are reported depends on the metric reporter.

Metric reporters

You can specify multiple reporters. Your list must be comma-separated, e.g. GRAPHITE,DATADOG. The reporter affects the name of metrics. Within the framework, metrics have a name and tags.

The available reporters are:

ReporterDescription
GRAPHITEPublishes metrics to a Graphite server
DATADOGPublishes metrics to a Datadog server
SLF4JPublishes metrics to the services' log file

Graphite

Graphite is an open-source sink that you can use for metrics in Genesis applications.

Graphite is often paired with Grafana, which can source data from Graphite and provides the means to set up and display alerts.

Graphite reports metrics in a hierarchical - tree - structure.

There are two ways for Genesis to generate the metric id for graphite: either hierarchical or dimensional.

Hierarchical metric structure

When the hierarchical structure is used, the metric id will be built of the following components separated by dots ..

  1. genesis
  2. the value of the group name tag
  3. the value of the process name tag
  4. the value of the host name tag
  5. additional tags, including the key and value
  6. the metric name

e.g. genesis.genesis.genesis_router.tam_prod1.active_connections

Dimensional metric structure

When the dimensional metric structure is used, the metric id will begin with the metric name and all tag keys and values are joined.

e.g. active_connections{hostName=tam_prod1.processName=genesis_router.groupName=genesis}.

Settings

To support Graphite, the URL and port should be specified in your system definition file:

item(name = "MetricsGraphiteURL", value = "localhost")
item(name = "MetricsGraphitePort", value = "2003")
item(name = "MetricsStructureType", value = "hierarchical")

For the MetricsStructureType, Genesis metrics supports both hierarchical and dimensional.

Datadog

Datadog is a proprietary cloud-based metrics sink that you can use with Genesis.

Datadog supports tags, and these are provided, along with the metric name.

To use Datadog, make the following three settings to your application's system definition file:

item(name = "MetricsDatadogApiKey", value = "YOUR_API_KEY")
item(name = "MetricsDatadogApplicationKey", value = "YOUR_APP_KEY")
item(name = "MetricsDatadogUri", value = "https://api.datadoghq.com")

SLF4J

Metrics can be reported straight to the log file.

This is an easy way to test metrics during development and testing; however, it is not recommended in a production environment.

There are three optional properties for the logger reporter:

item(name = "MetricsReportIntervalSecs", value = "60")
item(name = "Slf4jReporterLoggingLevel", value = "DEBUG")
item(name = "Slf4jReporterLogInactive", value = "true")
PropertyDefaultExplanation
MetricsReportIntervalSecs60interval between metrics log messages
Slf4jReporterLoggingLevelDEBUGthe log level to use
Slf4jReporterLogInactivetruewhen set to true, metrics with a zero 0 will not be reported