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


##########
solr/core/src/java/org/apache/solr/metrics/SolrMetricManager.java:
##########
@@ -723,10 +734,15 @@ public SdkMeterProvider meterProvider(String 
providerName) {
             providerName,
             key -> {
               var reader = new PrometheusMetricReader(true, null);
-              // NOCOMMIT: We need to add a Periodic Metric Reader here if we 
want to push with OTLP
-              // with an exporter
-              var provider = 
SdkMeterProvider.builder().registerMetricReader(reader).build();
-              return new MeterProviderAndReaders(provider, reader);
+              var builder =
+                  SdkMeterProvider.builder()
+                      .registerMetricReader(reader)
+                      .registerMetricReader(
+                          PeriodicMetricReader.builder(metricExporter)
+                              .setInterval(OTLP_EXPORTER_INTERVAL, 
TimeUnit.MILLISECONDS)
+                              .build());
+              SdkMeterProviderUtil.setExemplarFilter(builder, 
ExemplarFilter.traceBased());

Review Comment:
   Adding in trace based exemplars. If you have Solr distributed trace on and 
push with OTLP to something like the OTEL collector, you can get exemplars on 
the metrics honored across the pipeline like so:
   ```
   
solr_metrics_core_requests_times_milliseconds_bucket{collection="demo",core="demo_shard1_replica_n1",handler="/update",job="unknown_service:java",replica="replica_n1",shard="shard1",le="50.0"}
 26 1.751574499605e+09 # 
{trace_id="4438406367ea8ea60f53e3f6e26a409d",span_id="d797ab840ed14e6d"} 30.0 
1.75157449662e+09
   ```
   
   But this is directly pinned to your traces sampling rate.



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