How to enable Ignite metrics

There is a lot of pre-configured metrics in Ignite that disabled for default. If you want to see them, you may pass instance of LogExporterSpi to IgniteConfiguration like that:

public IgniteConfiguration clientIgniteConfiguration() {
    IgniteConfiguration igniteConfiguration = new IgniteConfiguration();

    // Default metrics, that enabled for default
    // To disable them, you need to set this to 0
    igniteConfiguration.setMetricsLogFrequency(120_000);

    // Additional metrics, that disabled for default
    LogExporterSpi logExporter = new LogExporterSpi();
    logExporter.setPeriod(120_000);
    igniteConfiguration.setMetricExporterSpi(logExporter);

    ...
    return igniteConfiguration;
}

You can work with Ignite metrics by some number of ways, not only through the logging system. For example:

  • JMX
  • SQL Views
  • OpenCensus

Please, refer to Ignite documentation for details.

You can filter metrics that you need. For example, if you need only io.communication and sys metric groups, you need to add this line:

logExporter.setExportFilter(mreg -> {
    return mreg.name().startsWith("io.communication") || mreg.name().startsWith("sys")
});

If you want to see the names of all the groups, you can do this trick:

logExporter.setExportFilter(mreg -> {
    System.out.println("Group Name: " + mreg.name());
    return true;
});
Telegram channel

If you still have any questions, feel free to ask me in the comments under this article or write me at promark33@gmail.com.

If I saved your day, you can support me 🤝

Leave a Reply

Your email address will not be published. Required fields are marked *