dsmiley commented on code in PR #3453:
URL: https://github.com/apache/solr/pull/3453#discussion_r2261839053
##########
solr/core/src/java/org/apache/solr/core/ZkContainer.java:
##########
@@ -141,18 +140,82 @@ public void initZooKeeper(final CoreContainer cc,
CloudConfig config) {
}
this.zkController = zkController;
- MetricsMap metricsMap = new
MetricsMap(zkController.getZkClient().getMetrics());
+
metricProducer =
new SolrMetricProducer() {
SolrMetricsContext ctx;
- // TODO SOLR-17458: Migrate to Otel
@Override
public void initializeMetrics(
SolrMetricsContext parentContext, Attributes attributes,
String scope) {
ctx = parentContext.getChildContext(this);
- ctx.gauge(
- metricsMap, true, scope, null,
SolrInfoBean.Category.CONTAINER.toString());
+
+ var metricsListener = zkController.getZkClient().getMetrics();
+
+ ctx.observableLongCounter(
+ "solr_zk_ops",
+ "Total number of ZooKeeper operations",
+ measurement -> {
+ measurement.record(
+ metricsListener.getReads(),
+ attributes.toBuilder().put(OPERATION_ATTR,
"read").build());
+ measurement.record(
+ metricsListener.getDeletes(),
+ attributes.toBuilder().put(OPERATION_ATTR,
"delete").build());
+ measurement.record(
+ metricsListener.getWrites(),
+ attributes.toBuilder().put(OPERATION_ATTR,
"write").build());
+ measurement.record(
+ metricsListener.getMultiOps(),
+ attributes.toBuilder().put(OPERATION_ATTR,
"multi").build());
+ measurement.record(
+ metricsListener.getExistsChecks(),
+ attributes.toBuilder().put(OPERATION_ATTR,
"exists").build());
+ });
+
+ ctx.observableLongCounter(
+ "solr_zk_bytes_read",
+ "Total bytes read from ZooKeeper",
+ measurement -> {
+ measurement.record(metricsListener.getBytesRead(),
attributes);
+ },
+ "By");
+
+ ctx.observableLongCounter(
+ "solr_zk_watches_fired",
+ "Total number of ZooKeeper watches fired",
+ measurement -> {
+ measurement.record(metricsListener.getWatchesFired(),
attributes);
+ });
+
+ ctx.observableLongCounter(
+ "solr_zk_bytes_written_total",
Review Comment:
the excerpt in the PR description shows `solr_zk_bytes_written_bytes_total`
instead of what you have here. What's here looks better, since the PR
description shows "bytes" repeated. Similar for the read metric.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]