This is an automated email from the ASF dual-hosted git repository. abudnikov pushed a commit to branch IGNITE-7595 in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/IGNITE-7595 by this push: new 3c6802f update the new metrics page 3c6802f is described below commit 3c6802f12cf59de5e123c1c0f3d54218e7620492 Author: abudnikov <abudni...@gridgain.com> AuthorDate: Fri Aug 7 18:02:25 2020 +0300 update the new metrics page --- docs/README.adoc | 1 - docs/_data/toc.yaml | 6 +- .../apache/ignite/snippets/ConfiguringMetrics.java | 57 ++++++++++- docs/_docs/code-snippets/xml/metrics.xml | 37 +++++++ docs/_docs/monitoring-metrics/new-metrics.adoc | 110 ++++++++++++++++++++- 5 files changed, 207 insertions(+), 4 deletions(-) diff --git a/docs/README.adoc b/docs/README.adoc index 9412629..fd97e6f 100644 --- a/docs/README.adoc +++ b/docs/README.adoc @@ -95,7 +95,6 @@ link:https://docs.oracle.com/javase/8/docs/technotes/guides/security/SunProvider ---- - === Tabs We use custom syntax to insert tabs. Tabs are used to provide code samples for different programming languages. diff --git a/docs/_data/toc.yaml b/docs/_data/toc.yaml index d3542e4..a1238d8 100644 --- a/docs/_data/toc.yaml +++ b/docs/_data/toc.yaml @@ -18,7 +18,11 @@ - title: Google Kubernetes Engine url: /installation/kubernetes/gke-deployment - title: Setting Up - url: /setup + items: + - title: Setting Up GridGain for Java + url: /developers-guide/setup + - title: Setting Up GridGain for .NET/C# + url: /developers-guide/setup-dotnet - title: Understanding Configuration url: /understanding-configuration - title: Configuring Logging diff --git a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/ConfiguringMetrics.java b/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/ConfiguringMetrics.java index 498cad9..fa7f196 100644 --- a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/ConfiguringMetrics.java +++ b/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/ConfiguringMetrics.java @@ -7,6 +7,7 @@ import org.apache.ignite.configuration.DataRegionConfiguration; import org.apache.ignite.configuration.DataStorageConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi; +import org.apache.ignite.spi.metric.log.LogExporterSpi; import org.apache.ignite.spi.metric.sql.SqlViewMetricExporterSpi; import org.junit.jupiter.api.Test; @@ -92,8 +93,62 @@ public class ConfiguringMetrics { cfg.setMetricExporterSpi(new JmxMetricExporterSpi(), new SqlViewMetricExporterSpi()); - Ignition.start(cfg); + Ignite ignite = Ignition.start(cfg); //end::new-metric-framework[] + ignite.close(); + } + + @Test + void sqlExporter() { + + //tag::sql-exporter[] + IgniteConfiguration cfg = new IgniteConfiguration(); + + SqlViewMetricExporterSpi jmxExporter = new SqlViewMetricExporterSpi(); + + //export cache metrics only + jmxExporter.setExportFilter(mreg -> mreg.name().startsWith("cache.")); + + cfg.setMetricExporterSpi(jmxExporter); + //end::sql-exporter[] + + Ignition.start(cfg).close(); + } + + @Test + void jmxExporter() { + + //tag::metrics-filter[] + IgniteConfiguration cfg = new IgniteConfiguration(); + + JmxMetricExporterSpi jmxExporter = new JmxMetricExporterSpi(); + + //export cache metrics only + jmxExporter.setExportFilter(mreg -> mreg.name().startsWith("cache.")); + + cfg.setMetricExporterSpi(jmxExporter); + //end::metrics-filter[] + + Ignition.start(cfg).close(); + } + + @Test + void logExporter() { + + //tag::log-exporter[] + IgniteConfiguration cfg = new IgniteConfiguration(); + + LogExporterSpi logExporter = new LogExporterSpi(); + + //export cache metrics only + logExporter.setExportFilter(mreg -> mreg.name().startsWith("cache.")); + + cfg.setMetricExporterSpi(logExporter); + + Ignite ignite = Ignition.start(cfg); + //end::log-exporter[] + + ignite.close(); } } diff --git a/docs/_docs/code-snippets/xml/metrics.xml b/docs/_docs/code-snippets/xml/metrics.xml new file mode 100644 index 0000000..4ac24b9 --- /dev/null +++ b/docs/_docs/code-snippets/xml/metrics.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> + <!-- tag::ignite-config[] --> + <bean class="org.apache.ignite.configuration.IgniteConfiguration"> + <property name="metricExporterSpi"> + <list> + <!-- tag::jmx-exporter[] --> + <bean class="org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi"/> + <!-- end::jmx-exporter[] --> + <!-- tag::sql-exporter[] --> + <bean class="org.apache.ignite.spi.metric.sql.SqlViewMetricExporterSpi"/> + <!-- end::sql-exporter[] --> + <!-- tag::log-exporter[] --> + <bean class="org.apache.ignite.spi.metric.log.LogExporterSpi"/> + <!-- end::log-exporter[] --> + </list> + </property> + <!-- tag::discovery[] --> + <property name="discoverySpi"> + <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> + <!-- prevent this client from reconnecting on connection loss --> + <property name="clientReconnectDisabled" value="true"/> + <property name="ipFinder"> + <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> + <property name="addresses"> + <list> + <value>127.0.0.1:47500..47509</value> + </list> + </property> + </bean> + </property> + </bean> + </property> + <!-- end::discovery[] --> + </bean> + <!-- end::ignite-config[] --> +</beans> diff --git a/docs/_docs/monitoring-metrics/new-metrics.adoc b/docs/_docs/monitoring-metrics/new-metrics.adoc index ddb34d9..c79ba05 100644 --- a/docs/_docs/monitoring-metrics/new-metrics.adoc +++ b/docs/_docs/monitoring-metrics/new-metrics.adoc @@ -2,18 +2,126 @@ :javaFile: {javaCodeDir}/ConfiguringMetrics.java +WARNING: Experimental + +Ignite 2.8 introduced a new mechanism for collecting metrics which is intended to replace the legacy metrics system. + +Let's first explore the basic concepts of the new metrics mechanism in Ignite. + +There are different metrics, and then there are different ways to export the metrics — what we call _exporters_. +To put it another way, the exporter are different ways you can access the metrics. + +Each metric has a name and a return value. +The return value can be a simple value like `String`, `long`, or `double`, or can represent a Java object. +Some metrics represent <<histograms>>. + +Ignite includes the following exporters: + +* JMX +* SQL Views +* Log files +* Open Census + +You can create a custom exporter by implementing the javadoc:org.apache.ignite.spi.metric.MetricExporterSpi[] interface. + + +== Configuring Metric Exporters + +If you want to enable metrics, configure one or multiple metric exporters in the node configuration. +This is a node-specific configuration, which means it enables metrics only on the node where it is specified. + [tabs] -- tab:XML[] +[source, xml] +---- +include::code-snippets/xml/metrics.xml[tags=ignite-config;!discovery, indent=0] +---- tab:Java[] [source, java] ---- -include::{javaFile}[tags=, indent=0] +include::{javaFile}[tags=new-metric-framework, indent=0] ---- +tab:C#/.NET[] + +tab:C++[unsupported] +-- + +The following sections describe the exporters available in Ignite by default. + + +=== JMX + +`org.apache.ignite.spi.metric.jmx.JmxMetricExporterSpi` exposes metrics via JMX beans. + +[tabs] +-- +tab:Java[] +[source, java] +---- +include::{javaFile}[tags=metrics-filter, indent=0] +---- + +tab:C#/.NET[] + +tab:C++[unsupported] +-- + + +=== SQL View + +`org.apache.ignite.spi.metric.sql.SqlViewMetricExporterSpi` exposes metrics via the `SYS.METRICS` view. +Each metric is displayed as a single record. + +[tabs] +-- +tab:XML[] +[source, xml] +---- +include::code-snippets/xml/metrics.xml[tags=!*;ignite-config;sql-exporter, indent=0] +---- + +tab:Java[] + +[source, java] +---- +include::{javaFile}[tags=sql-exporter, indent=0] +---- + +tab:C#/.NET[] +tab:C++[] +-- + +=== Log + +`org.apache.ignite.spi.metric.log.LogExporterSpi` prints the metrics to the log file at regular intervals (1 min by default) at INFO level. + +[tabs] +-- +tab:XML[] + +[source, xml] +---- +include::code-snippets/xml/metrics.xml[tags=!*;ignite-config;log-exporter, indent=0] +---- + + +tab:Java[] +[source, java] +---- +include::{javaFile}[tags=log-exporter, indent=0] +---- tab:C#/.NET[] tab:C++[] -- + +=== OpenCensus + +`org.apache.ignite.spi.metric.opencensus.OpenCensusMetricExporterSpi` + +== Histograms +