SOLR-18400: Plugins screen 500s when metrics are disabled - #4803
Conversation
/admin/metrics now returns a valid Prometheus response with an explanatory comment instead of a 500 when metrics collection is disabled, and the Plugins screen shows a message instead of a blank page.
There was a problem hiding this comment.
Pull request overview
Fixes the Plugins screen failure when Solr metrics collection is disabled by returning an explanatory response and UI message.
Changes:
- Handles disabled metrics in Prometheus responses.
- Displays an explanatory Plugins screen message.
- Adds regression coverage and a changelog entry.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Summary |
|---|---|
solr/webapp/web/partials/plugins.html |
Displays the disabled-metrics message; configuration guidance needs correction. |
solr/webapp/web/js/angular/controllers/plugins.js |
Detects the disabled-metrics response. |
solr/core/src/test/org/apache/solr/response/TestPrometheusResponseWriter.java |
Adds regression coverage for the explanatory response. |
solr/core/src/java/org/apache/solr/response/PrometheusResponseWriter.java |
Serializes disabled metrics as comments; OpenMetrics responses also need # EOF. |
changelog/unreleased/SOLR-18400-plugins-metrics-disabled.yml |
Documents the fix. |
Suppressed comments (1)
solr/webapp/web/js/angular/controllers/plugins.js:38
- This searches the entire exposition for the sentinel, so a valid metric HELP/comment/label containing this phrase will make the Plugins screen incorrectly report that metrics are disabled. Compare the complete error comment instead of using a substring match.
$scope.metricsDisabled = (response.data || '').indexOf('metrics collection is disabled') !== -1;
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Note: the v2 metrics API ( |
- Always append the OpenMetrics EOF marker to the disabled-metrics comment response (harmless in Prometheus format) - Correct the Plugins screen message to reference the <metrics enabled> setting in solr.xml; metricsEnabled is not a real production property
It would make life easier when we move if V2 did the same as V1... One reason I'm axinous to get us to V2 everywhere we can is that we've seen this pattern of fixes making it to V1 when we also have V2, and then it falls behind... |
https://issues.apache.org/jira/browse/SOLR-18400
When metrics collection is disabled,
MetricsHandleradds anerrorentry instead ofmetrics, andPrometheusResponseWriterthrewIOException("No metrics found in response")→ HTTP 500 and a blank Plugins screen.PrometheusResponseWriternow writes the error as a Prometheus comment (# metrics collection is disabled) with HTTP 200 — matching the old JSON-era behavior and keeping the response a valid expositionTestPrometheusResponseWriter(pure unit test, no cluster needed)Verified with the Selenium Admin UI tests (SmokeTest + CollectionScreensTest, 11 tests) from the
admin-ui-selenium-testsbranch merged locally, andgradlew precommit.