janhoy opened a new pull request, #5247:
URL: https://github.com/apache/solr/pull/5247

   https://issues.apache.org/jira/browse/SOLR-18595
   
   > 🤖 **AI Assisted** — written with Claude Code; reviewed and verified by me.
   
   # Description
   
   With `solr.metrics.otlpExporterEnabled=true`, `/solr/admin/metrics` and 
`/api/metrics` answer HTTP 500 with `DuplicateLabelsException` on 
`otel_sdk_metric_reader_collection_duration_seconds`, so pull and push cannot 
be used together. Affects 10.1 and later (OpenTelemetry 1.57+); 10.0.0 shipped 
1.56.0 and is unaffected.
   
   # Solution
   
   Solr builds one `SdkMeterProvider` per registry, each with its own 
`PeriodicMetricReader` when an exporter is configured. Since OTel 1.57 that 
reader records its collection duration into the provider it belongs to, 
identified by a `ComponentId` held in a **static** field — so every reader 
reports the same component name and each registry emits the histogram with an 
identical label set. Merging the registries, which is what the endpoint does, 
then rejects the duplicates.
   
   Solr neither documents nor intends to export the SDK's own telemetry, so the 
reader is built with `InternalTelemetryVersion.LEGACY`, the pre-1.57 behaviour 
of not instrumenting itself.
   
   Filtering `otel_sdk_*` out of the Prometheus path only was the alternative, 
but the collector logs `dropped_data_points` for the same duplicates on the 
OTLP side, so suppressing them is the only fix that covers both.
   
   # Tests
   
   New 
`SolrMetricManagerTest.testExporterSelfTelemetryDoesNotBreakMergedSnapshots` 
merges several registries' snapshots as `MetricsHandler` does, with an exporter 
registered and a collection cycle forced per registry. Without the fix it fails 
with the production exception verbatim.
   
   Verified at runtime on a locally built image with OTLP push enabled: both 
nodes' metrics endpoints return 200 (were 500), no `otel_sdk_*` series, 
Prometheus scrape targets up, and the collector receives the push with no 
dropped data points.
   


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