mlbiscoc commented on code in PR #3811:
URL: https://github.com/apache/solr/pull/3811#discussion_r2466909096


##########
solr/solr-ref-guide/modules/deployment-guide/pages/performance-statistics-reference.adoc:
##########
@@ -19,55 +19,55 @@
 This page explains some of the statistics that Solr exposes.
 
 There are two approaches to retrieving metrics.
-First, you can use the xref:metrics-reporting.adoc#metrics-api[Metrics API], 
or you can enable JMX and get metrics from the 
xref:mbean-request-handler.adoc[] or via an external tool such as JConsole.
-The below descriptions focus on retrieving the metrics using the Metrics API, 
but the metric names are the same if using the MBean Request Handler or an 
external tool.
+First, you can use the xref:metrics-reporting.adoc#metrics-api[Metrics API] or 
push metrics with OTLP to your monitoring backend.
+The descriptions below focus on retrieving metrics using the Metrics API and 
Prometheus, but the metric names are the same with OTLP.
 
-These statistics are per core.
-When you are running in SolrCloud mode these statistics would co-relate to the 
performance of an individual replica.
+These statistics are per core. When you are running in SolrCloud mode these 
statistics would co-relate to the performance of an individual replica.
+
+*Note: Solr metrics provide raw data that must be aggregated and calculated by 
monitoring backends (Prometheus, Grafana, etc.). Counters can be use to 
calculate rates and averages over time windows. Histograms provide raw bucket 
data that backends use to calculate percentiles (p50, p75, p95, p99, p999), 
averages, and other statistical measures. Solr delegates these calculations to 
your monitoring system for better flexibility and reduced load on Solr.*

Review Comment:
   We don't have an "official Grafana dashboard" right now. The one that Solr 
shipped with was specific with the prometheus exporter. I can a basic promQL 
example and link to the promQL functions as reference



##########
solr/solr-ref-guide/modules/deployment-guide/pages/metrics-reporting.adoc:
##########
@@ -16,82 +16,68 @@
 // specific language governing permissions and limitations
 // under the License.
 
-Solr includes a developer API and instrumentation for the collection of 
detailed performance-oriented metrics throughout the life-cycle of Solr service 
and its various components.
+Solr supports both a pull-based Prometheus-formatted API and an OTLP push 
exporter for collecting detailed performance-oriented metrics throughout the 
lifecycle of Solr services and their various components.
 
-Internally this feature uses the http://metrics.dropwizard.io[Dropwizard 
Metrics API], which uses the following classes of meters to measure events:
+All metrics natively include attributes and labels, providing users with 
powerful ways to aggregate metrics in their preferred backend, as well as 
descriptions to help understand what each metric represents.
 
-* *counters* - simply count events.
-They provide a single long value, e.g., the number of requests.
-* *meters* - additionally compute rates of events.
-Provide a count (as above) and 1-, 5-, and 15-minute exponentially decaying 
rates, similar to the Unix system load average.
-* *histograms* - calculate approximate distribution of events according to 
their values.
-Provide the following approximate statistics, with a similar exponential decay 
as above: mean (arithmetic average), median, maximum, minimum, standard 
deviation, and 75^th^, 95^th^, 98^th^, 99^th^ and 999^th^ percentiles.
-* *timers* - measure the number and duration of events.
-They provide a count and histogram of timings.
-* *gauges* - offer instantaneous reading of a current value, e.g., current 
queue depth, current number of active connections, free heap size.
+Internally this feature uses https://opentelemetry.io/[OpenTelemetry], which 
uses the following instruments to measure events:
 
-Some of these meters may be missing or empty for any number of valid reasons.
-In these cases, missing values of any type will be returned as `null` by 
default so empty values won't impact averages or histograms.
-This is configurable for several types of missing values; see the <<The 
<metrics> <missingValues> Element>> section below.
+* *Counters* - Simply count events. They only increase and never decrease, 
providing a single long value (e.g., the number of requests).
+* *Gauges* - Provide instantaneous readings of current values (e.g., current 
queue depth, number of active connections, free heap size).
+* *Histograms* - Provide distribution of values divided into buckets with 
overall count and sum of events (e.g., duration of HTTP requests, count of 
requests recorded).
 
-Each group of related metrics with unique names is managed in a *metric 
registry*.
-Solr maintains several such registries, each corresponding to a high-level 
group such as: `jvm`, `jetty`, `node`, and `core` (see <<Metric Registries>> 
below).
+For more information on instruments see the OpenTelemetry documentation on 
https://opentelemetry.io/docs/concepts/signals/metrics/#metric-instruments[Metric
 Instruments].

Review Comment:
   Yeah but those are the 3 users will really see. Async are just callbacks and 
up/down counters are basically gauges. But it can be confusing to list 3 and 
keep 7. I'll remove this.



##########
solr/core/src/java/org/apache/solr/handler/admin/MetricsHandler.java:
##########
@@ -51,24 +51,15 @@
 public class MetricsHandler extends RequestHandlerBase implements 
