janhoy commented on code in PR #1168: URL: https://github.com/apache/solr/pull/1168#discussion_r1044217897
########## solr/modules/opentelemetry/src/java/org/apache/solr/opentelemetry/OtelTracerConfigurator.java: ########## @@ -0,0 +1,29 @@ +package org.apache.solr.opentelemetry; + +import io.opentelemetry.opentracingshim.OpenTracingShim; +import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk; +import io.opentracing.Tracer; +import org.apache.solr.core.TracerConfigurator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.lang.invoke.MethodHandles; + +public class OtelTracerConfigurator extends TracerConfigurator { + private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + @Override + public Tracer getTracer() { + // TODO: Find better way to set defaults + System.setProperty("OTEL_SERVICE_NAME", "solr"); + System.setProperty("OTEL_EXPORTER_OTLP_PROTOCOL", "grpc"); + System.setProperty("OTEL_TRACES_SAMPLER", "parentbased_always_on"); + System.setProperty("OTEL_TRACES_EXPORTER", "otlp"); + // Need to disable the exporters for metrics and logs + System.setProperty("OTEL_METRICS_EXPORTER", "none"); + System.setProperty("OTEL_LOGS_EXPORTER", "none"); + log.info("Configuring tracer {}...", getClass().getName()); Review Comment: I'm keeping it for now. Could be that it could be moved to CoreContainer, but there will ever only be one tracer configured at a time, so not less code.. -- 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: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org