Search in sources :

Example 1 with ZipkinTracer

use of org.apache.camel.zipkin.ZipkinTracer in project camel by apache.

the class ZipkinOneRouteFallbackScribe method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();
    zipkin = new ZipkinTracer();
    // no service so should use fallback naming style
    // we do not want to trace any direct endpoints
    zipkin.addExcludePattern("direct:*");
    zipkin.setIncludeMessageBody(true);
    zipkin.setSpanCollector(new ScribeSpanCollector(ip, 9410));
    // attaching ourself to CamelContext
    zipkin.init(context);
    return context;
}
Also used : CamelContext(org.apache.camel.CamelContext) ScribeSpanCollector(com.github.kristofa.brave.scribe.ScribeSpanCollector) ZipkinTracer(org.apache.camel.zipkin.ZipkinTracer)

Example 2 with ZipkinTracer

use of org.apache.camel.zipkin.ZipkinTracer in project camel by apache.

the class ZipkinOneRouteScribe method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();
    zipkin = new ZipkinTracer();
    // we have one route as service
    zipkin.addClientServiceMapping("seda:cat", "cat");
    zipkin.addServerServiceMapping("seda:cat", "cat");
    zipkin.setSpanCollector(new ScribeSpanCollector(ip, 9410));
    // attaching ourself to CamelContext
    zipkin.init(context);
    return context;
}
Also used : CamelContext(org.apache.camel.CamelContext) ScribeSpanCollector(com.github.kristofa.brave.scribe.ScribeSpanCollector) ZipkinTracer(org.apache.camel.zipkin.ZipkinTracer)

Example 3 with ZipkinTracer

use of org.apache.camel.zipkin.ZipkinTracer in project camel by apache.

the class ZipkinSimpleRouteScribe method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();
    zipkin = new ZipkinTracer();
    // we have one route as service
    zipkin.addClientServiceMapping("seda:dude", "dude");
    zipkin.addServerServiceMapping("seda:dude", "dude");
    zipkin.setSpanCollector(new ScribeSpanCollector(ip, 9410));
    // attaching ourself to CamelContext
    zipkin.init(context);
    return context;
}
Also used : CamelContext(org.apache.camel.CamelContext) ScribeSpanCollector(com.github.kristofa.brave.scribe.ScribeSpanCollector) ZipkinTracer(org.apache.camel.zipkin.ZipkinTracer)

Example 4 with ZipkinTracer

use of org.apache.camel.zipkin.ZipkinTracer in project camel by apache.

the class ZipkinTwoRouteScribe method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();
    zipkin = new ZipkinTracer();
    // we have 2 routes as services
    zipkin.addClientServiceMapping("seda:cat", "cat");
    zipkin.addServerServiceMapping("seda:cat", "cat");
    zipkin.addClientServiceMapping("seda:dog", "dog");
    zipkin.addServerServiceMapping("seda:dog", "dog");
    // capture message body as well
    zipkin.setIncludeMessageBody(true);
    zipkin.setSpanCollector(new ScribeSpanCollector(ip, 9410));
    // attaching ourself to CamelContext
    zipkin.init(context);
    return context;
}
Also used : CamelContext(org.apache.camel.CamelContext) ScribeSpanCollector(com.github.kristofa.brave.scribe.ScribeSpanCollector) ZipkinTracer(org.apache.camel.zipkin.ZipkinTracer)

Example 5 with ZipkinTracer

use of org.apache.camel.zipkin.ZipkinTracer in project camel by apache.

the class ZipkinAutoConfiguration method zipkinEventNotifier.

@Bean(initMethod = "", destroyMethod = "")
// Camel handles the lifecycle of this bean
@ConditionalOnMissingBean(ZipkinTracer.class)
ZipkinTracer zipkinEventNotifier(CamelContext camelContext, ZipkinConfigurationProperties config) {
    ZipkinTracer zipkin = new ZipkinTracer();
    zipkin.setHostName(config.getHostName());
    zipkin.setPort(config.getPort());
    zipkin.setRate(config.getRate());
    if (ObjectHelper.isNotEmpty(config.getServiceName())) {
        zipkin.setServiceName(config.getServiceName());
    }
    if (config.getExcludePatterns() != null) {
        zipkin.setExcludePatterns(config.getExcludePatterns());
    }
    if (config.getClientServiceMappings() != null) {
        zipkin.setClientServiceMappings(config.getClientServiceMappings());
    }
    if (config.getServerServiceMappings() != null) {
        zipkin.setServerServiceMappings(config.getServerServiceMappings());
    }
    zipkin.setIncludeMessageBody(config.isIncludeMessageBody());
    zipkin.setIncludeMessageBodyStreams(config.isIncludeMessageBodyStreams());
    // register the bean into CamelContext
    zipkin.init(camelContext);
    return zipkin;
}
Also used : ZipkinTracer(org.apache.camel.zipkin.ZipkinTracer) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

ZipkinTracer (org.apache.camel.zipkin.ZipkinTracer)11 CamelContext (org.apache.camel.CamelContext)8 ScribeSpanCollector (com.github.kristofa.brave.scribe.ScribeSpanCollector)7 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Bean (org.springframework.context.annotation.Bean)1