Metrics

New metrics subsystem

❗️

This is a legacy Apache Ignite documentation

The new documentation is hosted here: https://ignite.apache.org/docs/latest/

New metrics subsystem was introduced. It provides the user with the ability to use several independent, pluggable metrics exporters for integration with different third-party monitoring tools.

Here is how you can enable exporters:

Java configuration:

IgniteConfiguration cfg = new IgniteConfiguration();

cfg.setMetricExporterSpi(
  new JmxMetricExporterSpi(),
  new SqlViewMetricExporterSpi());

Spring config file:

<bean class="org.apache.ignite.IgniteConfiguration">
    ...
    <property name="metricExporterSpi">
        <list>
            <bean class="org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi"/>
        </list>
    </property>
    ...
</bean>

All metrics combined into metric registries. Each metric registry describes some Ignite entity, process or subsystem like cache, cache group, transaction processor , etc. See entities for more details. Metrics values are node-local if other not specified.

Out of the box, the following exporters available to the user:

  • org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi
  • org.apache.ignite.spi.metric.sql.SqlViewMetricExporterSpi
  • org.apache.ignite.spi.metric.opencensus.OpenCensusMetricExporterSpi
  • org.apache.ignite.spi.metric.log.LogExporterSpi

If you need integration via any other protocol, please, consider creation of custom implementation of org.apache.ignite.spi.metric.MetricExporterSpi.

🚧

Enabling Collection of Legacy Metrics

To enable metrics collection through previously existed interfaces, you might need to turn on additional parameters. For instance:

Exporters

📘

Note

Exporters are configured during node startup and can't be changed in runtime.

JMX

Exports each metric registry as a separate JMX bean. Each metric in the registry presented by the JMX bean attribute.

Configuration options:

  • filter - predicate that filters metric registries that should not be exported.

SQL View

Exports all metrics as a SQL system view. Name of the view SYS.METRICS.

Columns:

  • NAME - full name of the metric.
  • VALUE - value of the metric.
  • DESCRIPTION - description of the metric.\

Configuration options:

  • filter - predicate that filters metric registries that should not be exported.\

Log

Prints all metrics to the Ignite log each period milliseconds. The log level is info. Output format is {metric_full_name}={metric_value}.

Configuration options:

  • filter - predicate that filters metric registries that should not be exported.
  • period - metrics export are triggered each period milliseconds.

OpenCensus

An exporter that integrates Ignite metriс with the OpenCensus library
It writes Ignite metrics to the MeasureMap each period milliseconds.

📘

Note

  1. ignite-opencensus module should be enabled to be able to use OpenCensus integration.
  2. Additional OpenCensus StatsCollector should be configured to enable metric export to a specific system. Please, see OpenCensusMetricsExporterExample.java as an example and OpenCensus documentation for additional information.

Configuration options:

  • filter - predicate that filters metric registries that should not be exported.
  • period - metrics export are triggered each period milliseconds.
  • sendInstanceName - if enabled, tag with the Ignite instance name will be added to each metric.
  • sendNodeId - if enabled, tag with the Ignite node id will be added to each metric.
  • sendConsistentId - if enabled, tag with the Ignite node consistent id id will be added to each metric.
    Further new subsystem parts will be explained.

Metric management

Following operations for metric management implemented in the org.apache.ignite.mxbean.MetricsMXBean:

  • resetMetrics - resets the current value of the metric to default value. For gauges this operation does nothing.

  • configureHitrate - changes hitrate time interval.

  • configureHistogram - changes histogram bounds.

Configuration survives node restart. configureHitrate and configureHistogram operations are cluster-wide.

Metric types

  • Metric, Gauge - simple metric that provides some value.
    Example: Count of put operation executed for the specific cache.

  • Hitrate metric - metric that shows a count of some events by the last T milliseconds, where T is hitrate time interval. The time interval can be configured dynamically.
    Example: Count of data pages written in the last second.

  • Histogram - metric that counts events that confirmed some bounds. Bounds can be configured dynamically.
    Example: Counts of requests processed faster than [100ms, 250ms, 500ms, slower requests].
    Histogram metric export in JMX exporter: Each interval of the histogram metric exported as a separate JMX bean attribute. Name of the attribute are following: {mname}_{low_bound}_{high_bound}.

    • mname - name of the metric.

    • low_bound - start of the bound. 0 for the first bound.

    • high_bound - end of the bound. inf for the last bound.

      Example of metric names if bounds are [10,100]:

    • histogram_0_10 - less than 10.

    • histogram_10_100 - between 10 and 100.

    • histogram_100_inf - more than 100.

Entities

  • Metric - named entity that provides some value updated by a known algorithm.
    The current value is stored inside the metric and updated by the Ignite internal code in runtime.
    Example: Count of put operations for the specific cache, Count of the written page since node start.

  • Gauge - named entity that provides value calculated by a known algorithm. Current value not stored and calculated on demand.

  • Metric registry - named set of the metric. Metrics logically grouped into registries to describe all aspects of some entity or subsystem.

  • Metric exporter - Ignite SPI(MetricExporterSPI) implementation that can export metric by some specific protocol.
    Exporters configured via IgniteConfiguration#setMetricExporterSpi. One can configure several exporters and provide custom exporter.

Metric naming

The full metric name consists of two parts - registry name and metric name. We use a dot as a separator of name parts.
Example of metrics full name:

  • "cache.my-cache.puts" - name of the metric contains puts operation for "my-cache" in "cache.my-cache" registry.
  • "cache.my-other-cache.puts" - name of the metric contains puts operation for "my-other-cache" in "cache.my-other-cache" registry.