PermissionNameProvider {
   final SolrMetricManager metricManager;
 
-  public static final String COMPACT_PARAM = "compact";
-  public static final String PREFIX_PARAM = "prefix";
-  public static final String REGEX_PARAM = "regex";
-  public static final String PROPERTY_PARAM = "property";
-  public static final String REGISTRY_PARAM = "registry";
-  public static final String GROUP_PARAM = "group";

Review Comment:
   I can bring it back. It was just being unused for now, so was going to throw 
it out.



##########
solr/solr-ref-guide/modules/deployment-guide/pages/metrics-reporting.adoc:
##########
@@ -107,771 +93,287 @@ RequestHandlers can be configured to roll up core level 
metrics to the node leve
 </requestHandler>
 ```
 
-=== Jetty Registry
-
-This registry is returned at `solr.jetty` and includes the following 
information.
-When making requests with the <<Metrics API>>, you can specify `&group=jetty` 
to limit to only these metrics.
+=== JVM Registry
 
-* threads and pools,
-* connection and request timers,
-* meters for responses by HTTP class (1xx, 2xx, etc.)
+The `JVM Registry` gathers metrics from the JVM using the OpenTelemetry 
instrumentation library with JFR and JMX. See the 
https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/runtime-telemetry/runtime-telemetry-java17/library[runtime-telemetry-java17]
 documentation for more information on available JVM metrics.
 
-== Metrics Configuration
+JVM metrics are enabled by default but can be disabled by setting either the 
system property `-Dsolr.metrics.jvm.enabled=false` or the environment variable 
`SOLR_METRICS_JVM_ENABLED=false`.
 
-The metrics available in your system can be customized by modifying the 
`<metrics>` element in `solr.xml`.
+=== Overseer Registry
 
-TIP: See also the section xref:configuration-guide:configuring-solr-xml.adoc[] 
for more information about the `solr.xml` file, where to find it, and how to 
edit it.
+The `Overseer Registry` is initialized when running in SolrCloud mode and 
includes the following information:
 
-=== Disabling the Metrics Collection
-The `<metrics>` element in `solr.xml` supports one attribute `enabled`, which 
takes a boolean value,
-for example `<metrics enabled="true">`.
+* Size of the Overseer queues (collection work queue and cluster state update 
queue)
 
-The default value of this attribute is `true`, meaning that metrics are being 
collected, processed and
-reported by Solr according to the configured metric reporters.
-They are also available from the
-metrics APIs.
+== Core Level Metrics
 
-The `false` value of this attribute (`<metrics enabled="false">`) turns off 
metrics collection and processing.
-Internally, all metrics suppliers are replaced by singleton no-op
-implementations, which effectively removes nearly all overheads related to 
metrics collection.
-All reporter configurations are skipped, and the metrics APIs stop reporting 
any metrics and only return an `<error>`
-element in their responses.
+=== Index Merge Metrics
 
-=== The <metrics> <hiddenSysProps> Element
+These metrics are collected under the `INDEX` category and track flush 
operations (documents being written to disk) and merge operations (segments on 
disk being merged).
 
-This section of `solr.xml` allows you to define the system properties which 
are considered system-sensitive and should not be exposed via the Metrics API.
+For merge metrics, metrics are tracked with the distinction of "minor" and 
"major" merges (as merges with fewer documents will be typically more frequent).
+This is indicated by the `merge_type` label for the metric. The threshold for 
when a merge becomes large enough to be considered major is configurable, but
+defaults to 524k documents.
 
-If this section is not defined, the following default configuration is used 
which hides password and authentication information:
+Metrics collection for index merges can be configured in the `<metrics>` 
section of `solrconfig.xml` as shown below:
 
 [source,xml]
 ----
-<metrics>
-  <hiddenSysProps>
-    <str>javax.net.ssl.keyStorePassword</str>
-    <str>javax.net.ssl.trustStorePassword</str>
-    <str>solr.security.auth.basicauth.credentials</str>
-    <str>zkDigestPassword</str>
-    <str>zkDigestReadonlyPassword</str>
-  </hiddenSysProps>
-</metrics>
+<config>
+  ...
+  <indexConfig>
+    <metrics>
+      <long name="majorMergeDocs">524288</long>
+    </metrics>
+    ...
+  </indexConfig>
+...
+</config>
 ----
 
-[#the-metrics-reporters-element]
-=== The <metrics> <reporters> Element
-
-Reporters consume the metrics data generated by Solr.
-See the section <<Reporters>> below for more details on how to configure 
custom reporters.
-
-=== The <metrics> <suppliers> Element
+== Metrics API
 
-Suppliers help Solr generate metrics data.
-The `<metrics><suppliers>` section of `solr.xml` allows you to define your own 
implementations of metrics and configure parameters for them.
+The `/admin/metrics` endpoint natively provides access to all metrics in 
Prometheus format by default. You can also specify `wt=prometheus` as a 
parameter for Prometheus format or `wt=openmetrics` for OpenMetrics format. 
More information on the data models is provided in the sections below.
 
-Implementation of a custom metrics supplier is beyond the scope of this guide, 
but there are other customizations possible with the default implementation, 
via the elements described below.
+=== Prometheus
 
-`<counter>`::
-This element defines the implementation and configuration of a `Counter` 
supplier.
-The default implementation does not support any configuration.
+See https://prometheus.io/docs/concepts/data_model/[Prometheus Data Model] 
documentation for more information on its data model.
 
-`<meter>`::
-This element defines the implementation of a `Meter` supplier.
-The default implementation supports an additional parameter:
+This endpoint can be used to pull/scrape metrics to a Prometheus server or any 
Prometheus-compatible backend directly from Solr.
 
-`<str name="clock">`:::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: `user`
-|===
-+
-The type of clock to use for calculating EWMA rates.
-The supported values are:
-* `user`, which uses `System.nanoTime()`
-* `cpu`, which uses the current thread's CPU time
+==== Prometheus Setup
 
-`<histogram>`::
-This element defines the implementation of a `Histogram` supplier.
-This element also supports the `clock` parameter shown above with the `meter` 
element, and also:
+The `prometheus-config.yml` file needs to be configured for a Prometheus 
server to scrape and collect metrics. A basic configuration for SolrCloud mode 
is as follows:
 
-`<str name="reservoir">`:::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: `com.codahale.metrics.ExponentiallyDecayingReservoir`
-|===
-+
-The fully-qualified class name of the `Reservoir` implementation to use.
-The default is `com.codahale.metrics.ExponentiallyDecayingReservoir` but there 
are other options available with the http://metrics.dropwizard.io/[Codahale 
Metrics library] that Solr uses.
-
-`<int name="size">`:::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: `1028`
-|===
-+
-The reservoir size.
-
-`<double name="alpha">`:::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: `0.015`
-|===
-+
-The decay parameter.
-This is only valid for the `ExponentiallyDecayingReservoir`.
-
-`<long name="window">`:::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: `300` seconds
-|===
-+
-The window size, in seconds, and only valid for the 
`SlidingTimeWindowReservoir`.
-
-`<timer>`::
-This element defines an implementation of a `Timer` supplier.
-The default implementation supports the `clock` and `reservoir` parameters 
described above.
-
-As an example of a section of `solr.xml` that defines some of these custom 
parameters, the following defines the default `Meter` supplier with a 
non-default `clock` and the default `Timer` is used with a non-default 
reservoir:
-
-[source,xml]
+[source,plain]
 ----
-<metrics>
-  <suppliers>
-    <meter>
-      <str name="clock">cpu</str>
-    </meter>
-    <timer>
-      <str 
name="reservoir">com.codahale.metrics.SlidingTimeWindowReservoir</str>
-      <long name="window">600</long>
-    </timer>
-  </suppliers>
-</metrics>
+scrape_configs:
+  - job_name: 'solr'
+    metrics_path: "/solr/admin/metrics"
+    static_configs:
+      - targets: ['localhost:8983', 'localhost:7574']
 ----
 
-=== The <metrics> <missingValues> Element
-Long-lived metrics values are still reported when the underlying value is 
unavailable (e.g., "INDEX.sizeInBytes" when IndexReader is closed).
-Short-lived transient metrics (such as cache entries) that are properties of 
complex gauges (internally represented as `MetricsMap`) are simply skipped when 
not available, and neither their names nor values appear in registries (or in 
`/admin/metrics` reports).
+=== OpenMetrics
 
-When a missing value is encountered by default it's reported as null value, 
regardless of the metrics type.
-This can be configured in the `solr.xml:/solr/metrics/missingValues` element, 
which recognizes the following child elements (for string elements a JSON 
payload is supported):
+OpenMetrics format is available from the `/admin/metrics` endpoint by 
providing the `wt=openmetrics` parameter or by passing the Accept header 
`application/openmetrics-text;version=1.0.0`. OpenMetrics is an extension of 
the Prometheus format that adds additional metadata and exemplars.
 
-`nullNumber`::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: none
-|===
-+
-The value to use when a missing (null) numeric metrics value is encountered.
+See https://prometheus.io/docs/specs/om/open_metrics_spec/[OpenMetrics Spec] 
documentation for more information.
 
-`notANumber`::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: none
-|===
-+
-The value to use when an invalid numeric value is encountered.
+OpenMetrics can be used to pull/scrape metrics to a Prometheus server or any 
OpenMetrics-compatible backend directly from Solr.
 
-`nullString`::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: none
-|===
-+
-The value to use when a missing (null) string metrics is encountered.
+==== Prometheus setup with exemplars
 
-`nullObject`::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: none
-|===
-+
-The value to use when a missing (null) complex object is encountered.
+OpenMetrics includes `exemplars` that provide additional information and allow 
users to leverage Solr's 
xref:deployment-guide:distributed-tracing.adoc#distributed-tracing[OpenTelemetry
 distributed tracing module] and metrics in a cohesive view for correlating 
traces and metrics.
 
-Example configuration that returns null for missing numbers, `-1` for
-invalid numeric values, empty string for missing strings, and a Map for missing
-complex objects:
+Distributed tracing must be enabled to see exemplars. Exemplars will never 
appear in OpenMetrics format otherwise. You can then scrape OpenMetrics format 
to a Prometheus server or OpenMetrics-compatible backend.
 
-[source,xml]
-----
-<metrics>
-  <missingValues>
-    <null name="nullNumber"/>
-    <int name="notANumber">-1</int>
-    <str name="nullString"></str>
-    <str name="nullObject">{"value":"missing"}</str>
-  </missingValues>
-</metrics>
-----
+A basic `prometheus-config.yml` configuration for a Prometheus server in 
SolrCloud mode that collects exemplars is as follows:
 
-=== Caching Threads Metrics ===
-The threads metrics in the JVM group can be expensive to compute, as it 
requires traversing all threads.
-This can be avoided for every call to the metrics API (group=jvm) by setting a 
high caching expiration interval
-(in seconds). For example, to cache the thread metrics for 5 seconds:
-
-[source,xml]
+[source,plain]
 ----
-<solr>
- <metrics>
-  <caching>
-   <int name="threadsIntervalSeconds">5</int>
-  </caching>
-  ...
- </metrics>
-...
-</solr>
+scrape_configs:
+  - job_name: 'solr'
+    metrics_path: "/solr/admin/metrics"
+    static_configs:
+      - targets: ['localhost:8983', 'localhost:7574']
+    params:
+      wt: ['openmetrics']
+    scrape_protocols:
+      - OpenMetricsText1.0.0 
 ----
 
-== Reporters
+The Prometheus server must also be started with the command-line parameter 
`--enable-feature=exemplar-storage` to collect exemplars from OpenMetrics.
 
-Reporter configurations are specified in `solr.xml` file in 
`<metrics><reporter>` sections, for example:
+If you are using Grafana, follow the 
https://grafana.com/docs/grafana/latest/fundamentals/exemplars/[Introduction to 
exemplars] guide to connect your Prometheus data source and see exemplars on 
Grafana panels.
 
-[source,xml]
-----
-<solr>
- <metrics>
-  <reporter name="graphite" group="node, jvm" 
class="org.apache.solr.metrics.reporters.SolrGraphiteReporter">
-    <str name="host">graphite-server</str>
-    <int name="port">9999</int>
-    <int name="period">60</int>
-  </reporter>
-    <reporter name="log_metrics" group="core" 
class="org.apache.solr.metrics.reporters.SolrSlf4jReporter">
-      <int name="period">60</int>
-      <str name="filter">QUERY./select.requestTimes</str>
-      <str name="filter">QUERY./get.requestTimes</str>
-      <str name="filter">UPDATE./update.requestTimes</str>
-      <str name="filter">UPDATE./update.clientErrors</str>
-      <str name="filter">UPDATE./update.errors</str>
-      <str name="filter">SEARCHER.new.time</str>
-      <str name="filter">SEARCHER.new.warmup</str>
-      <str 
name="logger">org.apache.solr.metrics.reporters.SolrSlf4jReporter</str>
-    </reporter>
-  </metrics>
-...
-</solr>
-----
+=== API Filtering
 
-This example configures two reporters: <<Graphite Reporter,Graphite>> and 
<<SLF4J Reporter,SLF4J>>.
-See below for more details on how to configure reporters.
+A fixed set of parameters is available to filter metrics by either metric name 
or base core labels. You can combine these parameters to filter only the 
specific metrics you need:
 
-=== Reporter Arguments
-
-Reporter plugins use the following arguments:
+*NOTE: All parameters can be specified with more than one value in a request; 
multiple values should be separated by a comma.*
 
 `name`::
 +
 [%autowidth,frame=none]
 |===
-s|Required |Default: none
-|===
-+
-The unique name of the reporter plugin.
-
-`class`::
-+
-[%autowidth,frame=none]
-|===
-s|Required |Default: none
-|===
-+
-The fully-qualified implementation class of the plugin, which must extend 
`SolrMetricReporter`.
-
-`group`::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: none
-|===
-+
-One or more of the predefined groups (see above).
-
-`registry`::
-+
-[%autowidth,frame=none]
-|===
 |Optional |Default: none
 |===
 +
-One or more of valid fully-qualified registry names.
+The metric name to filter on.
 
-If both `group` and `registry` attributes are specified only the `group` 
attribute is considered.
-If neither attribute is specified then the plugin will be used for all groups 
and registries.
-Multiple group or registry names can be specified, separated by comma and/or 
space.
-
-Additionally, several implementation-specific initialization arguments can be 
specified in nested elements.
-There are some arguments that are common to SLF4J, Ganglia and Graphite 
reporters:
-
-`period`::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: `60` seconds
-|===
-+
-The period in seconds between reports.
-
-`prefix`::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: _empty string_
-|===
-+
-A prefix to be added to metric names, which may be helpful in logical grouping 
of related Solr instances, e.g., machine name or cluster name.
-Default is empty string, i.e., just the registry name and metric name will be 
used to form a fully-qualified metric name.
-
-`filter`::
+`category`::
 +
 [%autowidth,frame=none]
 |===
 |Optional |Default: none
 |===
 +
-If not empty then only metric names that start with this value will be 
reported.
-Default is no filtering, i.e., all metrics from the selected registry will be 
reported.
-
-Reporters are instantiated for every group and registry that they were 
configured for, at the time when the respective components are initialized 
(e.g., on JVM startup or SolrCore load).
-
-When reporters are created their configuration is validated (and e.g., 
necessary connections are established).
-Uncaught errors at this initialization stage cause the reporter to be 
discarded from the running configuration.
-
-Reporters are closed when the corresponding component is being closed (e.g., 
on SolrCore close, or JVM shutdown) but metrics that they reported are still 
maintained in respective registries, as explained in the previous section.
-
-The following sections provide information on implementation-specific 
arguments.
-All implementation classes provided with Solr can be found under 
`org.apache.solr.metrics.reporters`.
+The category label to filter on.
 
-=== JMX Reporter
-
-The JMX Reporter uses the `org.apache.solr.metrics.reporters.SolrJmxReporter` 
class.
-
-It takes the following arguments:
-
-`domain`::
+`core`::
 +
 [%autowidth,frame=none]
 |===
 |Optional |Default: none
 |===
 +
-The JMX domain name.
-If not specified then the registry name will be used.
+The core name to filter on.
+More than one core can be specified in a request; multiple cores should be 
separated by a comma.
 
-`serviceUrl`::
+`collection`::
 +
 [%autowidth,frame=none]
 |===
 |Optional |Default: none
 |===
 +
-The service URL for a JMX server.
-If not specified, Solr will attempt to discover if the JVM has an MBean server 
and will use that address.
-See below for additional information on this.
+The collection name to filter on. This attribute is only filterable in 
SolrCloud mode.
 
-`agentId`::
+`shard`::
 +
 [%autowidth,frame=none]
 |===
 |Optional |Default: none
 |===
 +
-The agent ID for a JMX server.
-Note either `serviceUrl` or `agentId` can be specified but not both.
-If both are specified then the default MBean server will be used.
-
-Object names created by this reporter are hierarchical, dot-separated but also 
properly structured to form corresponding hierarchies in e.g., JConsole.
-This hierarchy consists of the following elements in the top-down order:
-
-* registry name (e.g., `solr.core.collection1.shard1.replica1`).
-Dot-separated registry names are also split into ObjectName hierarchy levels, 
so that metrics for this registry will be shown under 
`/solr/core/collection1/shard1/replica1` in JConsole, with each domain part 
being assigned to `dom1, dom2, ... domN` property.
-* reporter name (the value of reporter's `name` attribute)
-* category, scope and name for request handlers
-* or additional `name1, name2, ... nameN` elements for metrics from other 
components.
-
-The JMX Reporter replaces the JMX functionality available in Solr versions 
before 7.0.
-If you have upgraded from an earlier version and have an MBean Server running 
when Solr starts, Solr will automatically discover the location of the local 
MBean server and use a default configuration for the SolrJmxReporter.
-
-You can start a local MBean server with a system property at startup by adding 
`-Dcom.sun.management.jmxremote` to your start command.
-This will not add the reporter configuration to `solr.xml`, so if you enable 
it with a system property, you must always start Solr with the system property 
or JMX will not be enabled in subsequent starts.
+The shard name to filter on. This attribute is only filterable in SolrCloud 
mode.
 
-=== SLF4J Reporter
-
-The SLF4J Reporter uses the 
`org.apache.solr.metrics.reporters.SolrSlf4jReporter` class.
-
-It takes the following arguments, in addition to common arguments described 
<<Reporter Arguments,above>>.
-
-`logger`::
+`replica_type`::
 +
 [%autowidth,frame=none]
 |===
 |Optional |Default: none
 |===
 +
-The name of the logger to use.
-Default is empty, in which case the group (or the initial part of the registry 
name that identifies a metrics group) will be used if specified in the plugin 
configuration.
-
-Users can specify logger name (and the corresponding logger configuration in 
e.g., Log4j configuration) to output metrics-related logging to separate 
file(s), which can then be processed by external applications.
-Here is an example for configuring the default `log4j2.xml` which ships in 
Solr.
-This can be used in conjunction with the `solr.xml` example provided earlier 
in this page to configure the SolrSlf4jReporter:
-
-[source,xml]
-----
-<Configuration>
-  <Appenders>
-  ...
-    <RollingFile
-        name="MetricsFile"
-        fileName="${sys:solr.logs.dir}/solr_metrics.log"
-        filePattern="${sys:solr.logs.dir}/solr_metrics.log.%i" >
-      <PatternLayout>
-        <Pattern>
-          %d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{node_name} %X{collection} 
%X{shard} %X{replica} %X{core} %X{trace_id}] %m%n
-        </Pattern>
-      </PatternLayout>
-      <Policies>
-        <OnStartupTriggeringPolicy />
-        <SizeBasedTriggeringPolicy size="32 MB"/>
-      </Policies>
-      <DefaultRolloverStrategy max="10"/>
-    </RollingFile>
-  ...
-  </Appenders>
+The replica type to filter on. Valid values are NRT, TLOG, or PULL. This 
attribute is only filterable in SolrCloud mode.
 
-  <Loggers>
-  ...
-    <Logger name="org.apache.solr.metrics.reporters.SolrSlf4jReporter" 
level="info" additivity="false">
-      <AppenderRef ref="MetricsFile"/>
-    </Logger>
-  ...
-  </Loggers>
-</Configuration>
-----
+[[metrics_examples]]
+=== Examples
 
-Each log line produced by this reporter consists of configuration-specific 
fields, and a message that follows this format:
+Request only metrics from the `foobar` collection:
 
 [source,text]
-----
-type=COUNTER, name={}, count={}
-
-type=GAUGE, name={}, value={}
-
-type=TIMER, name={}, count={}, min={}, max={}, mean={}, stddev={}, median={}, 
p75={}, p95={}, p98={}, p99={}, p999={}, mean_rate={}, m1={}, m5={}, m15={}, 
rate_unit={}, duration_unit={}
-
-type=METER, name={}, count={}, mean_rate={}, m1={}, m5={}, m15={}, rate_unit={}
+http://localhost:8983/solr/admin/metrics?collection=foobar
 
-type=HISTOGRAM, name={}, count={}, min={}, max={}, mean={}, stddev={}, 
median={}, p75={}, p95={}, p98={}, p99={}, p999={}
-----
-
-(curly braces added here only as placeholders for actual values).
-
-Additionally, the following MDC context properties are passed to the logger 
and can be used in log formats:
-
-`node_name`::
-Solr node name (for SolrCloud deployments, otherwise null), prefixed with `n:`.
-
-`registry`::
-Metric registry name, prefixed with `m:`.
-
-For reporters that are specific to a SolrCore also the following properties 
are available:
-
-`collection`::
-Collection name, prefixed with `c:`.
-
-`shard`::
-Shard name, prefixed with `s:`.
-
-`replica`::
-Replica name (core node name), prefixed with `r:`.
-
-`core`::
-SolrCore name, prefixed with `x:`.
-
-`tag`::
-Reporter instance tag, prefixed with `t:`.
-
-=== Graphite Reporter
-
-The http://graphiteapp.org[Graphite] Reporter uses the 
`org.apache.solr.metrics.reporters.SolrGraphiteReporter`) class.
-
-It takes the following attributes, in addition to the common attributes 
<<Reporter Arguments,above>>.
-
-`host`::
-+
-[%autowidth,frame=none]
-|===
-s|Required |Default: none
-|===
-+
-The host name where Graphite server is running.
-
-`port`::
-+
-[%autowidth,frame=none]
-|===
-s|Required |Default: none
-|===
-+
-The port number for the server.
-
-`pickled`::
-+
-[%autowidth,frame=none]
-|===
-s|Required |Default: `false`
-|===
-+
-If `true`, use "pickled" Graphite protocol which may be more efficient.
-
-When plain-text protocol is used (`pickled==false`) it's possible to use this 
reporter to integrate with systems other than Graphite, if they can accept 
space-separated and line-oriented input over network in the following format:
+Request only the metrics with a category label of QUERY or UPDATE:
 
 [source,text]
-----
-dot.separated.metric.name[.and.attribute] value epochTimestamp
-----
+http://localhost:8983/solr/admin/metrics?category=QUERY,UPDATE
 
-For example:
+Request only `solr_core_requests_total` metrics from the 
`foobar_shard1_replica_n1` core:
 
-[source,plain]
-----
-example.solr.node.cores.loaded 1 1482932097
-example.solr.jetty.org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses.count
 21 1482932097
-example.solr.jetty.org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses.m1_rate
 2.5474287707930614 1482932097
-example.solr.jetty.org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses.m5_rate
 3.8003171557510305 1482932097
-example.solr.jetty.org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses.m15_rate
 4.0623076220244245 1482932097
-example.solr.jetty.org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses.mean_rate
 0.5698031798408144 1482932097
-----
-
-== Core Level Metrics
-
-These metrics are available only on a per-core basis.
-Metrics can be aggregated across cores using Shard and Cluster reporters.
+[source,text]
+http://localhost:8983/solr/admin/metrics?name=solr_core_requests_total&core=foobar_shard1_replica_n1
 
-=== Index Merge Metrics
+Request only the core index size `solr_core_index_size_bytes` metrics from 
collections labeled `foo` and `bar`:
 
-These metrics are collected under the `INDEX` category and track flush 
operations (documents being written to disk) and merge operations (segments on 
disk being merged).
+[source,text]
+http://localhost:8983/solr/admin/metrics?name=solr_core_index_size_bytes&collection=foo,bar
 
-For merge metrics, metrics are tracked with the distinction of "minor" and 
"major" merges (as merges with fewer documents will be typically more frequent).
-This is indicated by the `merge_type` label for the metric. The threshold for 
when a merge becomes large enough to be considered major is configurable, but
-defaults to 524k documents.
+== OTLP
 
-Metrics collection for index merges can be configured in the `<metrics>` 
section of `solrconfig.xml` as shown below:
+For users who do not use or support pulling metrics in Prometheus format with 
the `/admin/metrics` API, Solr also supports pushing metrics natively with 
https://opentelemetry.io/docs/specs/otlp/[OTLP], which is a vendor-agnostic 
protocol for pushing metrics via gRPC or HTTP. 
 
-[source,xml]
-----
-<config>
-  ...
-  <indexConfig>
-    <metrics>
-      <long name="majorMergeDocs">524288</long>
-    </metrics>
-    ...
-  </indexConfig>
-...
-</config>
-----
+OTLP is widely supported by many tools, vendors, and pipelines. See the 
OpenTelemetry https://opentelemetry.io/ecosystem/vendors/[vendors list] for 
more details on available and compatible options.
 
+=== OTLP properties
 
-== Metrics API
+Solr's internal OTLP exporter is disabled by default and is packaged with the 
OpenTelemetry module.

Review Comment:
   No filtering in Solr for the OTLP exporter currently. Users would need to 
filter at something like the OTEL collector if they use OTLP. You can create 
something called 
[views](https://opentelemetry.io/docs/languages/java/sdk/#views) that need to 
be set on the meterproviders before creation and drop certain things. I have 
not played with extensively but this probably needs to be setup before start up 
of Solr.



##########
solr/solr-ref-guide/modules/deployment-guide/pages/monitoring-with-prometheus-and-grafana.adoc:
##########


Review Comment:
   I just tried to merge it into one page which is metrics-reporting. We don't 
have a shipped with grafana dashboard right now and with the prometheus 
exporter gone, wasn't sure what to populate this with.



##########
solr/solr-ref-guide/modules/deployment-guide/pages/metrics-reporting.adoc:
##########
@@ -107,771 +93,287 @@ RequestHandlers can be configured to roll up core level 
metrics to the node leve
 </requestHandler>
 ```
 
-=== Jetty Registry
-
-This registry is returned at `solr.jetty` and includes the following 
information.
-When making requests with the <<Metrics API>>, you can specify `&group=jetty` 
to limit to only these metrics.
+=== JVM Registry
 
-* threads and pools,
-* connection and request timers,
-* meters for responses by HTTP class (1xx, 2xx, etc.)
+The `JVM Registry` gathers metrics from the JVM using the OpenTelemetry 
instrumentation library with JFR and JMX. See the 
https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/runtime-telemetry/runtime-telemetry-java17/library[runtime-telemetry-java17]
 documentation for more information on available JVM metrics.
 
-== Metrics Configuration
+JVM metrics are enabled by default but can be disabled by setting either the 
system property `-Dsolr.metrics.jvm.enabled=false` or the environment variable 
`SOLR_METRICS_JVM_ENABLED=false`.
 
-The metrics available in your system can be customized by modifying the 
`<metrics>` element in `solr.xml`.
+=== Overseer Registry
 
-TIP: See also the section xref:configuration-guide:configuring-solr-xml.adoc[] 
for more information about the `solr.xml` file, where to find it, and how to 
edit it.
+The `Overseer Registry` is initialized when running in SolrCloud mode and 
includes the following information:
 
-=== Disabling the Metrics Collection
-The `<metrics>` element in `solr.xml` supports one attribute `enabled`, which 
takes a boolean value,
-for example `<metrics enabled="true">`.
+* Size of the Overseer queues (collection work queue and cluster state update 
queue)
 
-The default value of this attribute is `true`, meaning that metrics are being 
collected, processed and
-reported by Solr according to the configured metric reporters.
-They are also available from the
-metrics APIs.
+== Core Level Metrics
 
-The `false` value of this attribute (`<metrics enabled="false">`) turns off 
metrics collection and processing.
-Internally, all metrics suppliers are replaced by singleton no-op
-implementations, which effectively removes nearly all overheads related to 
metrics collection.
-All reporter configurations are skipped, and the metrics APIs stop reporting 
any metrics and only return an `<error>`
-element in their responses.
+=== Index Merge Metrics
 
-=== The <metrics> <hiddenSysProps> Element
+These metrics are collected under the `INDEX` category and track flush 
operations (documents being written to disk) and merge operations (segments on 
disk being merged).
 
-This section of `solr.xml` allows you to define the system properties which 
are considered system-sensitive and should not be exposed via the Metrics API.
+For merge metrics, metrics are tracked with the distinction of "minor" and 
"major" merges (as merges with fewer documents will be typically more frequent).
+This is indicated by the `merge_type` label for the metric. The threshold for 
when a merge becomes large enough to be considered major is configurable, but
+defaults to 524k documents.
 
-If this section is not defined, the following default configuration is used 
which hides password and authentication information:
+Metrics collection for index merges can be configured in the `<metrics>` 
section of `solrconfig.xml` as shown below:
 
 [source,xml]
 ----
-<metrics>
-  <hiddenSysProps>
-    <str>javax.net.ssl.keyStorePassword</str>
-    <str>javax.net.ssl.trustStorePassword</str>
-    <str>solr.security.auth.basicauth.credentials</str>
-    <str>zkDigestPassword</str>
-    <str>zkDigestReadonlyPassword</str>
-  </hiddenSysProps>
-</metrics>
+<config>
+  ...
+  <indexConfig>
+    <metrics>
+      <long name="majorMergeDocs">524288</long>
+    </metrics>
+    ...
+  </indexConfig>
+...
+</config>
 ----
 
-[#the-metrics-reporters-element]
-=== The <metrics> <reporters> Element
-
-Reporters consume the metrics data generated by Solr.
-See the section <<Reporters>> below for more details on how to configure 
custom reporters.
-
-=== The <metrics> <suppliers> Element
+== Metrics API
 
-Suppliers help Solr generate metrics data.
-The `<metrics><suppliers>` section of `solr.xml` allows you to define your own 
implementations of metrics and configure parameters for them.
+The `/admin/metrics` endpoint natively provides access to all metrics in 
Prometheus format by default. You can also specify `wt=prometheus` as a 
parameter for Prometheus format or `wt=openmetrics` for OpenMetrics format. 
More information on the data models is provided in the sections below.
 
-Implementation of a custom metrics supplier is beyond the scope of this guide, 
but there are other customizations possible with the default implementation, 
via the elements described below.
+=== Prometheus
 
-`<counter>`::
-This element defines the implementation and configuration of a `Counter` 
supplier.
-The default implementation does not support any configuration.
+See https://prometheus.io/docs/concepts/data_model/[Prometheus Data Model] 
documentation for more information on its data model.
 
-`<meter>`::
-This element defines the implementation of a `Meter` supplier.
-The default implementation supports an additional parameter:
+This endpoint can be used to pull/scrape metrics to a Prometheus server or any 
Prometheus-compatible backend directly from Solr.
 
-`<str name="clock">`:::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: `user`
-|===
-+
-The type of clock to use for calculating EWMA rates.
-The supported values are:
-* `user`, which uses `System.nanoTime()`
-* `cpu`, which uses the current thread's CPU time
+==== Prometheus Setup
 
-`<histogram>`::
-This element defines the implementation of a `Histogram` supplier.
-This element also supports the `clock` parameter shown above with the `meter` 
element, and also:
+The `prometheus-config.yml` file needs to be configured for a Prometheus 
server to scrape and collect metrics. A basic configuration for SolrCloud mode 
is as follows:
 
-`<str name="reservoir">`:::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: `com.codahale.metrics.ExponentiallyDecayingReservoir`
-|===
-+
-The fully-qualified class name of the `Reservoir` implementation to use.
-The default is `com.codahale.metrics.ExponentiallyDecayingReservoir` but there 
are other options available with the http://metrics.dropwizard.io/[Codahale 
Metrics library] that Solr uses.
-
-`<int name="size">`:::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: `1028`
-|===
-+
-The reservoir size.
-
-`<double name="alpha">`:::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: `0.015`
-|===
-+
-The decay parameter.
-This is only valid for the `ExponentiallyDecayingReservoir`.
-
-`<long name="window">`:::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: `300` seconds
-|===
-+
-The window size, in seconds, and only valid for the 
`SlidingTimeWindowReservoir`.
-
-`<timer>`::
-This element defines an implementation of a `Timer` supplier.
-The default implementation supports the `clock` and `reservoir` parameters 
described above.
-
-As an example of a section of `solr.xml` that defines some of these custom 
parameters, the following defines the default `Meter` supplier with a 
non-default `clock` and the default `Timer` is used with a non-default 
reservoir:
-
-[source,xml]
+[source,plain]
 ----
-<metrics>
-  <suppliers>
-    <meter>
-      <str name="clock">cpu</str>
-    </meter>
-    <timer>
-      <str 
name="reservoir">com.codahale.metrics.SlidingTimeWindowReservoir</str>
-      <long name="window">600</long>
-    </timer>
-  </suppliers>
-</metrics>
+scrape_configs:
+  - job_name: 'solr'
+    metrics_path: "/solr/admin/metrics"
+    static_configs:
+      - targets: ['localhost:8983', 'localhost:7574']
 ----
 
-=== The <metrics> <missingValues> Element
-Long-lived metrics values are still reported when the underlying value is 
unavailable (e.g., "INDEX.sizeInBytes" when IndexReader is closed).
-Short-lived transient metrics (such as cache entries) that are properties of 
complex gauges (internally represented as `MetricsMap`) are simply skipped when 
not available, and neither their names nor values appear in registries (or in 
`/admin/metrics` reports).
+=== OpenMetrics
 
-When a missing value is encountered by default it's reported as null value, 
regardless of the metrics type.
-This can be configured in the `solr.xml:/solr/metrics/missingValues` element, 
which recognizes the following child elements (for string elements a JSON 
payload is supported):
+OpenMetrics format is available from the `/admin/metrics` endpoint by 
providing the `wt=openmetrics` parameter or by passing the Accept header 
`application/openmetrics-text;version=1.0.0`. OpenMetrics is an extension of 
the Prometheus format that adds additional metadata and exemplars.
 
-`nullNumber`::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: none
-|===
-+
-The value to use when a missing (null) numeric metrics value is encountered.
+See https://prometheus.io/docs/specs/om/open_metrics_spec/[OpenMetrics Spec] 
documentation for more information.
 
-`notANumber`::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: none
-|===
-+
-The value to use when an invalid numeric value is encountered.
+OpenMetrics can be used to pull/scrape metrics to a Prometheus server or any 
OpenMetrics-compatible backend directly from Solr.
 
-`nullString`::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: none
-|===
-+
-The value to use when a missing (null) string metrics is encountered.
+==== Prometheus setup with exemplars
 
-`nullObject`::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: none
-|===
-+
-The value to use when a missing (null) complex object is encountered.
+OpenMetrics includes `exemplars` that provide additional information and allow 
users to leverage Solr's 
xref:deployment-guide:distributed-tracing.adoc#distributed-tracing[OpenTelemetry
 distributed tracing module] and metrics in a cohesive view for correlating 
