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);
}
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);
}
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);
}
}
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);
}
}
Aggregations