Search in sources :

Example 1 with Handler

use of io.opencensus.trace.export.SpanExporter.Handler in project instrumentation-java by census-instrumentation.

the class ElasticsearchTraceExporterTest method testRegisterElasticsearchExporterService.

@Test
public void testRegisterElasticsearchExporterService() throws Exception {
    Handler handler = new ElasticsearchTraceHandler(elasticsearchTraceConfiguration);
    ElasticsearchTraceExporter.register(spanExporter, handler);
    verify(spanExporter).registerHandler(REGISTERED_TRACE_EXPORTER_NAME, handler);
}
Also used : Handler(io.opencensus.trace.export.SpanExporter.Handler) Test(org.junit.Test)

Example 2 with Handler

use of io.opencensus.trace.export.SpanExporter.Handler in project instrumentation-java by census-instrumentation.

the class ElasticsearchTraceExporterTest method testUnregisterElasticsearchExporterService.

@Test
public void testUnregisterElasticsearchExporterService() throws Exception {
    Handler handler = new ElasticsearchTraceHandler(elasticsearchTraceConfiguration);
    ElasticsearchTraceExporter.register(spanExporter, handler);
    verify(spanExporter).registerHandler(REGISTERED_TRACE_EXPORTER_NAME, handler);
    ElasticsearchTraceExporter.unregister(spanExporter);
    verify(spanExporter).unregisterHandler(REGISTERED_TRACE_EXPORTER_NAME);
}
Also used : Handler(io.opencensus.trace.export.SpanExporter.Handler) Test(org.junit.Test)

Example 3 with Handler

use of io.opencensus.trace.export.SpanExporter.Handler in project instrumentation-java by census-instrumentation.

the class InstanaTraceExporter method createAndRegister.

/**
 * Creates and registers the Instana Trace exporter to the OpenCensus library. Only one Instana
 * exporter can be registered at any point.
 *
 * @param configuration Configuration for InstanaTraceExporter.
 * @throws MalformedURLException if the agentEndpoint is not a valid http url.
 * @throws IllegalStateException if a Instana exporter is already registered.
 * @since 0.22
 */
public static void createAndRegister(InstanaExporterConfiguration configuration) throws MalformedURLException {
    synchronized (monitor) {
        checkState(handler == null, "Instana exporter is already registered.");
        Handler newHandler = new InstanaExporterHandler(new URL(configuration.getAgentEndpoint()), configuration.getDeadline());
        handler = newHandler;
        register(Tracing.getExportComponent().getSpanExporter(), newHandler);
    }
}
Also used : Handler(io.opencensus.trace.export.SpanExporter.Handler) URL(java.net.URL)

Example 4 with Handler

use of io.opencensus.trace.export.SpanExporter.Handler in project instrumentation-java by census-instrumentation.

the class ZipkinTraceExporter method createAndRegister.

/**
 * Creates and registers the Zipkin Trace exporter to the OpenCensus library. Only one Zipkin
 * exporter can be registered at any point.
 *
 * @param configuration configuration for this exporter.
 * @throws IllegalStateException if a Zipkin exporter is already registered.
 * @since 0.22
 */
public static void createAndRegister(ZipkinExporterConfiguration configuration) {
    synchronized (monitor) {
        checkState(handler == null, "Zipkin exporter is already registered.");
        Sender sender = configuration.getSender();
        if (sender == null) {
            sender = URLConnectionSender.create(configuration.getV2Url());
        }
        Handler newHandler = new ZipkinExporterHandler(configuration.getEncoder(), sender, configuration.getServiceName(), configuration.getDeadline());
        handler = newHandler;
        register(Tracing.getExportComponent().getSpanExporter(), newHandler);
    }
}
Also used : URLConnectionSender(zipkin2.reporter.urlconnection.URLConnectionSender) Sender(zipkin2.reporter.Sender) Handler(io.opencensus.trace.export.SpanExporter.Handler)

Aggregations

Handler (io.opencensus.trace.export.SpanExporter.Handler)4 Test (org.junit.Test)2 URL (java.net.URL)1 Sender (zipkin2.reporter.Sender)1 URLConnectionSender (zipkin2.reporter.urlconnection.URLConnectionSender)1