org.apache.ignite.spi.tracing.opencensus

## Class OpenCensusTracingSpi

- java.lang.Object
- - org.apache.ignite.spi.IgniteSpiAdapter
  - - org.apache.ignite.spi.tracing.opencensus.OpenCensusTracingSpi

- All Implemented Interfaces:
    IgniteSpi, TracingSpi<OpenCensusSpanAdapter>

      @IgniteSpiMultipleInstancesSupport(value=true)
       @IgniteSpiConsistencyChecked(optional=true)
      public class OpenCensusTracingSpi
      extends IgniteSpiAdapter
      implements TracingSpi<OpenCensusSpanAdapter>

  Tracing SPI implementation based on OpenCensus library. If you have OpenCensus Tracing in your environment use the following code for configuration: `IgniteConfiguration cfg; cfg.setTracingSpi(new OpenCensusTracingSpi());` If you don't have OpenCensus Tracing: `IgniteConfiguration cfg; cfg.setTracingSpi(new OpenCensusTracingSpi(new ZipkinExporterHandler(...)));` See constructors description for detailed explanation.

- - ### Field Summary

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

      `ignite, igniteInstanceName, log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OpenCensusTracingSpi()` This constructor is used if environment (JVM) already has OpenCensus tracing.
    `OpenCensusTracingSpi(io.opencensus.trace.export.SpanExporter.Handler... exporters)` This constructor is used if environment (JVM) hasn't OpenCensus tracing.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `OpenCensusSpanAdapter` | `create(@NotNull String name, @Nullable byte[] parentSerializedSpan)` Creates Span given name and explicit parent.
    `@NotNull OpenCensusSpanAdapter` | `create(@NotNull String name, @Nullable OpenCensusSpanAdapter parentSpan)` Creates Span given name and explicit parent.
    `String` | `getName()` Gets SPI name.
    `byte[]` | `serialize(@NotNull OpenCensusSpanAdapter span)` Serializes span to byte array to send context over network.
    `void` | `spiStart(String igniteInstanceName)` This method is called to start SPI.
    `void` | `spiStop()` This method is called to stop SPI.
    `byte` | `type()`

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

      `addTimeoutObject, assertParameter, checkConfigurationConsistency0, clientFailureDetectionTimeout, configInfo, createSpiAttributeName, failureDetectionTimeout, failureDetectionTimeoutEnabled, failureDetectionTimeoutEnabled, getConsistentAttributeNames, getExceptionRegistry, getLocalNode, getNodeAttributes, getSpiContext, ignite, initFailureDetectionTimeout, injectables, injectResources, isNodeStopping, onBeforeStart, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextDestroyed0, onContextInitialized, onContextInitialized0, 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

      `getNodeAttributes, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized`

- - ### Constructor Detail

    - #### OpenCensusTracingSpi

          public OpenCensusTracingSpi()

      This constructor is used if environment (JVM) already has OpenCensus tracing. In this case traces from the node will go trough externally registered exporters by an user himself.
      See Also:
        `Tracing.getExportComponent()`

    - #### OpenCensusTracingSpi

          public OpenCensusTracingSpi(io.opencensus.trace.export.SpanExporter.Handler... exporters)

      This constructor is used if environment (JVM) hasn't OpenCensus tracing. In this case provided exporters will start and traces from the node will go through it.
      Parameters:
        `exporters` - Exporters.

  - ### Method Detail

    - #### create

          public OpenCensusSpanAdapter create(@NotNull
                                              @NotNull String name,
                                              @Nullable
                                              @Nullable byte[] parentSerializedSpan)
                                       throws Exception

      Creates Span given name and explicit parent.
      Specified by:
        `create` in interface `TracingSpi<OpenCensusSpanAdapter>`
      Parameters:
        `name` - Name of span to create.
        `parentSerializedSpan` - Parent span as serialized bytes.
      Returns:
        Created span.
      Throws:
        `Exception` - If failed to deserialize patent span.

    - #### create

          @NotNull
          public @NotNull OpenCensusSpanAdapter create(@NotNull
                                                                @NotNull String name,
                                                                @Nullable
                                                                @Nullable OpenCensusSpanAdapter parentSpan)

      Creates Span given name and explicit parent.
      Specified by:
        `create` in interface `TracingSpi<OpenCensusSpanAdapter>`
      Parameters:
        `name` - Name of span to create.
        `parentSpan` - Parent span.
      Returns:
        Span instance.

    - #### serialize

          public byte[] serialize(@NotNull
                                  @NotNull OpenCensusSpanAdapter span)

      Serializes span to byte array to send context over network.
      Specified by:
        `serialize` in interface `TracingSpi<OpenCensusSpanAdapter>`
      Parameters:
        `span` - Span.
      Returns:
        Span instance.

    - #### getName

          public String getName()

      Gets SPI name.
      Specified by:
        `getName` in interface `IgniteSpi`
      Overrides:
        `getName` in class `IgniteSpiAdapter`
      Returns:
        SPI name.

    - #### spiStart

          public void spiStart(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`
      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.

    - #### spiStop

          public void spiStop()
                       throws IgniteSpiException

      This method is called to stop SPI. After this method returns kernel assumes that this SPI is finished and all resources acquired by it are released.

      Note that this method can be called at any point including during recovery of failed start. It should make no assumptions on what state SPI will be in when this method is called.

      Specified by:
        `spiStop` in interface `IgniteSpi`
      Throws:
        `IgniteSpiException` - Thrown in case of any error during SPI stop.

    - #### type

          public byte type()

      Specified by:
        `type` in interface `TracingSpi<OpenCensusSpanAdapter>`
      Returns:
        type of tracing spi as byte.

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.13.0
Release Date | : April 20 2022