Java Code Examples for zipkin2.reporter.AsyncReporter#create()

The following examples show how to use zipkin2.reporter.AsyncReporter#create() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZipkinTraceFactory.java    From pampas with Apache License 2.0 6 votes vote down vote up
@Override
public Tracer getTracer() {
    Sender sender = OkHttpSender.create("http://192.168.20.131:9411/api/v2/spans");

    Reporter spanReporter = AsyncReporter.create(sender);
    // If you want to support baggage, indicate the fields you'd like to
    // whitelist, in this case "country-code" and "user-id". On the wire,
    // they will be prefixed like "baggage-country-code"
    Propagation.Factory propagationFactory = ExtraFieldPropagation.newFactoryBuilder(B3Propagation.FACTORY)
            .addPrefixedFields("baggage-", Arrays.asList("country-code", "user-id"))
            .build();
    Tracing braveTracing = Tracing.newBuilder()
            .localServiceName("gateway")
            .propagationFactory(propagationFactory)
            .spanReporter(spanReporter)
            .build();
    Tracer tracer = BraveTracer.create(braveTracing);

    return tracer;
}
 
Example 2
Source File: CatalogTracing.java    From cxf with Apache License 2.0 6 votes vote down vote up
public HttpTracing getHttpTracing() {
    HttpTracing result = httpTracing;
    
    if (result == null) {
        synchronized (this) {
            result = httpTracing;
            if (result == null) {
                sender = OkHttpSender.create("http://localhost:9411/api/v2/spans");
                reporter = AsyncReporter.create(sender);
                result = createHttpTracing(serviceName, reporter);
                httpTracing = result;
            }
        }
    }
    
    return result;
}
 
Example 3
Source File: ZipkinForwarderTest.java    From pitchfork with Apache License 2.0 5 votes vote down vote up
/**
 * Create reporter.
 */
private AsyncReporter<zipkin2.Span> setupReporter(Encoding encoding, boolean compressionEnabled) {
    var sender = OkHttpSender.newBuilder()
            .encoding(encoding)
            .compressionEnabled(compressionEnabled)
            .endpoint("http://localhost:" + localServerPort + "/api/v2/spans")
            .build();
    return AsyncReporter.create(sender);
}
 
Example 4
Source File: RabbitMqIngressTest.java    From pitchfork with Apache License 2.0 5 votes vote down vote up
/**
 * Create reporter.
 */
private AsyncReporter<Span> setupReporter(Encoding encoding) {
    var sender = RabbitMQSender.newBuilder()
            .username("guest")
            .username("guest")
            .virtualHost("/")
            .encoding(encoding)
            .queue("zipkin")
            .addresses(rabbitMqContainer.getContainerIpAddress() + ":" + rabbitMqContainer.getFirstMappedPort())
            .build();
    return AsyncReporter.create(sender);
}
 
Example 5
Source File: KafkaIngressTest.java    From pitchfork with Apache License 2.0 5 votes vote down vote up
/**
 * Create reporter.
 */
private static AsyncReporter<zipkin2.Span> setupReporter() {
    var sender = KafkaSender.newBuilder()
            .encoding(Encoding.PROTO3)
            .bootstrapServers(kafkaContainer.getBootstrapServers())
            .build();
    return AsyncReporter.create(sender);
}
 
Example 6
Source File: HaystackKinesisForwarderTest.java    From pitchfork with Apache License 2.0 5 votes vote down vote up
/**
 * Create reporter.
 */
private AsyncReporter<zipkin2.Span> setupReporter() {
    var sender = OkHttpSender.newBuilder()
            .encoding(Encoding.PROTO3)
            .endpoint("http://localhost:" + localServerPort + "/api/v2/spans")
            .build();
    return AsyncReporter.create(sender);
}
 
Example 7
Source File: HaystackKafkaForwarderTest.java    From pitchfork with Apache License 2.0 5 votes vote down vote up
/**
 * Create reporter.
 */
private AsyncReporter<zipkin2.Span> setupReporter() {
    var sender = OkHttpSender.newBuilder()
            .encoding(Encoding.PROTO3)
            .endpoint("http://localhost:" + localServerPort + "/api/v2/spans")
            .build();
    return AsyncReporter.create(sender);
}
 
