Skip to content

Commit

Permalink
Wind down the verboseness of logging of OpenTelemetry spans
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Mar 20, 2020
1 parent e88e764 commit 8e623f4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion java/server/src/org/openqa/selenium/grid/log/LoggingOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import io.opentelemetry.exporters.logging.LoggingExporter;
import io.opentelemetry.sdk.OpenTelemetrySdk;
import io.opentelemetry.sdk.trace.MultiSpanProcessor;
import io.opentelemetry.sdk.trace.SpanData;
import io.opentelemetry.sdk.trace.SpanProcessor;
import io.opentelemetry.sdk.trace.TracerSdkFactory;
import io.opentelemetry.sdk.trace.export.SimpleSpansProcessor;
Expand All @@ -39,6 +40,7 @@
public class LoggingOptions {

private final Config config;
private static final Logger LOGGER = Logger.getLogger(LoggingOptions.class.getName());

public LoggingOptions(Config config) {
this.config = Objects.requireNonNull(config);
Expand All @@ -56,7 +58,18 @@ public Tracer getTracer() {
TracerSdkFactory tracerFactory = OpenTelemetrySdk.getTracerFactory();

List<SpanProcessor> exporters = new LinkedList<>();
exporters.add(SimpleSpansProcessor.newBuilder(new LoggingExporter()).build());
exporters.add(SimpleSpansProcessor.newBuilder(new SpanExporter() {
@Override
public ResultCode export(List<SpanData> spans) {
spans.forEach(span -> LOGGER.fine("span: " + spans));
return ResultCode.SUCCESS;
}

@Override
public void shutdown() {

}
}).build());

// 2020-01-28: The Jaeger exporter doesn't yet have a
// `TracerFactoryProvider`, so we shall look up the class using
Expand Down

0 comments on commit 8e623f4

Please sign in to comment.