traces and metrics.
 
-Example configuration that returns null for missing numbers, `-1` for
-invalid numeric values, empty string for missing strings, and a Map for missing
-complex objects:
+Distributed tracing must be enabled to see exemplars. Exemplars will never 
appear in OpenMetrics format otherwise. You can then scrape OpenMetrics format 
to a Prometheus server or OpenMetrics-compatible backend.
 
-[source,xml]
-----
-<metrics>
-  <missingValues>
-    <null name="nullNumber"/>
-    <int name="notANumber">-1</int>
-    <str name="nullString"></str>
-    <str name="nullObject">{"value":"missing"}</str>
-  </missingValues>
-</metrics>
-----
+A basic `prometheus-config.yml` configuration for a Prometheus server in 
SolrCloud mode that collects exemplars is as follows:
 
-=== Caching Threads Metrics ===
-The threads metrics in the JVM group can be expensive to compute, as it 
requires traversing all threads.
-This can be avoided for every call to the metrics API (group=jvm) by setting a 
high caching expiration interval
-(in seconds). For example, to cache the thread metrics for 5 seconds:
-
-[source,xml]
+[source,plain]
 ----
-<solr>
- <metrics>
-  <caching>
-   <int name="threadsIntervalSeconds">5</int>
-  </caching>
-  ...
- </metrics>
-...
-</solr>
+scrape_configs:
+  - job_name: 'solr'
+    metrics_path: "/solr/admin/metrics"
+    static_configs:
+      - targets: ['localhost:8983', 'localhost:7574']
+    params:
+      wt: ['openmetrics']
+    scrape_protocols:
+      - OpenMetricsText1.0.0 
 ----
 