Example 8
Source File: WingtipsToZipkinLifecycleListener.java    From wingtips with Apache License 2.0 5 votes vote down vote up
/**
 * @param postZipkinSpansBaseUrl The Zipkin base URL. This is everything except the endpoint path, i.e.
 * {@code http://foo.bar:9411}.
 * @return A new {@link AsyncReporter} that uses a basic {@link URLConnectionSender} for sending spans via HTTP to
 * the standard Zipkin {@code POST /api/v2/spans} endpoint.
 */
public static Reporter<zipkin2.Span> generateBasicZipkinReporter(String postZipkinSpansBaseUrl) {
    return AsyncReporter.create(
        URLConnectionSender.create(
            postZipkinSpansBaseUrl + (postZipkinSpansBaseUrl.endsWith("/") ? "" : "/") + "api/v2/spans"
        )
    );
}
 
Example 9
Source File: StackdriverTraceAutoConfigurationTests.java    From spring-cloud-gcp with Apache License 2.0 4 votes vote down vote up
@Bean
Reporter<zipkin2.Span> otherReporter(OtherSender otherSender) {
	return AsyncReporter.create(otherSender);
}
 
Example 10
Source File: TracingConfiguration.java    From brave-webmvc-example with MIT License 4 votes vote down vote up
/** Configuration for how to buffer spans into messages for Zipkin */
@Bean AsyncReporter<Span> spanReporter() {
  return AsyncReporter.create(sender());
}
 
Example 11
Source File: TracingConfiguration.java    From brave-webmvc-example with MIT License 4 votes vote down vote up
/** Configuration for how to buffer spans into messages for Zipkin */
@Bean AsyncReporter<Span> spanReporter() {
  return AsyncReporter.create(sender());
}
 
Example 12
Source File: ZipkinAutoConfigurationTests.java    From spring-cloud-sleuth with Apache License 2.0 4 votes vote down vote up
@Bean(ZipkinAutoConfiguration.REPORTER_BEAN_NAME)
Reporter<zipkin2.Span> myReporter() {
	return AsyncReporter.create(mySender());
}
 
Example 13
Source File: ZipkinAutoConfigurationTests.java    From spring-cloud-sleuth with Apache License 2.0 4 votes vote down vote up
@Bean
Reporter<zipkin2.Span> otherReporter() {
	return AsyncReporter.create(otherSender());
}
 
Example 14
Source File: TracingConfiguration.java    From java-tutorial with Creative Commons Attribution Share Alike 4.0 International 4 votes vote down vote up
/** Configuration for how to buffer spans into messages for Zipkin */
@Bean
AsyncReporter<Span> spanReporter() {
    return AsyncReporter.create(sender());
}
 
Example 15
Source File: TracingConfiguration.java    From java-tutorial with Creative Commons Attribution Share Alike 4.0 International 4 votes vote down vote up
/** Configuration for how to buffer spans into messages for Zipkin */
@Bean AsyncReporter<Span> spanReporter() {
  return AsyncReporter.create(sender());
}
 
Example 16
Source File: TracingConfiguration.java    From txle with Apache License 2.0 4 votes vote down vote up
@Bean
AsyncReporter<Span> spanReporter() {
    return AsyncReporter.create(sender());
}
 
Example 17
Source File: ZipkinSofaTracerSpanRemoteReporter.java    From sofa-tracer with Apache License 2.0 4 votes vote down vote up
public ZipkinSofaTracerSpanRemoteReporter(RestTemplate restTemplate, String baseUrl) {

        this.zipkinV2SpanAdapter = new ZipkinV2SpanAdapter();
        this.sender = new ZipkinRestTemplateSender(restTemplate, baseUrl);
        this.delegate = AsyncReporter.create(sender);
    }
 
Example 18
Source File: TracingConfiguration.java    From txle with Apache License 2.0 4 votes vote down vote up
@Bean
AsyncReporter<Span> spanReporter() {
    return AsyncReporter.create(sender());
}