nao-it commented on code in PR #13648:
URL: https://github.com/apache/ignite/pull/13648#discussion_r4186783370
##########
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:
This dependency is transitive when connecting ignite-opencensus, there is no
point in declaring it separately
##########
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>
+ </dependency>
+
+ </dependencies>
+----
+
+The Prometheus client used by Ignite serves metrics at the root path, for
example:
+
+[source,shell]
+----
+curl http://localhost:8082/
+----
+
+The Ignite HTTP REST API is provided by the `ignite-rest-http` module and uses
port `8080` by default.
+Use `IGNITE_JETTY_HOST` and `IGNITE_JETTY_PORT` to change its endpoint.
+For example, the following requests return the cluster state and node data:
+
+[source,shell]
+----
+curl http://localhost:8080/ignite?cmd=state
+curl
"http://localhost:8080/ignite?cmd=node&id=<node-id>&attr=true&mtr=true&caches=true"
+----
+
+See link:restapi[REST API] for the complete configuration and command
reference.
+
+==== Metrics Not Exported by OpenCensus to the Prometheus HTTP Endpoint
+
+The OpenCensus exporter handles `LongMetric`, `IntMetric`, `BooleanMetric`,
`DoubleMetric`, `HistogramMetric`,
+and `ObjectMetric` instances whose declared type is `Date` or `OffsetDateTime`.
+Histogram metrics are exported as separate measures for their buckets.
+In addition, negative values of `LongMetric`, `IntMetric`, `DoubleMetric`,
`Date`, and `OffsetDateTime` metrics
+are skipped.
+
+Therefore, some metrics available through JMX or other Ignite monitoring
interfaces are not available through
+the Prometheus HTTP endpoint when Prometheus is configured through the
OpenCensus exporter.
+
+JMX also exposes other object metric types. Therefore, the following JMX
metrics are not exported through the
+Prometheus HTTP endpoint. A metric registry in angle brackets is created
dynamically.
+
+[cols="25%,40%,35%",options="header"]
+|===
+|Registry
+|Metrics not exported
+|REST alternative
+
+|`ignite`
+a|`fullVersion`, `copyright`, `startTimestampFormatted`, `uptimeFormatted`,
`osInformation`, `jdkInformation`,
+`osUser`, `vmName`, `instanceName`, `currentCoordinatorFormatted`,
`longJVMPauseLastEvents`, `active`,
+`clusterState`, `userAttributesFormatted`, `gridLoggerFormatted`,
`executorServiceFormatted`, `igniteHome`,
+`mBeanServerFormatted`, `localNodeId`, `isPeerClassLoadingEnabled`,
`lifecycleBeansFormatted`,
+`discoverySpiFormatted`, `communicationSpiFormatted`,
`deploymentSpiFormatted`, `checkpointSpiFormatted`,
+`collisionSpiFormatted`, `eventStorageSpiFormatted`, `failoverSpiFormatted`,
`loadBalancingSpiFormatted`
+a|`active` and `clusterState`: `cmd=state`.
+
+`localNodeId`: the `nodeId` field of `cmd=node` or `cmd=top`.
+
+`instanceName` and `isPeerClassLoadingEnabled`: attributes
`org.apache.ignite.ignite.name` and
+`org.apache.ignite.peer.classloading.enabled` returned by `cmd=node&attr=true`
or `cmd=top&attr=true`.
+
+`startTimestampFormatted` and `uptimeFormatted` are available only as
unformatted numeric values in the `metrics`
+object returned with `mtr=true`. Other listed metrics have no REST equivalent.
+
+|`sys`
+|`SystemLoadAverage`
+|No equivalent. The `averageCpuLoad` and `currentCpuLoad` fields returned with
`mtr=true` are different metrics.
+
+|`discovery.<name>`
+|`Coordinator`; `ClientRouterNodeId` for `TcpDiscoverySpi`
+|No direct equivalent. Node IDs are returned by `cmd=node` and `cmd=top`, but
the coordinator and client router are not identified.
+
+|`communication.tcp.<connection>`
+|`consistentId`
+|The `consistentId` field of each node returned by `cmd=node` or `cmd=top`.
+
+|`threadPools.<name>`
+|`RejectedExecutionHandlerClass`, `ThreadFactoryClass`
+|No equivalent.
+
+|`cacheGroups.<cache-group>`
+a|`Caches`, `OwningPartitionsAllocationMap`, `MovingPartitionsAllocationMap`,
+`AffinityPartitionsAssignmentMap`, `PartitionIds`,
`RebalancingFullReceivedKeys`,
+`RebalancingHistReceivedKeys`, `RebalancingFullReceivedBytes`,
`RebalancingHistReceivedBytes`
+|No equivalent. `cmd=node&caches=true` and `cmd=top&caches=true` return a
node's cache configurations, not cache-group allocation metrics.
+
+|`cache.<cache>`
+|`TxKeyCollisions`
+|No equivalent. `cmd=cache` returns only reads, writes, hits, and misses.
+
+|`tx`
+|`AllOwnerTransactions`
+|No equivalent.
+
+|`io.statistics.cacheGroups.<cache-group>`
+|`name`
+|No equivalent.
+
+|`io.statistics.hashIndexes.<index>` or `io.statistics.sortedIndexes.<index>`
+|`name`, `indexName`
+|No equivalent.
+
+|`snapshot`
+|`LastSnapshotName`, `LastSnapshotErrorMessage`, `LocalSnapshotNames`,
`LastRequestId`
+|No equivalent.
+
+|`snapshot.incremental` and `snapshot-restore`
+|`snapshotName`, `requestId`, `error`
Review Comment:
snapshot.incremental doesn't register: requestId
snapshot-restore register: snapshotName, requestId, error
##########
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);
Review Comment:
The above indicates period value=10000 In the examples it is worth giving
the same recommendations
--
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]