Package org.apache.ignite.spi.metric.opencensus

## Class OpenCensusMetricExporterSpi

- java.lang.Object
- - org.apache.ignite.spi.IgniteSpiAdapter
  - - org.apache.ignite.internal.processors.metric.PushMetricsExporterAdapter
    - - org.apache.ignite.spi.metric.opencensus.OpenCensusMetricExporterSpi

- All Implemented Interfaces:
    `IgniteSpi`, `MetricExporterSpi`

      public class OpenCensusMetricExporterSpi
      extends org.apache.ignite.internal.processors.metric.PushMetricsExporterAdapter

  OpenCensus monitoring exporter.
  This class will export all Ignite metrics with the OpenCensus API.
  Please, note, metrics recorded with the OpenCensus API each `PushMetricsExporterAdapter.period` milliseconds.
  To enable export from OpenCensus to the wild user should configure OpenCensus exporter. Please, see OpenCensus documentation for additional information. Example of exporter configuration:

         PrometheusStatsCollector.createAndRegister();

         HTTPServer server = new HTTPServer("localhost", 8888, true);

  See Also:
    `MetricRegistry`, `GridMetricManager`, `ReadOnlyMetricManager`

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static io.opencensus.tags.TagKey` | `CONSISTENT_ID_TAG` | Ignite node consistent id.
    `static io.opencensus.tags.TagKey` | `INSTANCE_NAME_TAG` | Ignite instance name.
    `static io.opencensus.tags.TagMetadata` | `METADATA` | Tags metadata.
    `static io.opencensus.tags.TagKey` | `NODE_ID_TAG` | Ignite node id.

    - ### Fields inherited from class org.apache.ignite.internal.processors.metric.PushMetricsExporterAdapter

      `DFLT_EXPORT_PERIOD, filter, mreg`

    - ### Fields inherited from class org.apache.ignite.spi.IgniteSpiAdapter

      `ignite, igniteInstanceName, log`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `OpenCensusMetricExporterSpi()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `export()` | Callback to do the export of metrics info.
    `protected void` | `onContextInitialized0​(IgniteSpiContext spiCtx)` | Method to be called in the end of onContextInitialized method.
    `void` | `setSendConsistentId​(boolean sendConsistentId)` | If `true` then `CONSISTENT_ID_TAG` will be added to each exported measure.
    `void` | `setSendInstanceName​(boolean sendInstanceName)` | If `true` then `INSTANCE_NAME_TAG` will be added to each exported measure.
    `void` | `setSendNodeId​(boolean sendNodeId)` | If `true` then `NODE_ID_TAG` will be added to each exported measure.
    `void` | `spiStart​(@Nullable String igniteInstanceName)` | This method is called to start SPI.

    - ### Methods inherited from class org.apache.ignite.internal.processors.metric.PushMetricsExporterAdapter

      `getPeriod, setExportFilter, setMetricRegistry, setPeriod, spiStop`

    - ### Methods inherited from class org.apache.ignite.spi.IgniteSpiAdapter

      `addTimeoutObject, assertParameter, checkConfigurationConsistency0, clientFailureDetectionTimeout, configInfo, createSpiAttributeName, failureDetectionTimeout, failureDetectionTimeoutEnabled, failureDetectionTimeoutEnabled, getConsistentAttributeNames, getExceptionRegistry, getLocalNode, getName, getNodeAttributes, getSpiContext, ignite, initFailureDetectionTimeout, injectables, injectResources, isNodeStopping, onBeforeStart, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextDestroyed0, onContextInitialized, registerMBean, removeTimeoutObject, setName, started, startInfo, startStopwatch, stopInfo, unregisterMBean`

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

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

    - ### Methods inherited from interface org.apache.ignite.spi.IgniteSpi

      `getName, getNodeAttributes, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized`

- - ### Field Detail

    - #### INSTANCE_NAME_TAG

          public static final io.opencensus.tags.TagKey INSTANCE_NAME_TAG

      Ignite instance name.

    - #### NODE_ID_TAG

          public static final io.opencensus.tags.TagKey NODE_ID_TAG

      Ignite node id.

    - #### CONSISTENT_ID_TAG

          public static final io.opencensus.tags.TagKey CONSISTENT_ID_TAG

      Ignite node consistent id.

    - #### METADATA

          public static final io.opencensus.tags.TagMetadata METADATA

      Tags metadata.

  - ### Constructor Detail

    - #### OpenCensusMetricExporterSpi

          public OpenCensusMetricExporterSpi()

  - ### Method Detail

    - #### export

          public void export()

      Callback to do the export of metrics info. Method will be called into some Ignite managed thread each `PushMetricsExporterAdapter.getPeriod()` millisecond.
      Specified by:
        `export` in class `org.apache.ignite.internal.processors.metric.PushMetricsExporterAdapter`

    - #### spiStart

          public void spiStart​(@Nullable
                               @Nullable String igniteInstanceName)
                        throws IgniteSpiException

      This method is called to start SPI. After this method returns successfully kernel assumes that SPI is fully operational.
      Specified by:
        `spiStart` in interface `IgniteSpi`
      Overrides:
        `spiStart` in class `org.apache.ignite.internal.processors.metric.PushMetricsExporterAdapter`
      Parameters:
        `igniteInstanceName` - Name of Ignite instance this SPI is being started for (`null` for default Ignite instance).
      Throws:
        `IgniteSpiException` - Throws in case of any error during SPI start.

    - #### onContextInitialized0

          protected void onContextInitialized0​(IgniteSpiContext spiCtx)
                                        throws IgniteSpiException

      Method to be called in the end of onContextInitialized method.
      Overrides:
        `onContextInitialized0` in class `org.apache.ignite.internal.processors.metric.PushMetricsExporterAdapter`
      Parameters:
        `spiCtx` - SPI context.
      Throws:
        `IgniteSpiException` - In case of errors.

    - #### setSendInstanceName

          public void setSendInstanceName​(boolean sendInstanceName)

      If `true` then `INSTANCE_NAME_TAG` will be added to each exported measure.
      Parameters:
        `sendInstanceName` - Flag value.

    - #### setSendNodeId

          public void setSendNodeId​(boolean sendNodeId)

      If `true` then `NODE_ID_TAG` will be added to each exported measure.
      Parameters:
        `sendNodeId` - Flag value.

    - #### setSendConsistentId

          public void setSendConsistentId​(boolean sendConsistentId)

      If `true` then `CONSISTENT_ID_TAG` will be added to each exported measure.
      Parameters:
        `sendConsistentId` - Flag value.