Search in sources :

Example 1 with ThriftSender

use of io.jaegertracing.thrift.internal.senders.ThriftSender in project instrumentation-java by census-instrumentation.

the class JaegerTraceExporter method createAndRegister.

/**
 * Creates and registers the Jaeger Trace exporter to the OpenCensus library using the provided
 * configurations.
 *
 * @param configuration configurations for this exporter.
 * @throws IllegalStateException if a Jaeger exporter is already registered.
 * @since 0.22
 */
public static void createAndRegister(JaegerExporterConfiguration configuration) {
    synchronized (monitor) {
        checkState(handler == null, "Jaeger exporter is already registered.");
        ThriftSender sender = configuration.getThriftSender();
        if (sender == null) {
            sender = new HttpSender.Builder(configuration.getThriftEndpoint()).build();
        }
        Process process = new Process(configuration.getServiceName());
        SpanExporter.Handler newHandler = new JaegerExporterHandler(sender, process, configuration.getDeadline());
        JaegerTraceExporter.handler = newHandler;
        register(Tracing.getExportComponent().getSpanExporter(), newHandler);
    }
}
Also used : SpanExporter(io.opencensus.trace.export.SpanExporter) ThriftSender(io.jaegertracing.thrift.internal.senders.ThriftSender) Process(io.jaegertracing.thriftjava.Process)

Aggregations

ThriftSender (io.jaegertracing.thrift.internal.senders.ThriftSender)1 Process (io.jaegertracing.thriftjava.Process)1 SpanExporter (io.opencensus.trace.export.SpanExporter)1