-== Reporters
+The Prometheus server must also be started with the command-line parameter 
`--enable-feature=exemplar-storage` to collect exemplars from OpenMetrics.
 
-Reporter configurations are specified in `solr.xml` file in 
`<metrics><reporter>` sections, for example:
+If you are using Grafana, follow the 
https://grafana.com/docs/grafana/latest/fundamentals/exemplars/[Introduction to 
exemplars] guide to connect your Prometheus data source and see exemplars on 
Grafana panels.
 
-[source,xml]
-----
-<solr>
- <metrics>
-  <reporter name="graphite" group="node, jvm" 
class="org.apache.solr.metrics.reporters.SolrGraphiteReporter">
-    <str name="host">graphite-server</str>
-    <int name="port">9999</int>
-    <int name="period">60</int>
-  </reporter>
-    <reporter name="log_metrics" group="core" 
class="org.apache.solr.metrics.reporters.SolrSlf4jReporter">
-      <int name="period">60</int>
-      <str name="filter">QUERY./select.requestTimes</str>
-      <str name="filter">QUERY./get.requestTimes</str>
-      <str name="filter">UPDATE./update.requestTimes</str>
-      <str name="filter">UPDATE./update.clientErrors</str>
-      <str name="filter">UPDATE./update.errors</str>
-      <str name="filter">SEARCHER.new.time</str>
-      <str name="filter">SEARCHER.new.warmup</str>
-      <str 
name="logger">org.apache.solr.metrics.reporters.SolrSlf4jReporter</str>
-    </reporter>
-  </metrics>
-...
-</solr>
-----
+=== API Filtering
 
