DenisPolo commented on code in PR #13648:
URL: https://github.com/apache/ignite/pull/13648#discussion_r4333546594
##########
docs/_docs/monitoring-metrics/new-metrics-system.adoc:
##########
@@ -218,6 +218,207 @@ Configuration parameters:
* `sendNodeId` - if enabled, a tag with the Ignite node id is added to each
metric.
* `sendConsistentId` - if enabled, a tag with the Ignite node consistent id is
added to each metric.
+==== Prometheus HTTP and REST Endpoints
+
+`OpenCensusMetricExporterSpi` writes metrics to the OpenCensus API, but does
not start an HTTP endpoint itself.
+To expose the metrics in the Prometheus format, register the Prometheus
collector and start its HTTP server on a port
+that is different from the Ignite REST API port:
+
+[tabs]
+--
+tab:XML[]
+[source, xml]
+----
+<bean id="prometheusStatsCollector"
class="org.springframework.beans.factory.config.MethodInvokingBean">
+ <property name="staticMethod"
+
value="io.opencensus.exporter.stats.prometheus.PrometheusStatsCollector.createAndRegister"/>
+</bean>
+
+<bean id="prometheusHttpServer"
class="io.prometheus.client.exporter.HTTPServer">
+ <!-- Prometheus metrics: http://<node_host>:8082/ -->
+ <constructor-arg type="String" value="0.0.0.0"/>
+ <constructor-arg type="int" value="8082"/>
+ <constructor-arg type="boolean" value="true"/>
+</bean>
+
+<bean id="ignite.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">
+
+ <property name="metricExporterSpi">
+ <list>
+ <bean
class="org.apache.ignite.spi.metric.opencensus.OpenCensusMetricExporterSpi">
+ <property name="period" value="10000"/>
+ <property name="sendNodeId" value="true"/>
+ <property name="sendInstanceName" value="true"/>
+ <property name="sendConsistentId" value="true"/>
+ </bean>
+ </list>
+ </property>
+
+</bean>
+----
+tab:Java[]
+[source, java]
+----
+PrometheusStatsCollector.createAndRegister();
+
+// Prometheus metrics: http://<node_host>:8082/
+HTTPServer metricsServer = new HTTPServer("0.0.0.0", 8082, true);
+
+OpenCensusMetricExporterSpi exporter = new OpenCensusMetricExporterSpi();
+exporter.setPeriod(1_000);
+exporter.setSendNodeId(true);
+exporter.setSendInstanceName(true);
+exporter.setSendConsistentId(true);
+
+IgniteConfiguration cfg = new IgniteConfiguration();
+cfg.setMetricExporterSpi(exporter);
+----
+--
+
+The examples require the `ignite-opencensus` module,
`opencensus-exporter-stats-prometheus`, and Prometheus
`simpleclient_httpserver` as `*.jar` libraries or dependencies:
+
+[source,xml]
+----
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.ignite</groupId>
+ <artifactId>ignite-opencensus</artifactId>
+ <version>${ignite.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>io.opencensus</groupId>
+ <artifactId>opencensus-exporter-stats-prometheus</artifactId>
+ <version>${opencensus.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>io.prometheus</groupId>
+ <artifactId>simpleclient_httpserver</artifactId>
+ <version>${simpleclient.version}</version>
Review Comment:
Deleted
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]