DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
Discussion thread: https://lists.apache.org/thread/sb2jrrl9f5vn26mfmwf9qo7w2rkcryfj
JIRA: https://issues.apache.org/jira/browse/SOLR-17458?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel&focusedCommentId=17941031#comment-17941031Jira server ASF JIRA serverId 5aa69414-a9e9-3523-82ec-879b028fb15b key SOLR-17458
Released: 10
Motivation
Solr currently uses the Java Dropwizard 4 framework for metric collection and event measurement. There have been a number of problems with Solr still using Dropwizard and motivation to move off of it:
...
The prometheus exporter is a Solr specific process for getting metrics from /admin/metrics and requires constant maintenance with any new metrics or big changes that Solr introduces. Also running this external process can be costly to maintain.
Proposed changes
OpenTelemetry
...
SDK - Prometheus
Solr already uses Open Telemetry as a module for distributed tracing which integrates the SDK with auto-configuration. We aim to leverage the Open Telemetry SDK and move its dependencies into core.
...
- The API is used to measure/capture metrics with instruments in Solr. Open Telemetry supports different types of instruments which we will try to migrate from Dropwizard's equivalent. See Open Telemetry Meter section from its documentation.
- The SDK is then used to configure and export the API measurements collected from Solr by providing a number of different exporters from OTLP, prometheus or even in-memory metric readers. If not the SDK, the Java agent can also be used as a “zero-code” option
In Solr core, we will implement the Open Telemetry API to collect and record metrics.
We will then add only the Open Telemetry Prometheus Exporter SDK into core to expose these metrics to the /admin/metrics endpoint as prometheus. This will work right out of the box for Solr meaning by default Solr's exposed method for collecting metrics is through Prometheus and a pull based protocol.With the SDK, Solr can be used as both to expose both push and pull implementations for metrics. Push with OTLP which is becoming an industry standard with multiple different plugins and tools for exporting these and pull with prometheus as an endpoint to scrape from (/admin/metrics)
SolrMetricsContext needs to be completely refactored instead of being wrapped around Dropwizard to being wrapped around Open Telemetry. Some custom metric types that Solr uses from Dropwizard might not be possible or too difficult to port over to OTel such as MetricsMaps or complex Gauges.
Metrics API /admin/metrics
The metrics endpoint will be changed to output prometheus metrics as the standard for pull metric pipelines. This will use Open Telemetry SDK’s prometheus exporters to transform the API to the prometheus data model.
Filtering
OpenTelemetry SDK - OTLP
For users who want to use collect Solr metrics with a push based protocol using OTLP, then they would need to enable the Open Telemetry OTLP module the same way the module is enabled with distributed trace. Push with OTLP which is becoming an industry standard with multiple different plugins and tools for exporting these metrics.
Metrics API /admin/metrics
The metrics endpoint will be changed to output prometheus metrics as the standard for pull metric pipelines. This will use Open Telemetry SDK’s prometheus exporters to transform the API to the prometheus data model.
Filtering
We will maintain filtering capabilities on the metrics API to enable users to limit the amount of data and metrics being scraped from the endpoint. Enhancements may include We will maintain filtering capabilities on the metrics API to enable users to limit the amount of data and metrics being scraped from the endpoint. Enhancements may include filtering by tags, preserving the concept of registries/groups with Open Telemetry, or specific metric names possibly. Need to see what the Open Telemetry SDK supports for filtering in Solr but also filtering is possible to happen at an exporter level with OTEL collector/
...
Users will now be open to the option of using Open Telemetry and its push model with OTLP metrics, similar to how traces and spans are being exported but must enable the Open Telemetry OTLP module.
Execution plan
Many large changes will take place including breaking backwards compatibility. We will create a feature branch for code reviews until this feature is ready for main. At a high level, the changes will be split into 3 major parts for code reviews:
Open Telemetry Dependencies and module refactoring
Solr needs to add a few main dependencies to instrument and collect metrics in Solr core:
io.opentelemetry:opentelemetry-api - Enables Solr to record telemetry across Solr through a Global Open Telemetry context.
opentelemetry-runtime-java17 - Enable this on startup and Java metrics are automatically recorded and collected with the Open Telemetry API
opentelemetry-exporter-prometheus - This is part of the Open Telemetry SDK needed to export metrics collection from the Open Telemetry API. We will only include the opentelemetry-exporter-prometheus and exclude other unneeded SDK dependencies to allow Solr to hold a Prometheus Metric Reader and expose these metrics to the /admin/metrics endpoint.
From CoreContainer we will need to refactor how Open Telemetry is initialized which is done through TracerConfigurator:loadTracer but creates a OpenTelemetrySdk that only tracing. This needs to be refactor to support tracing and metrics.
The Open Telemetry Module goes through an auto configuration initialization for OTLP. When a user enables this module, the initialization of Open Telemetry will need to also enable OTLP and the prometheus metric reader so that the /admin/metrics endpoint is still available. This requires making some custom changes to Open Telemetry auto configuration for metrics.
Metric wrappers and /admin/metrics endpoint
Before recording metrics and telemetry, we will need to create wrappers around Open Telemetry so that it is easy to record metrics going forward. Solr currently does this by wrapping Dropwizard around SolrMetricManager and SolrMetricContext. We will modify this with wrappers creating Open Telemetry instruments such as counter and gauges while also moving Dropwizard registries to Open Telemetry's equivalent called scope. The metricsHandler will also remove all of its PrometheusFormatter code and we will collect the Open Telemetry metrics in Prometheus format using the Prometheus Metric reader created from the original refactoring from coreContainer. This will lay the foundation of workable recordable and reachable prometheus metrics on the /admin/metrics endpoint.
Metric API instrumentation and Deprecation of Dropwizard
SolrMetricProducer has 219 implementations of this interface. We will need to go to each overridded initializeMetrics() call and migrate it to the Open Telemetry equivalent metric API for measuring events instead of Dropwizard. We will also remove Dropwizard as a dependency from Solr and all it's existing usages. This also means deprecation metric reporters and the prometheus exporter. Lastly we will need to rewrite and update all metric documentation.