-This example configures two reporters: <<Graphite Reporter,Graphite>> and 
<<SLF4J Reporter,SLF4J>>.
-See below for more details on how to configure reporters.
+A fixed set of parameters is available to filter metrics by either metric name 
or base core labels. You can combine these parameters to filter only the 
specific metrics you need:
 
-=== Reporter Arguments
-
-Reporter plugins use the following arguments:
+*NOTE: All parameters can be specified with more than one value in a request; 
multiple values should be separated by a comma.*
 
 `name`::
 +
 [%autowidth,frame=none]
 |===
-s|Required |Default: none
-|===
-+
-The unique name of the reporter plugin.
-
-`class`::
-+
-[%autowidth,frame=none]
-|===
-s|Required |Default: none
-|===
-+
-The fully-qualified implementation class of the plugin, which must extend 
`SolrMetricReporter`.
-
-`group`::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: none
-|===
-+
-One or more of the predefined groups (see above).
-
-`registry`::
-+
-[%autowidth,frame=none]
-|===
 |Optional |Default: none
 |===
 +
-One or more of valid fully-qualified registry names.
+The metric name to filter on.
 
-If both `group` and `registry` attributes are specified only the `group` 
attribute is considered.
-If neither attribute is specified then the plugin will be used for all groups 
and registries.
-Multiple group or registry names can be specified, separated by comma and/or 
space.
-
-Additionally, several implementation-specific initialization arguments can be 
specified in nested elements.
-There are some arguments that are common to SLF4J, Ganglia and Graphite 
reporters:
-
-`period`::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: `60` seconds
-|===
-+
-The period in seconds between reports.
-
-`prefix`::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: _empty string_
-|===
-+
-A prefix to be added to metric names, which may be helpful in logical grouping 
of related Solr instances, e.g., machine name or cluster name.
-Default is empty string, i.e., just the registry name and metric name will be 
used to form a fully-qualified metric name.
-
-`filter`::
+`category`::
 +
 [%autowidth,frame=none]
 |===
 |Optional |Default: none
 |===
 +
