com.hazelcast.jet.config

## Class MetricsConfig

- java.lang.Object
- - com.hazelcast.jet.config.MetricsConfig

-     public class MetricsConfig
      extends Object

  Configuration options specific to metrics collection.
  Since:
    3.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_METRICS_COLLECTION_SECONDS` Default collection interval for metrics
    `static int` | `DEFAULT_METRICS_RETENTION_SECONDS` Default retention period for metrics.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MetricsConfig()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getCollectionIntervalSeconds()` Returns the metrics collection interval.
    `int` | `getRetentionSeconds()` Returns the number of seconds the metrics will be retained on the instance.
    `boolean` | `isEnabled()` Returns if metrics collection is enabled.
    `boolean` | `isJmxEnabled()` Returns whether metrics will be exposed through JMX MBeans.
    `boolean` | `isMetricsForDataStructuresEnabled()` Returns if statistics for data structures are added to metrics.
    `MetricsConfig` | `setCollectionIntervalSeconds(int intervalSeconds)` Sets the metrics collection interval in seconds.
    `MetricsConfig` | `setEnabled(boolean enabled)` Sets whether metrics collection should be enabled for the node.
    `MetricsConfig` | `setJmxEnabled(boolean jmxEnabled)` Enables metrics exposure through JMX.
    `MetricsConfig` | `setMetricsForDataStructuresEnabled(boolean metricsForDataStructuresEnabled)` Sets whether statistics for data structures are added to metrics.
    `MetricsConfig` | `setRetentionSeconds(int retentionSeconds)` Returns the number of seconds the metrics will be retained on the instance.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_METRICS_COLLECTION_SECONDS

          public static final int DEFAULT_METRICS_COLLECTION_SECONDS

      Default collection interval for metrics
      See Also:
        Constant Field Values

    - #### DEFAULT_METRICS_RETENTION_SECONDS

          public static final int DEFAULT_METRICS_RETENTION_SECONDS

      Default retention period for metrics.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### MetricsConfig

          public MetricsConfig()

  - ### Method Detail

    - #### setEnabled

          @Nonnull
          public MetricsConfig setEnabled(boolean enabled)

      Sets whether metrics collection should be enabled for the node. If enabled, Hazelcast Jet Management Center will be able to connect to this member. This option is also required for other metrics related functionality. It's enabled by default.

    - #### isEnabled

          public boolean isEnabled()

      Returns if metrics collection is enabled.

    - #### isJmxEnabled

          public boolean isJmxEnabled()

      Returns whether metrics will be exposed through JMX MBeans.

    - #### setJmxEnabled

          public MetricsConfig setJmxEnabled(boolean jmxEnabled)

      Enables metrics exposure through JMX. It's enabled by default. Needs `isEnabled()` to be on in order to function.

      Metric values are collected in the metric collection interval and written to a set of MBeans.

      Metrics are exposed by converting the metric name to a structure that will be rendered in a tree structure in tools showing the beans (Java Mission Control or JConsole). MBean is identified by a `ObjectName` which contains tag-value tuples. Although the order of tags is insignificant to the identity, the UI tools use the order of tags to generate tree structure and only display the values, not the tag names. Metric names also have tags and values, but in order to display the tag name in the UI, we use `"tag=value"` as a value. For example, the metric:

               [module=jet,job=123,vertex=a,metric=emittedCount]

      will be rendered as an attribute named `emittedCount` in an MBean identified by:

               com.hazelcast.jet:type=Metrics,instance=<instanceName>,tag0="job=123",tag1="vertex=a"

      This will cause the MBean to be rendered in a tree under `com.hazelcast.jet/Metrics/<instanceName>/job=123/vertex=a` nodes. For the old-style metric names, the name will be split on dots ('.') and a tag will be created for each level. The element after the last dot will be used as metric name.

      Also some other tags are treated specially, namely `unit` (it is copied to attribute description), `module` (it is appended to the domain) and `metric` (it will be converted to attribute name in the MBean).

    - #### setRetentionSeconds

          @Nonnull
          public MetricsConfig setRetentionSeconds(int retentionSeconds)

      Returns the number of seconds the metrics will be retained on the instance. By default, metrics are retained for 5 seconds (that is for one collection of metrics values, if default collection interval is used). More retention means more heap memory, but allows for longer client hiccups without losing a value (for example to restart the Management Center).

      This setting applies only to Jet Management Center metrics API. It doesn't affect how metrics are exposed through JMX.

    - #### getRetentionSeconds

          public int getRetentionSeconds()

      Returns the number of seconds the metrics will be retained on the instance.

    - #### setCollectionIntervalSeconds

          @Nonnull
          public MetricsConfig setCollectionIntervalSeconds(int intervalSeconds)

      Sets the metrics collection interval in seconds. The same interval is used for Management Center, for JMX and for metrics returned by `Job.getMetrics()`.

      By default, metrics are collected every seconds.

    - #### getCollectionIntervalSeconds

          public int getCollectionIntervalSeconds()

      Returns the metrics collection interval.

    - #### setMetricsForDataStructuresEnabled

          @Nonnull
          public MetricsConfig setMetricsForDataStructuresEnabled(boolean metricsForDataStructuresEnabled)

      Sets whether statistics for data structures are added to metrics. See `Diagnostics.METRICS_DISTRIBUTED_DATASTRUCTURES`. It's disabled by default.

    - #### isMetricsForDataStructuresEnabled

          public boolean isMetricsForDataStructuresEnabled()

      Returns if statistics for data structures are added to metrics. See `Diagnostics.METRICS_DISTRIBUTED_DATASTRUCTURES`.

Copyright © 2019. All rights reserved.