Skip to content

Commit d3733d0

Browse files
authored
SOLR-17856: Solr ref-guide OpenTelemetry documentation (#3811)
Solr 10 ref-guide additions/changes after migrating from Dropwizard to OpenTelemetry. Additionally, added configurable property for changing OTLP endpoint via gRPC or HTTP.
1 parent eda0a1b commit d3733d0

File tree

17 files changed

+321
-1565
lines changed

17 files changed

+321
-1565
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
2+
title: Switch from Dropwizard to OpenTelemetry. This change provides native Prometheus support on the /admin/metrics API, OTLP support, exemplar support for tracing correlation with OpenMetrics format and native attributes and labels on all metrics.
3+
type: changed
4+
authors:
5+
- name: Matthew Biscocho
6+
- name: David Smiley
7+
- name: Sanjay Dutt
8+
- name: Jude Muriithi
9+
- name: Luke Kot-Zaniewski
10+
- name: Carlos Ugarte
11+
- name: Kevin Liang
12+
- name: Bryan Jacobowitz
13+
- name: Adam Quigley
14+
links:
15+
- name: SOLR-17458
16+
url: https://issues.apache.org/jira/browse/SOLR-17458

solr/benchmark/src/resources/solr.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
-->
2222
<solr>
2323

24-
<metrics enabled="${metricsEnabled:true}"/>
25-
2624
<str name="shareSchema">${shareSchema:false}</str>
2725
<str name="configSetBaseDir">${configSetBaseDir:configsets}</str>
2826
<str name="coreRootDirectory">${coreRootDirectory:.}</str>

solr/core/src/java/org/apache/solr/handler/admin/MetricsHandler.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,16 @@ public class MetricsHandler extends RequestHandlerBase implements PermissionName
6060
public static final String KEY_PARAM = "key";
6161
public static final String EXPR_PARAM = "expr";
6262
public static final String TYPE_PARAM = "type";
63+
6364
// Prometheus filtering parameters
6465
public static final String CATEGORY_PARAM = "category";
6566
public static final String CORE_PARAM = "core";
6667
public static final String COLLECTION_PARAM = "collection";
6768
public static final String SHARD_PARAM = "shard";
68-
public static final String REPLICA_PARAM = "replica";
69+
public static final String REPLICA_TYPE_PARAM = "replica_type";
6970
public static final String METRIC_NAME_PARAM = "name";
7071
private static final Set<String> labelFilterKeys =
71-
Set.of(CATEGORY_PARAM, CORE_PARAM, COLLECTION_PARAM, SHARD_PARAM, REPLICA_PARAM);
72+
Set.of(CATEGORY_PARAM, CORE_PARAM, COLLECTION_PARAM, SHARD_PARAM, REPLICA_TYPE_PARAM);
7273

7374
public static final String PROMETHEUS_METRICS_WT = "prometheus";
7475
public static final String OPEN_METRICS_WT = "openmetrics";

solr/core/src/java/org/apache/solr/metrics/otel/MetricExporterFactory.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,12 @@ public interface MetricExporterFactory {
3030
public static final int OTLP_EXPORTER_INTERVAL =
3131
Integer.parseInt(EnvUtils.getProperty("solr.metrics.otlpExporterInterval", "60000"));
3232

33+
public static final String OTLP_EXPORTER_GRPC_ENDPOINT =
34+
EnvUtils.getProperty("solr.metrics.otlpGrpcExporterEndpoint", "http://localhost:4317");
35+
36+
public static final String OTLP_EXPORTER_HTTP_ENDPOINT =
37+
EnvUtils.getProperty(
38+
"solr.metrics.otlpHttpExporterEndpoint", "http://localhost:4318/v1/metrics");
39+
3340
MetricExporter getExporter();
3441
}

solr/modules/opentelemetry/src/java/org/apache/solr/opentelemetry/OtlpExporterFactory.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@ public MetricExporter getExporter() {
4242
}
4343

4444
return switch (OTLP_EXPORTER_PROTOCOL) {
45-
case "grpc" -> OtlpGrpcMetricExporter.getDefault();
46-
case "http" -> OtlpHttpMetricExporter.getDefault();
45+
case "grpc" -> OtlpGrpcMetricExporter.getDefault().toBuilder()
46+
.setEndpoint(OTLP_EXPORTER_GRPC_ENDPOINT)
47+
.build();
48+
case "http" -> OtlpHttpMetricExporter.getDefault().toBuilder()
49+
.setEndpoint(OTLP_EXPORTER_HTTP_ENDPOINT)
50+
.build();
4751
case "none" -> null;
4852
default -> {
4953
log.warn(

solr/server/solr/solr.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,4 @@
5959
<int name="connTimeout">${connTimeout:60000}</int>
6060
</shardHandlerFactory>
6161

62-
<metrics enabled="${metricsEnabled:true}">
63-
<!-- Solr computes JVM metrics for threads. Computing these metrics, esp. computing deadlocks etc.,
64-
requires potentially expensive computations, and can be avoided for every metrics call by
65-
setting a high caching expiration interval (in seconds).
66-
<caching>
67-
<int name="threadsIntervalSeconds">5</int>
68-
</caching>
69-
-->
70-
<!--reporter name="jmx_metrics" group="core" class="org.apache.solr.metrics.reporters.SolrJmxReporter"/-->
71-
</metrics>
72-
73-
7462
</solr>

solr/solr-ref-guide/modules/configuration-guide/pages/configuring-solr-xml.adoc

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ The default `solr.xml` file is found in `$SOLR_TIP/server/solr/solr.xml` and loo
6565
<int name="connTimeout">${connTimeout:60000}</int>
6666
</shardHandlerFactory>
6767
68-
<metrics enabled="${metricsEnabled:true}">
69-
<!--reporter name="jmx_metrics" group="core" class="org.apache.solr.metrics.reporters.SolrJmxReporter"/-->
70-
</metrics>
71-
7268
</solr>
7369
----
7470

@@ -696,13 +692,6 @@ The `name` attribute is required and must be unique for each `clusterSingleton`.
696692
The `class` attribute should be set to the FQN (fully qualified name) of a class that extends `ClusterSingleton`.
697693
Sub-elements are specific to the implementation, `value1` is provided as an example here.
698694

699-
=== The <metrics> Element
700-
701-
The `<metrics>` element in `solr.xml` allows you to customize the metrics reported by Solr.
702-
You can define system properties that should not be returned, or define custom suppliers and reporters.
703-
704-
If you would like to customize the metrics for your installation, see the xref:deployment-guide:metrics-reporting.adoc#metrics-configuration[Metrics Configuration] section.
705-
706695
=== The <caches> Element
707696

708697
The `<caches>` element in `solr.xml` supports defining and configuring named node-level caches.

solr/solr-ref-guide/modules/configuration-guide/pages/solr-plugins.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Examples of these are query parsers, request handlers, update request processors
4242

4343
* Cluster level (or Core Container level) plugins.
4444
These are plugins that are installed at a cluster level and every Solr node has one instance each of these plugins.
45-
Examples of these are xref:deployment-guide:authentication-and-authorization-plugins.adoc[], xref:deployment-guide:metrics-reporting.adoc#reporters[metrics reporters], https://issues.apache.org/jira/browse/SOLR-14404[cluster level request handlers], etc.
45+
Examples of these are xref:deployment-guide:authentication-and-authorization-plugins.adoc[], https://issues.apache.org/jira/browse/SOLR-14404[cluster level request handlers], etc.
4646

4747
== Installing Plugins ==
4848

solr/solr-ref-guide/modules/deployment-guide/deployment-nav.adoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@
6161
** xref:metrics-reporting.adoc[]
6262
** xref:performance-statistics-reference.adoc[]
6363
** xref:plugins-stats-screen.adoc[]
64-
** xref:mbean-request-handler.adoc[]
65-
** xref:monitoring-with-prometheus-and-grafana.adoc[]
6664
** xref:jmx-with-solr.adoc[]
6765
** xref:thread-dump.adoc[]
6866
** xref:distributed-tracing.adoc[]

solr/solr-ref-guide/modules/deployment-guide/pages/jmx-with-solr.adoc

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,14 @@ In essence, it is a standard interface by which complex systems can be viewed an
2222
Solr, like any other good citizen of the Java universe, can be controlled via a JMX interface.
2323
Once enabled, you can use a JMX client, like jconsole, to connect with Solr.
2424

25-
If you are unfamiliar with JMX, you may find the following overview useful: http://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html.
25+
If you are unfamiliar with JMX, you may find the following overview useful: http://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html.
2626

2727
== Configuring JMX
2828

29-
JMX support is configured by defining a metrics reporter, as described in the section the section xref:metrics-reporting.adoc#jmx-reporter[JMX Reporter].
30-
31-
If you have an existing MBean server running in Solr's JVM, or if you start Solr with the system property `-Dcom.sun.management.jmxremote`, Solr will automatically identify its location on startup even if you have not defined a reporter explicitly in `solr.xml`.
32-
You can also define the location of the MBean server with parameters defined in the reporter definition.
29+
If you have an existing MBean server running in Solr's JVM, or if you start Solr with the system property `-Dcom.sun.management.jmxremote`, Solr will automatically identify its location on startup.
3330

3431
== Configuring MBean Servers
3532

36-
Versions of Solr prior to 7.0 defined JMX support in `solrconfig.xml`.
37-
This has been changed to the metrics reporter configuration defined above.
38-
Parameters for the reporter configuration allow defining the location or address of an existing MBean server.
39-
4033
An MBean server can be started at the time of Solr's startup by passing the system parameter `-Dcom.sun.management.jmxremote`.
4134
See Oracle's documentation for additional settings available to start and control an MBean server at http://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html.
4235

0 commit comments

Comments
 (0)