-If not empty then only metric names that start with this value will be 
reported.
-Default is no filtering, i.e., all metrics from the selected registry will be 
reported.
-
-Reporters are instantiated for every group and registry that they were 
configured for, at the time when the respective components are initialized 
(e.g., on JVM startup or SolrCore load).
-
-When reporters are created their configuration is validated (and e.g., 
necessary connections are established).
-Uncaught errors at this initialization stage cause the reporter to be 
discarded from the running configuration.
-
-Reporters are closed when the corresponding component is being closed (e.g., 
on SolrCore close, or JVM shutdown) but metrics that they reported are still 
maintained in respective registries, as explained in the previous section.
-
-The following sections provide information on implementation-specific 
arguments.
-All implementation classes provided with Solr can be found under 
`org.apache.solr.metrics.reporters`.
+The category label to filter on.
 
-=== JMX Reporter
-
-The JMX Reporter uses the `org.apache.solr.metrics.reporters.SolrJmxReporter` 
class.
-
-It takes the following arguments:
-
-`domain`::
+`core`::
 +
 [%autowidth,frame=none]
 |===
 |Optional |Default: none
 |===
 +
-The JMX domain name.
-If not specified then the registry name will be used.
+The core name to filter on.
+More than one core can be specified in a request; multiple cores should be 
separated by a comma.
 
