Skip to content

SOLR-17806: Migrate ADMIN node registry metrics to OTEL #3444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 6, 2025

Conversation

mlbiscoc
Copy link
Contributor

https://issues.apache.org/jira/browse/SOLR-17806

Migrate node registry ADMIN metrics and remove Dropwizard initializations from RequestHandlerBase.

This does not include aggregateNodeLevelMetricsEnabled

# HELP solr_node_requests_total Http Solr node requests
# TYPE solr_node_requests_total counter
solr_node_requests_total{category="ADMIN",handler="/admin/authorization",otel_scope_name="org.apache.solr"} 0.0
solr_node_requests_total{category="ADMIN",handler="/admin/collections",otel_scope_name="org.apache.solr"} 0.0
solr_node_requests_total{category="ADMIN",handler="/admin/configs",otel_scope_name="org.apache.solr"} 0.0
solr_node_requests_total{category="ADMIN",handler="/admin/cores",otel_scope_name="org.apache.solr"} 0.0
solr_node_requests_total{category="ADMIN",handler="/admin/info",otel_scope_name="org.apache.solr"} 0.0
solr_node_requests_total{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr"} 1.0
solr_node_requests_total{category="ADMIN",handler="/admin/zookeeper",otel_scope_name="org.apache.solr"} 0.0
solr_node_requests_total{category="ADMIN",handler="/admin/zookeeper/status",otel_scope_name="org.apache.solr"} 0.0
# HELP solr_node_requests_errors_total HTTP Solr node request errors
# TYPE solr_node_requests_errors_total counter
solr_node_requests_errors_total{category="ADMIN",handler="/admin/authorization",otel_scope_name="org.apache.solr",source="client"} 0.0
solr_node_requests_errors_total{category="ADMIN",handler="/admin/authorization",otel_scope_name="org.apache.solr",source="server"} 0.0
solr_node_requests_errors_total{category="ADMIN",handler="/admin/collections",otel_scope_name="org.apache.solr",source="client"} 0.0
solr_node_requests_errors_total{category="ADMIN",handler="/admin/collections",otel_scope_name="org.apache.solr",source="server"} 0.0
solr_node_requests_errors_total{category="ADMIN",handler="/admin/configs",otel_scope_name="org.apache.solr",source="client"} 0.0
solr_node_requests_errors_total{category="ADMIN",handler="/admin/configs",otel_scope_name="org.apache.solr",source="server"} 0.0
solr_node_requests_errors_total{category="ADMIN",handler="/admin/cores",otel_scope_name="org.apache.solr",source="client"} 0.0
solr_node_requests_errors_total{category="ADMIN",handler="/admin/cores",otel_scope_name="org.apache.solr",source="server"} 0.0
solr_node_requests_errors_total{category="ADMIN",handler="/admin/info",otel_scope_name="org.apache.solr",source="client"} 0.0
solr_node_requests_errors_total{category="ADMIN",handler="/admin/info",otel_scope_name="org.apache.solr",source="server"} 0.0
solr_node_requests_errors_total{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr",source="client"} 0.0
solr_node_requests_errors_total{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr",source="server"} 0.0
solr_node_requests_errors_total{category="ADMIN",handler="/admin/zookeeper",otel_scope_name="org.apache.solr",source="client"} 0.0
solr_node_requests_errors_total{category="ADMIN",handler="/admin/zookeeper",otel_scope_name="org.apache.solr",source="server"} 0.0
solr_node_requests_errors_total{category="ADMIN",handler="/admin/zookeeper/status",otel_scope_name="org.apache.solr",source="client"} 0.0
solr_node_requests_errors_total{category="ADMIN",handler="/admin/zookeeper/status",otel_scope_name="org.apache.solr",source="server"} 0.0
# HELP solr_node_requests_timeout_total HTTP Solr node request timeouts
# TYPE solr_node_requests_timeout_total counter
solr_node_requests_timeout_total{category="ADMIN",handler="/admin/authorization",otel_scope_name="org.apache.solr"} 0.0
solr_node_requests_timeout_total{category="ADMIN",handler="/admin/collections",otel_scope_name="org.apache.solr"} 0.0
solr_node_requests_timeout_total{category="ADMIN",handler="/admin/configs",otel_scope_name="org.apache.solr"} 0.0
solr_node_requests_timeout_total{category="ADMIN",handler="/admin/cores",otel_scope_name="org.apache.solr"} 0.0
solr_node_requests_timeout_total{category="ADMIN",handler="/admin/info",otel_scope_name="org.apache.solr"} 0.0
solr_node_requests_timeout_total{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr"} 0.0
solr_node_requests_timeout_total{category="ADMIN",handler="/admin/zookeeper",otel_scope_name="org.apache.solr"} 0.0
solr_node_requests_timeout_total{category="ADMIN",handler="/admin/zookeeper/status",otel_scope_name="org.apache.solr"} 0.0
# HELP solr_node_requests_times_milliseconds HTTP Solr node request times
# TYPE solr_node_requests_times_milliseconds histogram
solr_node_requests_times_milliseconds_bucket{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr",le="0.0"} 0
solr_node_requests_times_milliseconds_bucket{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr",le="5.0"} 1
solr_node_requests_times_milliseconds_bucket{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr",le="10.0"} 1
solr_node_requests_times_milliseconds_bucket{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr",le="25.0"} 1
solr_node_requests_times_milliseconds_bucket{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr",le="50.0"} 1
solr_node_requests_times_milliseconds_bucket{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr",le="75.0"} 1
solr_node_requests_times_milliseconds_bucket{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr",le="100.0"} 1
solr_node_requests_times_milliseconds_bucket{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr",le="250.0"} 1
solr_node_requests_times_milliseconds_bucket{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr",le="500.0"} 1
solr_node_requests_times_milliseconds_bucket{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr",le="750.0"} 1
solr_node_requests_times_milliseconds_bucket{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr",le="1000.0"} 1
solr_node_requests_times_milliseconds_bucket{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr",le="2500.0"} 1
solr_node_requests_times_milliseconds_bucket{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr",le="5000.0"} 1
solr_node_requests_times_milliseconds_bucket{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr",le="7500.0"} 1
solr_node_requests_times_milliseconds_bucket{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr",le="10000.0"} 1
solr_node_requests_times_milliseconds_bucket{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr",le="+Inf"} 1
solr_node_requests_times_milliseconds_count{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr"} 1
solr_node_requests_times_milliseconds_sum{category="ADMIN",handler="/admin/metrics",otel_scope_name="org.apache.solr"} 4.0

Copy link
Contributor

@dsmiley dsmiley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Prometheus expose these counts as floating point instead as integer (long)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice to finally see just otel and not also dropwizard simultaneously

}
}
}

private Double getSelectRequestCount(SolrCore core) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why a Double instead of long ?

SolrRequest.METHOD.GET,
"/admin/metrics",
SolrRequest.SolrRequestType.ADMIN,
new ModifiableSolrParams().set("wt", "prometheus"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI try SolrParams.of("wt", "prometheus")


// Sum both client and server errors
return line.stream()
.map(s -> Double.parseDouble(s.substring(s.lastIndexOf(" ") + 1).trim()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see Stream.mapToDouble and Stream.mapToLong

System.out.println(namedList);
NamedList<?> metrics = (NamedList<?>) namedList.get("metrics");
assertEquals(1L, metrics.get(updateRequestCountKey));
assertEquals(1.0, getPrometheusMetricValue(solrClient, prometheusMetric), 0.0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice utility method

return output
.lines()
.filter(l -> l.startsWith(metricName))
.mapToDouble(s -> Double.parseDouble(s.substring(s.lastIndexOf(" ") + 1).trim()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plus one results in a space that you then remove with a trim. So can't you skip both and simplify?

@mlbiscoc mlbiscoc merged commit 1a4daae into apache:feature/SOLR-17458 Aug 6, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants