public class OpenTelemetryMetricExporterSpi
extends org.apache.ignite.internal.processors.metric.PushMetricsExporterAdapter
This exporter runs a background task that fires every PushMetricsExporterAdapter.getPeriod() milliseconds and pushes the current
snapshot of all metric registries to the configured OTLP endpoint. Each Ignite node exports its own metrics and
identifies itself via the
OpenTelemetry service resource attributes:
service.namespace — set via setServiceNamespace(String)service.name — set via setServiceName(String);
defaults to the cluster tag (see IgniteCluster.tag()) if not specifiedservice.instance.id — automatically set to the node's consistent ID
Two wire protocols are supported (see Protocol):
Protocol.GRPC (default) — OTLP over gRPCProtocol.HTTP — OTLP over HTTP/protobufsetEndpoint(String) and must follow the pattern
http(s)://host:port. The default endpoint is "http://localhost:4317".
Payload compression is controlled by setCompression(Compression). Supported types are
Compression.NONE (default) and Compression.GZIP.
Secure connections are enabled by setting setSslEnabled(boolean) to true.
By default, the SPI will reuse the Factory<SSLContext> already
configured in IgniteConfiguration.setSslContextFactory(Factory)
(controlled by setUseIgniteSslContextFactory(boolean)).
A dedicated SSL context factory can be provided via setSslContextFactory(Factory).
An instance of SslContextFactory is the recommended implementation because it
supplies both the SSLContext and the TrustManager from a single
object. When a different Factory<SSLContext> is used, a
separate trust-manager factory must be configured.
Arbitrary HTTP/gRPC metadata headers (e.g. authentication tokens) can be injected into every export request
via setConnectionHeaders(Map).
OpenTelemetryMetricExporterSpi spi = new OpenTelemetryMetricExporterSpi();
spi.setEndpoint("http://otel-collector:4317");
spi.setProtocol(Protocol.GRPC);
spi.setCompression(Compression.GZIP);
spi.setPeriod(30_000L); // export every 30 seconds
spi.setServiceNamespace("my-org");
spi.setServiceName("ignite-cluster");
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setMetricExporterSpi(spi);
Protocol,
Compression,
PushMetricsExporterAdapter,
OTLP specification,
Service semantic conventions| Modifier and Type | Field and Description |
|---|---|
static Compression |
DEFAULT_COMPRESSION
Default compression type.
|
static String |
DEFAULT_ENDPOINT
Default endpoint URL.
|
static Protocol |
DEFAULT_PROTOCOL
Default protocol type that is used to export metrics.
|
static boolean |
DFLT_USE_IGNITE_SSL_CTX_FACTORY
By default OTLP exporter uses SSL context factory from Ignite configuration.
|
DFLT_EXPORT_PERIOD, filter, mregignite, igniteInstanceName, log| Constructor and Description |
|---|
OpenTelemetryMetricExporterSpi() |
| Modifier and Type | Method and Description |
|---|---|
void |
export()
Callback to do the export of metrics info.
|
Compression |
getCompression()
Returns the configured compression type.
|
Map<String,String> |
getConnectionHeaders()
Returns the configured connection headers.
|
String |
getEndpoint()
Returns the configured endpoint.
|
Protocol |
getProtocol()
Returns the configured protocol.
|
String |
getServiceName()
Returns a logical name of the service.
|
String |
getServiceNamespace()
Returns service namespace.
|
javax.cache.configuration.Factory<SSLContext> |
getSslContextFactory()
Returns the configured instance of
Factory that will be used to create an instance of SSLContext. |
javax.cache.configuration.Factory<TrustManager> |
getTrustManagerFactory()
Returns the configured factory to create an instance of
TrustManager. |
boolean |
isSslEnabled()
Returns
true if Secure Socket Layer is enabled and false otherwise. |
boolean |
isUseIgniteSslContextFactory()
Gets whether to use Ignite SSL context factory configured through
IgniteConfiguration.getSslContextFactory() if getSslContextFactory() is not set. |
protected void |
onContextInitialized0(IgniteSpiContext spiCtx)
Method to be called in the end of onContextInitialized method.
|
void |
setCompression(Compression compression)
Sets compression type.
|
void |
setCompression(String compression)
Sets compression type.
|
void |
setConnectionHeaders(Map<String,String> headers)
Sets connection headers.
|
void |
setEndpoint(String endpoint)
Sets the OTLP endpoint to connect to.
|
void |
setProtocol(Protocol protocol)
Sets the OTLP protocol to export metrics.
|
void |
setProtocol(String protocol)
Sets the OTLP protocol to export metrics.
|
void |
setServiceName(String srvcName)
Sets a logical name of the service.
|
void |
setServiceNamespace(String srvcNamespace)
Sets a logical name of a system or application under a common namespace.
|
void |
setSslContextFactory(javax.cache.configuration.Factory<SSLContext> sslFactory)
Sets the given instance of
Factory that will be used to create an instance of SSLContext
for Secure Socket Layer. |
void |
setSslEnabled(boolean sslEnabled)
Sets whether Secure Socket Layer should be enabled.
|
void |
setTrustManagerFactory(javax.cache.configuration.Factory<TrustManager> trustFactory)
Sets the given instance of
Factory that will be used to create an instance of TrustManager. |
void |
setUseIgniteSslContextFactory(boolean useIgniteSslCtxFactory)
Sets whether to use Ignite SSL context factory.
|
void |
spiStop()
This method is called to stop SPI.
|
getPeriod, setExportFilter, setMetricRegistry, setPeriod, spiStartaddTimeoutObject, 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, unregisterMBeanclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetName, getNodeAttributes, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitializedpublic static final Protocol DEFAULT_PROTOCOL
public static final Compression DEFAULT_COMPRESSION
public static final String DEFAULT_ENDPOINT
public static final boolean DFLT_USE_IGNITE_SSL_CTX_FACTORY
public void export()
PushMetricsExporterAdapter.getPeriod() millisecond.export in class org.apache.ignite.internal.processors.metric.PushMetricsExporterAdapterpublic void spiStop()
throws IgniteSpiException
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.
spiStop in interface IgniteSpispiStop in class org.apache.ignite.internal.processors.metric.PushMetricsExporterAdapterIgniteSpiException - Thrown in case of any error during SPI stop.protected void onContextInitialized0(IgniteSpiContext spiCtx) throws IgniteSpiException
onContextInitialized0 in class org.apache.ignite.internal.processors.metric.PushMetricsExporterAdapterspiCtx - SPI context.IgniteSpiException - In case of errors.public void setServiceNamespace(String srvcNamespace)
srvcNamespace - Service namespace.public String getServiceNamespace()
setServiceNamespace(String)public void setServiceName(String srvcName)
If srvcName is null or empty then the cluster tag is used. The default value is null.
srvcName - Service name.IgniteCluster.tag()public String getServiceName()
setServiceName(String)public void setEndpoint(String endpoint)
DEFAULT_ENDPOINT.endpoint - Endpoint to connect to.public String getEndpoint()
setEndpoint(String)public void setProtocol(String protocol)
DEFAULT_PROTOCOL.protocol - Protocol to export metrics.IllegalArgumentException - when the given protocol is not supported.Protocolpublic void setProtocol(Protocol protocol)
protocol - Protocol to export metrics.Protocol,
setProtocol(Protocol)public Protocol getProtocol()
setProtocol(Protocol),
Protocolpublic void setCompression(String compression)
DEFAULT_COMPRESSION.compression - Compression type.IllegalArgumentException - when the given compression is not supported.Compressionpublic void setCompression(Compression compression)
DEFAULT_COMPRESSION.compression - Compression type.Compressionpublic Compression getCompression()
setCompression(Compression),
Compressionpublic void setConnectionHeaders(Map<String,String> headers)
headers - Connection headers.public Map<String,String> getConnectionHeaders()
setConnectionHeaders(Map)public void setSslEnabled(boolean sslEnabled)
Note that if this flag is set to true, then a valid instance of Factory<SSLContext>
should be provided. The default value is false.
sslEnabled - true if SSL should be enabled and false otherwise.setSslContextFactory(Factory),
setUseIgniteSslContextFactory(boolean),
IgniteConfiguration.setSslContextFactory(Factory)public boolean isSslEnabled()
true if Secure Socket Layer is enabled and false otherwise.true if Secure Socket Layer is enabled and false otherwise.setSslEnabled(boolean)public void setUseIgniteSslContextFactory(boolean useIgniteSslCtxFactory)
useIgniteSslCtxFactory - Whether to use Ignite SSL context factory.IgniteConfiguration.setSslContextFactory(Factory)public boolean isUseIgniteSslContextFactory()
IgniteConfiguration.getSslContextFactory() if getSslContextFactory() is not set.true if Ignite SSL context factory should be used.setUseIgniteSslContextFactory(boolean)public void setSslContextFactory(javax.cache.configuration.Factory<SSLContext> sslFactory)
Factory that will be used to create an instance of SSLContext
for Secure Socket Layer. This factory will only be used if setSslEnabled(boolean) is set to true.
An instance of SslContextFactory class can be used
in order to provide SSLContext and TrustManager at the same time.
// Create and setup the factory.
SslContextFactory factory = new SslContextFactory();
factory.setKeyStoreFilePath(keyStorePath);
factory.setKeyStorePassword(keyPass);
factory.setTrustStoreFilePath(trustStorePath);
factory.setTrustStorePassword(trustPass);
...
OpenTelemetryMetricExporterSpi spi = new OpenTelemetryMetricExporterSpi();
// This call overrides {@link #setTrustManagerFactory(Factory)}
// TrustManager is obtained from the {@code factory}.
spi.setSslContextFactory(factory);
sslFactory - Instance of Factory.SslContextFactorypublic javax.cache.configuration.Factory<SSLContext> getSslContextFactory()
Factory that will be used to create an instance of SSLContext.SSLContext.setSslContextFactory(Factory)public void setTrustManagerFactory(javax.cache.configuration.Factory<TrustManager> trustFactory)
Factory that will be used to create an instance of TrustManager.
This factory will only be used if setSslEnabled(boolean) is set to true.trustFactory - Instance of Factory.SslContextFactorypublic javax.cache.configuration.Factory<TrustManager> getTrustManagerFactory()
TrustManager.TrustManager.setTrustManagerFactory(Factory)
GridGain In-Memory Computing Platform : ver. 8.9.33 Release Date : May 7 2026