-`serviceUrl`::
+`collection`::
 +
 [%autowidth,frame=none]
 |===
 |Optional |Default: none
 |===
 +
-The service URL for a JMX server.
-If not specified, Solr will attempt to discover if the JVM has an MBean server 
and will use that address.
-See below for additional information on this.
+The collection name to filter on. This attribute is only filterable in 
SolrCloud mode.
 
-`agentId`::
+`shard`::
 +
 [%autowidth,frame=none]
 |===
 |Optional |Default: none
 |===
 +
-The agent ID for a JMX server.
-Note either `serviceUrl` or `agentId` can be specified but not both.
-If both are specified then the default MBean server will be used.
-
-Object names created by this reporter are hierarchical, dot-separated but also 
properly structured to form corresponding hierarchies in e.g., JConsole.
-This hierarchy consists of the following elements in the top-down order:
-
-* registry name (e.g., `solr.core.collection1.shard1.replica1`).
-Dot-separated registry names are also split into ObjectName hierarchy levels, 
so that metrics for this registry will be shown under 
`/solr/core/collection1/shard1/replica1` in JConsole, with each domain part 
being assigned to `dom1, dom2, ... domN` property.
-* reporter name (the value of reporter's `name` attribute)
-* category, scope and name for request handlers
-* or additional `name1, name2, ... nameN` elements for metrics from other 
components.
-
-The JMX Reporter replaces the JMX functionality available in Solr versions 
before 7.0.
-If you have upgraded from an earlier version and have an MBean Server running 
when Solr starts, Solr will automatically discover the location of the local 
MBean server and use a default configuration for the SolrJmxReporter.
-
-You can start a local MBean server with a system property at startup by adding 
`-Dcom.sun.management.jmxremote` to your start command.
-This will not add the reporter configuration to `solr.xml`, so if you enable 
it with a system property, you must always start Solr with the system property 
or JMX will not be enabled in subsequent starts.
+The shard name to filter on. This attribute is only filterable in SolrCloud 
mode.
 
-=== SLF4J Reporter
-
-The SLF4J Reporter uses the 
`org.apache.solr.metrics.reporters.SolrSlf4jReporter` class.
-
-It takes the following arguments, in addition to common arguments described 
<<Reporter Arguments,above>>.
-
-`logger`::
+`replica_type`::
 +
 [%autowidth,frame=none]
 |===
 |Optional |Default: none
 |===
 +
-The name of the logger to use.
-Default is empty, in which case the group (or the initial part of the registry 
name that identifies a metrics group) will be used if specified in the plugin 
configuration.
-
-Users can specify logger name (and the corresponding logger configuration in 
e.g., Log4j configuration) to output metrics-related logging to separate 
file(s), which can then be processed by external applications.
-Here is an example for configuring the default `log4j2.xml` which ships in 
Solr.
-This can be used in conjunction with the `solr.xml` example provided earlier 
in this page to configure the SolrSlf4jReporter:
-
-[source,xml]
-----
-<Configuration>
-  <Appenders>
-  ...
-    <RollingFile
-        name="MetricsFile"
-        fileName="${sys:solr.logs.dir}/solr_metrics.log"
-        filePattern="${sys:solr.logs.dir}/solr_metrics.log.%i" >
-      <PatternLayout>
-        <Pattern>
-          %d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{node_name} %X{collection} 
%X{shard} %X{replica} %X{core} %X{trace_id}] %m%n
-        </Pattern>
-      </PatternLayout>
-      <Policies>
-        <OnStartupTriggeringPolicy />
-        <SizeBasedTriggeringPolicy size="32 MB"/>
-      </Policies>
-      <DefaultRolloverStrategy max="10"/>
-    </RollingFile>
-  ...
-  </Appenders>
+The replica type to filter on. Valid values are NRT, TLOG, or PULL. This 
attribute is only filterable in SolrCloud mode.
 
