Class PushMetricsExporterAdapter
- java.lang.Object
-
- org.apache.ignite.spi.IgniteSpiAdapter
-
- org.apache.ignite.internal.processors.metric.PushMetricsExporterAdapter
-
- All Implemented Interfaces:
IgniteSpi,MetricExporterSpi
- Direct Known Subclasses:
LogExporterSpi
public abstract class PushMetricsExporterAdapter extends IgniteSpiAdapter implements MetricExporterSpi
Base class for exporters that pushes metrics to the external system.
-
-
Field Summary
Fields Modifier and Type Field Description static longDFLT_EXPORT_PERIODDefault export period in milliseconds.protected @Nullable Predicate<ReadOnlyMetricRegistry>filterMetric filter.protected ReadOnlyMetricManagermregMetric registry.-
Fields inherited from class org.apache.ignite.spi.IgniteSpiAdapter
ignite, igniteInstanceName, log
-
-
Constructor Summary
Constructors Constructor Description PushMetricsExporterAdapter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidexport()Callback to do the export of metrics info.longgetPeriod()protected voidonContextInitialized0(IgniteSpiContext spiCtx)Method to be called in the end of onContextInitialized method.voidsetExportFilter(Predicate<ReadOnlyMetricRegistry> filter)Sets export filter.voidsetMetricRegistry(ReadOnlyMetricManager mreg)Sets metrics registry that SPI should export.voidsetPeriod(long period)Sets period in milliseconds afterexport()method should be called.voidspiStart(@Nullable String igniteInstanceName)This method is called to start SPI.voidspiStop()This method is called to stop SPI.-
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
-
DFLT_EXPORT_PERIOD
public static final long DFLT_EXPORT_PERIOD
Default export period in milliseconds.- See Also:
- Constant Field Values
-
mreg
protected ReadOnlyMetricManager mreg
Metric registry.
-
filter
@Nullable protected @Nullable Predicate<ReadOnlyMetricRegistry> filter
Metric filter.
-
-
Method Detail
-
spiStart
public void spiStart(@Nullable @Nullable String igniteInstanceName) throws IgniteSpiExceptionThis method is called to start SPI. After this method returns successfully kernel assumes that SPI is fully operational.- Specified by:
spiStartin interfaceIgniteSpi- Parameters:
igniteInstanceName- Name of Ignite instance this SPI is being started for (nullfor default Ignite instance).- Throws:
IgniteSpiException- Throws in case of any error during SPI start.
-
spiStop
public void spiStop() throws IgniteSpiExceptionThis 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:
spiStopin interfaceIgniteSpi- Throws:
IgniteSpiException- Thrown in case of any error during SPI stop.
-
export
public abstract void export()
Callback to do the export of metrics info. Method will be called into some Ignite managed thread eachgetPeriod()millisecond.
-
setPeriod
public void setPeriod(long period)
Sets period in milliseconds afterexport()method should be called.- Parameters:
period- Period in milliseconds.
-
getPeriod
public long getPeriod()
- Returns:
- Period in milliseconds after
export()method should be called.
-
setMetricRegistry
public void setMetricRegistry(ReadOnlyMetricManager mreg)
Sets metrics registry that SPI should export. This method called beforeIgniteSpi.spiStart(String).- Specified by:
setMetricRegistryin interfaceMetricExporterSpi- Parameters:
mreg- Metric registry.
-
setExportFilter
public void setExportFilter(Predicate<ReadOnlyMetricRegistry> filter)
Sets export filter. Metric registry that not satisfyfiltershouldn't be exported.- Specified by:
setExportFilterin interfaceMetricExporterSpi- Parameters:
filter- Filter.- See Also:
RegexpMetricFilter
-
onContextInitialized0
protected void onContextInitialized0(IgniteSpiContext spiCtx) throws IgniteSpiException
Method to be called in the end of onContextInitialized method.- Overrides:
onContextInitialized0in classIgniteSpiAdapter- Parameters:
spiCtx- SPI context.- Throws:
IgniteSpiException- In case of errors.
-
-