Package org.apache.ignite.spi.metric.jmx
Class JmxMetricExporterSpi
- java.lang.Object
- 
- org.apache.ignite.spi.IgniteSpiAdapter
- 
- org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi
 
 
- 
- All Implemented Interfaces:
- IgniteSpi,- MetricExporterSpi
 
 public class JmxMetricExporterSpi extends IgniteSpiAdapter implements MetricExporterSpi OverviewIgnite provides this default built-in implementation ofMetricExporterSpiit exports metrics as JMX beans. This implementation works by `pull` architecture which means that after the Ignite node start it should respond to incoming user request.Java ExampleSee the example below of how the internal metrics can be obtained through your application by constructing MBean names.Ignite ignite = Ignition.start(new IgniteConfiguration() .setDataStorageConfiguration(new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setMaxSize(12_000_000))) .setIgniteInstanceName("jmxExampleInstanceName")); String igniteInstanceName = ignite.name(); String metricGroup = "io"; // NOTE: The special characters of metric name must be escaped. String metricName = "\"dataregion.default\""; SB sb = new SB("org.apache:"); if (IgniteSystemProperties.getBoolean("IGNITE_MBEAN_APPEND_CLASS_LOADER_ID", true)) sb.a("clsLdr=").a(Integer.toHexString(Ignite.class.getClassLoader().hashCode())).a(','); if (IgniteSystemProperties.getBoolean("IGNITE_MBEAN_APPEND_JVM_ID")) sb.a("jvmId=").a(ManagementFactory.getRuntimeMXBean().getName()).a(','); sb.a("igniteInstanceName=").a(igniteInstanceName).a(',') .a("group=").a(metricGroup).a(',') .a("name=").a(metricName); DynamicMBean dataRegionMBean = MBeanServerInvocationHandler.newProxyInstance( ignite.configuration().getMBeanServer(), new ObjectName(sb.toString()), DynamicMBean.class, false); SetlistOfMetrics = Arrays.stream(dataRegionMBean.getMBeanInfo().getAttributes()) .map(MBeanFeatureInfo::getName) .collect(toSet()); System.out.println("The list of available data region metrics: " + listOfMetrics); System.out.println("The 'default' data region MaxSize: " + dataRegionMBean.getAttribute("MaxSize")); 
- 
- 
Field Summary- 
Fields inherited from class org.apache.ignite.spi.IgniteSpiAdapterignite, igniteInstanceName, log
 
- 
 - 
Constructor SummaryConstructors Constructor Description JmxMetricExporterSpi()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsetExportFilter(Predicate<ReadOnlyMetricRegistry> filter)Sets export filter.voidsetMetricRegistry(ReadOnlyMetricManager reg)Sets metrics registry that SPI should export.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.IgniteSpiAdapteraddTimeoutObject, 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, onContextInitialized0, registerMBean, removeTimeoutObject, setName, started, startInfo, startStopwatch, stopInfo, unregisterMBean
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.apache.ignite.spi.IgniteSpigetName, getNodeAttributes, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized
 
- 
 
- 
- 
- 
Method Detail- 
spiStartpublic 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 interface- IgniteSpi
- 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.
 
 - 
spiStoppublic 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 interface- IgniteSpi
- Throws:
- IgniteSpiException- Thrown in case of any error during SPI stop.
 
 - 
setMetricRegistrypublic void setMetricRegistry(ReadOnlyMetricManager reg) Sets metrics registry that SPI should export. This method called beforeIgniteSpi.spiStart(String).- Specified by:
- setMetricRegistryin interface- MetricExporterSpi
- Parameters:
- reg- Metric registry.
 
 - 
setExportFilterpublic void setExportFilter(Predicate<ReadOnlyMetricRegistry> filter) Sets export filter. Metric registry that not satisfyfiltershouldn't be exported.- Specified by:
- setExportFilterin interface- MetricExporterSpi
- Parameters:
- filter- Filter.
- See Also:
- RegexpMetricFilter
 
 
- 
 
-