-  <Loggers>
-  ...
-    <Logger name="org.apache.solr.metrics.reporters.SolrSlf4jReporter" 
level="info" additivity="false">
-      <AppenderRef ref="MetricsFile"/>
-    </Logger>
-  ...
-  </Loggers>
-</Configuration>
-----
+[[metrics_examples]]
+=== Examples
 
-Each log line produced by this reporter consists of configuration-specific 
fields, and a message that follows this format:
+Request only metrics from the `foobar` collection:
 
 [source,text]
-----
-type=COUNTER, name={}, count={}
-
-type=GAUGE, name={}, value={}
-
-type=TIMER, name={}, count={}, min={}, max={}, mean={}, stddev={}, median={}, 
p75={}, p95={}, p98={}, p99={}, p999={}, mean_rate={}, m1={}, m5={}, m15={}, 
rate_unit={}, duration_unit={}
-
-type=METER, name={}, count={}, mean_rate={}, m1={}, m5={}, m15={}, rate_unit={}
+http://localhost:8983/solr/admin/metrics?collection=foobar
 
-type=HISTOGRAM, name={}, count={}, min={}, max={}, mean={}, stddev={}, 
median={}, p75={}, p95={}, p98={}, p99={}, p999={}
-----
-
-(curly braces added here only as placeholders for actual values).
-
-Additionally, the following MDC context properties are passed to the logger 
and can be used in log formats:
-
-`node_name`::
-Solr node name (for SolrCloud deployments, otherwise null), prefixed with `n:`.
-
-`registry`::
-Metric registry name, prefixed with `m:`.
-
-For reporters that are specific to a SolrCore also the following properties 
are available:
-
-`collection`::
-Collection name, prefixed with `c:`.
-
-`shard`::
-Shard name, prefixed with `s:`.
-
-`replica`::
-Replica name (core node name), prefixed with `r:`.
-
-`core`::
-SolrCore name, prefixed with `x:`.
-
-`tag`::
-Reporter instance tag, prefixed with `t:`.
-
-=== Graphite Reporter
-
-The http://graphiteapp.org[Graphite] Reporter uses the 
`org.apache.solr.metrics.reporters.SolrGraphiteReporter`) class.
-
-It takes the following attributes, in addition to the common attributes 
<<Reporter Arguments,above>>.
-
-`host`::
-+
-[%autowidth,frame=none]
-|===
-s|Required |Default: none
-|===
-+
-The host name where Graphite server is running.
-
-`port`::
-+
-[%autowidth,frame=none]
-|===
-s|Required |Default: none
-|===
-+
-The port number for the server.
-
-`pickled`::
-+
-[%autowidth,frame=none]
-|===
-s|Required |Default: `false`
-|===
-+
-If `true`, use "pickled" Graphite protocol which may be more efficient.
-
-When plain-text protocol is used (`pickled==false`) it's possible to use this 
reporter to integrate with systems other than Graphite, if they can accept 
space-separated and line-oriented input over network in the following format:
+Request only the metrics with a category label of QUERY or UPDATE:
 
 [source,text]
-----
-dot.separated.metric.name[.and.attribute] value epochTimestamp
-----
+http://localhost:8983/solr/admin/metrics?category=QUERY,UPDATE
 
-For example:
+Request only `solr_core_requests_total` metrics from the 
`foobar_shard1_replica_n1` core:
 
-[source,plain]
-----
-example.solr.node.cores.loaded 1 1482932097
-example.solr.jetty.org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses.count
 21 1482932097
-example.solr.jetty.org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses.m1_rate
 2.5474287707930614 1482932097
-example.solr.jetty.org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses.m5_rate
 3.8003171557510305 1482932097
-example.solr.jetty.org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses.m15_rate
 4.0623076220244245 1482932097
-example.solr.jetty.org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses.mean_rate
 0.5698031798408144 1482932097
-----
-
-== Core Level Metrics
-
-These metrics are available only on a per-core basis.
-Metrics can be aggregated across cores using Shard and Cluster reporters.
+[source,text]
+http://localhost:8983/solr/admin/metrics?name=solr_core_requests_total&core=foobar_shard1_replica_n1
 
-=== Index Merge Metrics
+Request only the core index size `solr_core_index_size_bytes` metrics from 
collections labeled `foo` and `bar`:
 
-These metrics are collected under the `INDEX` category and track flush 
operations (documents being written to disk) and merge operations (segments on 
disk being merged).
+[source,text]
+http://localhost:8983/solr/admin/metrics?name=solr_core_index_size_bytes&collection=foo,bar
 
-For merge metrics, metrics are tracked with the distinction of "minor" and 
"major" merges (as merges with fewer documents will be typically more frequent).
-This is indicated by the `merge_type` label for the metric. The threshold for 
when a merge becomes large enough to be considered major is configurable, but
-defaults to 524k documents.
+== OTLP
 
-Metrics collection for index merges can be configured in the `<metrics>` 
section of `solrconfig.xml` as shown below:
+For users who do not use or support pulling metrics in Prometheus format with 
the `/admin/metrics` API, Solr also supports pushing metrics natively with 
https://opentelemetry.io/docs/specs/otlp/[OTLP], which is a vendor-agnostic 
protocol for pushing metrics via gRPC or HTTP. 
 
-[source,xml]
-----
-<config>
-  ...
-  <indexConfig>
-    <metrics>
-      <long name="majorMergeDocs">524288</long>
-    </metrics>
-    ...
-  </indexConfig>
-...
-</config>
-----
+OTLP is widely supported by many tools, vendors, and pipelines. See the 
OpenTelemetry https://opentelemetry.io/ecosystem/vendors/[vendors list] for 
more details on available and compatible options.
 
+=== OTLP properties
 
-== Metrics API
+Solr's internal OTLP exporter is disabled by default and is packaged with the 
OpenTelemetry module.
 
-The `admin/metrics` endpoint provides access to all the metrics for all metric 
groups.
+The module can be enabled with either the system property 
`-Dsolr.modules=opentelemetry` or the environment variable 
`SOLR_MODULES=opentelemetry`, similar to distributed tracing.
 
-A few query parameters are available to limit your request to only certain 
metrics:
+The OTLP exporter can be configured with the supported system properties 
below. These can also be set as environment variables by following these 
mapping rules:
 
-`group`::
-+
-[%autowidth,frame=none]
-|===
-|Optional |Default: `all`
-|===
-+
-The metric group to retrieve.
-The value `all` retrieves all metrics for all groups.
-Other possible values are: `jvm`, `jetty`, `node`, and `core`.
-More than one group can be specified in a request; multiple group names should 
be separated by a comma.
+- Replace `.` with `_`
+- Convert camelCase to UPPER_SNAKE_CASE

Review Comment:
   Works for me. It happen from 
[here](https://github.com/apache/solr/blob/94f249a15d310e44e1be232bb3dee966869c2d9a/solr/solrj/src/java/org/apache/solr/common/util/EnvUtils.java#L211)
 I think



-- 
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]

Reply via email to