This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 947e145309412505f8a0f497420d2bf2cf3993b1 Author: Adrian Cole <ac...@pivotal.io> AuthorDate: Fri Dec 15 18:38:26 2017 +0800 Adds zipkin http transport and moves off deprecated collector This allows you to use zipkin's http endpoint, and any modern transport. This is important as scribe is deprecated. Notably, this doesn't change internal plumbing to use new Brave Tracer api, though that can be done in a later change. --- components/camel-zipkin/pom.xml | 12 +- components/camel-zipkin/src/main/docs/zipkin.adoc | 36 ++++-- .../camel/zipkin/ZipkinLegacyReporterAdapter.java | 47 +++++++ .../java/org/apache/camel/zipkin/ZipkinTracer.java | 136 +++++++++++++++------ .../camel/zipkin/ManagedZipkinSimpleRouteTest.java | 7 +- .../apache/camel/zipkin/ZipkinABCRouteTest.java | 7 +- .../zipkin/ZipkinClientRecipientListRouteTest.java | 7 +- .../camel/zipkin/ZipkinMulticastRouteTest.java | 7 +- ...Scribe.java => ZipkinOneRouteFallbackTest.java} | 22 ++-- ...onfigureScribe.java => ZipkinOneRouteTest.java} | 20 ++- .../camel/zipkin/ZipkinRecipientListRouteTest.java | 7 +- .../camel/zipkin/ZipkinRouteConcurrentTest.java | 7 +- .../zipkin/ZipkinSimpleFallbackRouteTest.java | 7 +- .../zipkin/ZipkinSimpleLogStreamsRouteTest.java | 7 +- .../apache/camel/zipkin/ZipkinSimpleRouteTest.java | 7 +- ....java => ZipkinSpanReporterInRegistryTest.java} | 9 +- ...rRouteScribe.java => ZipkinTimerRouteTest.java} | 23 ++-- .../apache/camel/zipkin/ZipkinTwoRouteTest.java | 7 +- .../camel/zipkin/http/ZipkinABCRouteHttp.java | 40 +++--- .../ZipkinAutoConfigureHttp.java} | 22 ++-- .../zipkin/http/ZipkinMulticastRouteHttp.java | 40 +++--- .../zipkin/http/ZipkinOneRouteFallbackHttp.java | 40 +++--- .../camel/zipkin/http/ZipkinOneRouteHttp.java | 40 +++--- .../camel/zipkin/http/ZipkinSimpleRouteHttp.java | 40 +++--- .../camel/zipkin/http/ZipkinTimerRouteHttp.java | 40 +++--- .../camel/zipkin/http/ZipkinTwoRouteHttp.java | 40 +++--- .../camel/zipkin/scribe/ZipkinABCRouteScribe.java | 78 ++---------- .../zipkin/scribe/ZipkinAutoConfigureScribe.java | 15 ++- .../zipkin/scribe/ZipkinMulticastRouteScribe.java | 79 ++---------- .../scribe/ZipkinOneRouteFallbackScribe.java | 58 ++------- .../camel/zipkin/scribe/ZipkinOneRouteScribe.java | 56 ++------- .../zipkin/scribe/ZipkinSimpleRouteScribe.java | 58 ++------- .../zipkin/scribe/ZipkinTimerRouteScribe.java | 64 ++-------- .../camel/zipkin/scribe/ZipkinTwoRouteScribe.java | 67 ++-------- examples/camel-example-zipkin/README.md | 14 +-- .../main/java/sample/camel/ClientApplication.java | 3 +- .../src/main/resources/application.properties | 3 +- .../src/main/java/sample/camel/Service2Route.java | 3 +- parent/pom.xml | 6 +- .../karaf/features/src/main/resources/features.xml | 4 +- .../zipkin/starter/ZipkinAutoConfiguration.java | 1 + .../starter/ZipkinConfigurationProperties.java | 17 ++- 42 files changed, 514 insertions(+), 689 deletions(-) diff --git a/components/camel-zipkin/pom.xml b/components/camel-zipkin/pom.xml index 287b076..1e77677 100644 --- a/components/camel-zipkin/pom.xml +++ b/components/camel-zipkin/pom.xml @@ -48,14 +48,24 @@ <artifactId>camel-core</artifactId> </dependency> - <!-- brave/zkpkin --> + <!-- brave/zipkin --> <dependency> <groupId>io.zipkin.brave</groupId> <artifactId>brave-core</artifactId> <version>${brave-zipkin-version}</version> </dependency> + <dependency> + <groupId>io.zipkin.brave</groupId> + <artifactId>brave</artifactId> + <version>${brave-zipkin-version}</version> + </dependency> <!-- to send to zipkin server --> <dependency> + <groupId>io.zipkin.reporter2</groupId> + <artifactId>zipkin-sender-urlconnection</artifactId> + <version>${zipkin-reporter-version}</version> + </dependency> + <dependency> <groupId>io.zipkin.brave</groupId> <artifactId>brave-spancollector-scribe</artifactId> <version>${brave-zipkin-version}</version> diff --git a/components/camel-zipkin/src/main/docs/zipkin.adoc b/components/camel-zipkin/src/main/docs/zipkin.adoc index b8eaaab..89d3722 100644 --- a/components/camel-zipkin/src/main/docs/zipkin.adoc +++ b/components/camel-zipkin/src/main/docs/zipkin.adoc @@ -29,11 +29,15 @@ endpoint uri's as service names. + However, it's recommended to configure service mappings so you can use human-readable names instead of Camel endpoint uris in the names. -Camel will auto-configure a ScribeSpanCollector if no spanCollector has been -explicitly configured, or if the following SpanCollector hostname and port environment variables -have been configured: +Camel will auto-configure a span reporter one hasn't been explicitly configured, +and if the hostname and port to a zipkin collector has been configured as environment variables -* ZIPKIN_COLLECTOR_THRIFT_SERVICE_HOST - The hostname +* ZIPKIN_COLLECTOR_HTTP_SERVICE_HOST - The http hostname +* ZIPKIN_COLLECTOR_HTTP_SERVICE_PORT - The port number + +or + +* ZIPKIN_COLLECTOR_THRIFT_SERVICE_HOST - The Scribe (Thrift RPC) hostname * ZIPKIN_COLLECTOR_THRIFT_SERVICE_PORT - The port number This makes it easy to use camel-zipkin in container platforms where the @@ -52,7 +56,7 @@ Options zipkin. The rate is expressed as a percentage (1.0f = 100%, 0.5f is 50%, 0.1f is 10%). -|spanCollector | |*Mandatory:* The collector to use for sending zipkin span events to the +|spanReporter | |*Mandatory:* The reporter to use for sending zipkin span events to the zipkin server. |serviceName | | To use a global service name that matches all Camel events @@ -92,8 +96,10 @@ To enable camel-zipkin you need to configure first [source,java] -------------------------------------------------------------------------------------------------- ZipkinTracer zipkin = new ZipkinTracer(); -// configure the scribe span collector with the hostname and port for the Zipkin Collector Server -zipkin.setSpanCollector(new ScribeSpanCollector("192.168.90.100", 9410); +// Configure a reporter, which controls how often spans are sent +// (the dependency is io.zipkin.reporter2:zipkin-sender-okhttp3) +sender = OkHttpSender.create("http://127.0.0.1:9411/api/v2/spans"); +zipkin.setSpanReporter(AsyncReporter.create(sender)); // and then add zipkin to the CamelContext zipkin.init(camelContext); -------------------------------------------------------------------------------------------------- @@ -106,16 +112,22 @@ zipkin tracer beans. Camel will automatically discover and use them. [source,xml] --------------------------------------------------------------------------------------------------------- - <!-- configure the scribe span collector with the hostname and port for the Zipkin Collector Server --> - <bean id="scribe" class="com.github.kristofa.brave.scribe.ScribeSpanCollector"> - <constructor-arg index="0" value="192.168.90.100"/> - <constructor-arg index="1" value="9410"/> + <!-- configure how to reporter spans to a Zipkin collector + (the dependency is io.zipkin.reporter2:zipkin-reporter-spring-beans) --> + <bean id="http" class="zipkin2.reporter.beans.AsyncReporterFactoryBean"> + <property name="sender"> + <bean id="sender" class="zipkin2.reporter.beans.OkHttpSenderFactoryBean"> + <property name="endpoint" value="http://localhost:9411/api/v2/spans"/> + </bean> + </property> + <!-- wait up to half a second for any in-flight spans on close --> + <property name="closeTimeout" value="500"/> </bean> <!-- setup zipkin tracer --> <bean id="zipkinTracer" class="org.apache.camel.zipkin.ZipkinTracer"> <property name="serviceName" value="dude"/> - <property name="spanCollector" ref="scribe"/> + <property name="spanReporter" ref="http"/> </bean> --------------------------------------------------------------------------------------------------------- diff --git a/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinLegacyReporterAdapter.java b/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinLegacyReporterAdapter.java new file mode 100644 index 0000000..9df176f --- /dev/null +++ b/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinLegacyReporterAdapter.java @@ -0,0 +1,47 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.zipkin; + +import com.github.kristofa.brave.SpanCollector; +import com.github.kristofa.brave.internal.DefaultSpanCodec; +import com.twitter.zipkin.gen.Span; +import zipkin.internal.V2SpanConverter; +import zipkin2.reporter.Reporter; + +final class ZipkinLegacyReporterAdapter implements SpanCollector, Reporter<zipkin2.Span> { + + final SpanCollector delegate; + + ZipkinLegacyReporterAdapter(SpanCollector delegate) { + this.delegate = delegate; + } + + @Override public void report(zipkin2.Span span) { + collect(DefaultSpanCodec.fromZipkin(V2SpanConverter.toSpan(span))); + } + + @Override + public void collect(Span span) { + delegate.collect(span); + } + + @Deprecated + @Override + public void addDefaultAnnotation(String key, String value) { + delegate.addDefaultAnnotation(key, value); + } +} diff --git a/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinTracer.java b/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinTracer.java index 9e5878f..7f507c9 100644 --- a/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinTracer.java +++ b/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinTracer.java @@ -23,12 +23,14 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; +import brave.Tracing; +import brave.sampler.Sampler; import com.github.kristofa.brave.Brave; import com.github.kristofa.brave.ClientSpanThreadBinder; -import com.github.kristofa.brave.Sampler; import com.github.kristofa.brave.ServerSpan; import com.github.kristofa.brave.ServerSpanThreadBinder; import com.github.kristofa.brave.SpanCollector; +import com.github.kristofa.brave.TracerAdapter; import com.github.kristofa.brave.scribe.ScribeSpanCollector; import com.twitter.zipkin.gen.Span; import org.apache.camel.CamelContext; @@ -59,6 +61,9 @@ import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.ServiceHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import zipkin2.reporter.AsyncReporter; +import zipkin2.reporter.Reporter; +import zipkin2.reporter.urlconnection.URLConnectionSender; import static org.apache.camel.builder.ExpressionBuilder.routeIdExpression; @@ -81,10 +86,15 @@ import static org.apache.camel.builder.ExpressionBuilder.routeIdExpression; * However its recommended to configure service mappings so you can use human logic names instead of Camel * endpoint uris in the names. * <p/> - * Camel will auto-configure a {@link ScribeSpanCollector} if no SpanCollector explicit has been configured, and - * if the hostname and port to the span collector has been configured as environment variables + * Camel will auto-configure a {@link Reporter span reporter} one hasn't been explicitly configured, + * and if the hostname and port to a zipkin collector has been configured as environment variables * <ul> - * <li>ZIPKIN_COLLECTOR_THRIFT_SERVICE_HOST - The hostname</li> + * <li>ZIPKIN_COLLECTOR_HTTP_SERVICE_HOST - The http hostname</li> + * <li>ZIPKIN_COLLECTOR_HTTP_SERVICE_PORT - The port number</li> + * </ul> + * or + * <ul> + * <li>ZIPKIN_COLLECTOR_THRIFT_SERVICE_HOST - The Scribe (Thrift RPC) hostname</li> * <li>ZIPKIN_COLLECTOR_THRIFT_SERVICE_PORT - The port number</li> * </ul> * <p/> @@ -96,16 +106,19 @@ import static org.apache.camel.builder.ExpressionBuilder.routeIdExpression; public class ZipkinTracer extends ServiceSupport implements RoutePolicyFactory, StaticService, CamelContextAware { private static final Logger LOG = LoggerFactory.getLogger(ZipkinTracer.class); + private static final String ZIPKIN_COLLECTOR_HTTP_SERVICE = "zipkin-collector-http"; private static final String ZIPKIN_COLLECTOR_THRIFT_SERVICE = "zipkin-collector-thrift"; private final ZipkinEventNotifier eventNotifier = new ZipkinEventNotifier(); private final Map<String, Brave> braves = new HashMap<>(); private transient boolean useFallbackServiceNames; private CamelContext camelContext; + private String endpoint; private String hostName; private int port; private float rate = 1.0f; private SpanCollector spanCollector; + private Reporter<zipkin2.Span> spanReporter; private Map<String, String> clientServiceMappings = new HashMap<>(); private Map<String, String> serverServiceMappings = new HashMap<>(); private Set<String> excludePatterns = new HashSet<>(); @@ -144,25 +157,38 @@ public class ZipkinTracer extends ServiceSupport implements RoutePolicyFactory, this.camelContext = camelContext; } - @ManagedAttribute(description = "The hostname for the remote zipkin server to use.") + @ManagedAttribute(description = "The POST URL for zipkin's v2 api.") + public String getEndpoint() { + return endpoint; + } + + /** + * Sets the POST URL for zipkin's <a href="http://zipkin.io/zipkin-api/#/">v2 api</a>, usually + * "http://zipkinhost:9411/api/v2/spans" + */ + public void setEndpoint(String endpoint) { + this.endpoint = endpoint; + } + + @ManagedAttribute(description = "The hostname for the remote zipkin scribe collector.") public String getHostName() { return hostName; } /** - * Sets a hostname for the remote zipkin server to use. + * Sets the hostname for the remote zipkin scribe collector. */ public void setHostName(String hostName) { this.hostName = hostName; } - @ManagedAttribute(description = "The port number for the remote zipkin server to use.") + @ManagedAttribute(description = "The port number for the remote zipkin scribe collector.") public int getPort() { return port; } /** - * Sets the port number for the remote zipkin server to use. + * Sets the port number for the remote zipkin scribe collector. */ public void setPort(int port) { this.port = port; @@ -183,14 +209,30 @@ public class ZipkinTracer extends ServiceSupport implements RoutePolicyFactory, this.rate = rate; } + /** + * Returns the legacy span collector or null if using the reporter + * + * @deprecated use {@link #getSpanReporter()} + */ + @Deprecated public SpanCollector getSpanCollector() { return spanCollector; } - /** - * The collector to use for sending zipkin span events to the zipkin server. - */ + /** Sets the reporter used to send timing data (spans) to the zipkin server. */ + public void setSpanReporter(Reporter<zipkin2.Span> spanReporter) { + this.spanReporter = spanReporter; + } + + /** Returns the reporter used to send timing data (spans) to the zipkin server. */ + public Reporter<zipkin2.Span> getSpanReporter() { + return spanReporter; + } + + /** @deprecated use {@link #setSpanReporter(Reporter)} */ + @Deprecated public void setSpanCollector(SpanCollector spanCollector) { + this.spanReporter = new ZipkinLegacyReporterAdapter(spanCollector); this.spanCollector = spanCollector; } @@ -307,31 +349,45 @@ public class ZipkinTracer extends ServiceSupport implements RoutePolicyFactory, camelContext.addRoutePolicyFactory(this); } - if (spanCollector == null) { - if (hostName != null && port > 0) { + if (spanReporter == null) { + if (spanCollector != null) { // possible via setter + spanReporter = new ZipkinLegacyReporterAdapter(spanCollector); + } else if (endpoint != null) { + LOG.info("Configuring Zipkin URLConnectionSender using endpoint: {} ", endpoint); + spanReporter = AsyncReporter.create(URLConnectionSender.create(endpoint)); + } else if (hostName != null && port > 0) { LOG.info("Configuring Zipkin ScribeSpanCollector using host: {} and port: {}", hostName, port); - spanCollector = new ScribeSpanCollector(hostName, port); + spanReporter = new ZipkinLegacyReporterAdapter(new ScribeSpanCollector(hostName, port)); } else { - // is there a zipkin service setup as ENV variable to auto register a scribe span collector - String host = new ServiceHostPropertiesFunction().apply(ZIPKIN_COLLECTOR_THRIFT_SERVICE); - String port = new ServicePortPropertiesFunction().apply(ZIPKIN_COLLECTOR_THRIFT_SERVICE); + // is there a zipkin service setup as ENV variable to auto register a span reporter + String host = new ServiceHostPropertiesFunction().apply(ZIPKIN_COLLECTOR_HTTP_SERVICE); + String port = new ServicePortPropertiesFunction().apply(ZIPKIN_COLLECTOR_HTTP_SERVICE); if (ObjectHelper.isNotEmpty(host) && ObjectHelper.isNotEmpty(port)) { - LOG.info("Auto-configuring Zipkin ScribeSpanCollector using host: {} and port: {}", host, port); + LOG.info("Auto-configuring Zipkin URLConnectionSender using host: {} and port: {}", host, port); int num = camelContext.getTypeConverter().mandatoryConvertTo(Integer.class, port); - spanCollector = new ScribeSpanCollector(host, num); + String implicitEndpoint = "http://" + host + ":" + num + "/api/v2/spans"; + spanReporter = AsyncReporter.create(URLConnectionSender.create(implicitEndpoint)); + } else { + host = new ServiceHostPropertiesFunction().apply(ZIPKIN_COLLECTOR_THRIFT_SERVICE); + port = new ServicePortPropertiesFunction().apply(ZIPKIN_COLLECTOR_THRIFT_SERVICE); + if (ObjectHelper.isNotEmpty(host) && ObjectHelper.isNotEmpty(port)) { + LOG.info("Auto-configuring Zipkin ScribeSpanCollector using host: {} and port: {}", host, port); + int num = camelContext.getTypeConverter().mandatoryConvertTo(Integer.class, port); + spanReporter = new ZipkinLegacyReporterAdapter(new ScribeSpanCollector(host, num)); + } } } } - if (spanCollector == null) { - // Try to lookup the span collector from the registry if only one instance is present - Set<SpanCollector> collectors = camelContext.getRegistry().findByType(SpanCollector.class); - if (collectors.size() == 1) { - spanCollector = collectors.iterator().next(); + if (spanReporter == null) { + // Try to lookup the span reporter from the registry if only one instance is present + Set<Reporter> reporters = camelContext.getRegistry().findByType(Reporter.class); + if (reporters.size() == 1) { + spanReporter = reporters.iterator().next(); } } - ObjectHelper.notNull(spanCollector, "SpanCollector", this); + ObjectHelper.notNull(spanReporter, "Reporter<zipkin2.Span>", this); if (clientServiceMappings.isEmpty() && serverServiceMappings.isEmpty()) { LOG.warn("No service name(s) has been mapped in clientServiceMappings or serverServiceMappings. Camel will fallback and use endpoint uris as service names."); @@ -350,7 +406,7 @@ public class ZipkinTracer extends ServiceSupport implements RoutePolicyFactory, createBraveForService(pattern, serviceName); } - ServiceHelper.startServices(spanCollector, eventNotifier); + ServiceHelper.startServices(spanReporter, eventNotifier); } @Override @@ -360,9 +416,9 @@ public class ZipkinTracer extends ServiceSupport implements RoutePolicyFactory, ServiceHelper.stopService(eventNotifier); // stop and close collector - ServiceHelper.stopAndShutdownService(spanCollector); - if (spanCollector instanceof Closeable) { - IOHelper.close((Closeable) spanCollector); + ServiceHelper.stopAndShutdownService(spanReporter); + if (spanReporter instanceof Closeable) { + IOHelper.close((Closeable) spanReporter); } // clear braves braves.clear(); @@ -470,12 +526,12 @@ public class ZipkinTracer extends ServiceSupport implements RoutePolicyFactory, private void createBraveForService(String pattern, String serviceName) { Brave brave = braves.get(pattern); if (brave == null && !braves.containsKey(serviceName)) { - Brave.Builder builder = new Brave.Builder(serviceName); - builder = builder.traceSampler(Sampler.create(rate)); - if (spanCollector != null) { - builder = builder.spanCollector(spanCollector); + Tracing.Builder builder = Tracing.newBuilder().localServiceName(serviceName); + builder = builder.sampler(Sampler.create(rate)); + if (spanReporter != null) { + builder = builder.spanReporter(spanReporter); } - brave = builder.build(); + brave = TracerAdapter.newBrave(builder.build().tracer()); braves.put(serviceName, brave); } } @@ -486,13 +542,13 @@ public class ZipkinTracer extends ServiceSupport implements RoutePolicyFactory, brave = braves.get(serviceName); if (brave == null && useFallbackServiceNames) { - LOG.debug("Creating Brave assigned to serviceName: {}", serviceName + " as fallback"); - Brave.Builder builder = new Brave.Builder(serviceName); - builder = builder.traceSampler(Sampler.create(rate)); - if (spanCollector != null) { - builder = builder.spanCollector(spanCollector); + LOG.debug("Creating Tracing assigned to serviceName: {}", serviceName + " as fallback"); + Tracing.Builder builder = Tracing.newBuilder().localServiceName(serviceName); + builder = builder.sampler(Sampler.create(rate)); + if (spanReporter != null) { + builder = builder.spanReporter(spanReporter); } - brave = builder.build(); + brave = TracerAdapter.newBrave(builder.build().tracer()); braves.put(serviceName, brave); } } diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ManagedZipkinSimpleRouteTest.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ManagedZipkinSimpleRouteTest.java index 356889a..02e0e5c 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ManagedZipkinSimpleRouteTest.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ManagedZipkinSimpleRouteTest.java @@ -27,11 +27,16 @@ import org.apache.camel.builder.NotifyBuilder; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; +import zipkin2.reporter.Reporter; public class ManagedZipkinSimpleRouteTest extends CamelTestSupport { private ZipkinTracer zipkin; + protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter(Reporter.NOOP); + } + @Override protected boolean useJmx() { return true; @@ -47,7 +52,7 @@ public class ManagedZipkinSimpleRouteTest extends CamelTestSupport { zipkin = new ZipkinTracer(); zipkin.setServiceName("dude"); - zipkin.setSpanCollector(new ZipkinLoggingSpanCollector()); + setSpanReporter(zipkin); // attaching ourself to CamelContext zipkin.init(context); diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinABCRouteTest.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinABCRouteTest.java index d1c0ea9..c884668 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinABCRouteTest.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinABCRouteTest.java @@ -24,11 +24,16 @@ import org.apache.camel.builder.NotifyBuilder; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; +import zipkin2.reporter.Reporter; public class ZipkinABCRouteTest extends CamelTestSupport { private ZipkinTracer zipkin; + protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter(Reporter.NOOP); + } + @Override protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); @@ -41,7 +46,7 @@ public class ZipkinABCRouteTest extends CamelTestSupport { zipkin.addServerServiceMapping("seda:a", "a"); zipkin.addServerServiceMapping("seda:b", "b"); zipkin.addServerServiceMapping("seda:c", "c"); - zipkin.setSpanCollector(new ZipkinLoggingSpanCollector()); + setSpanReporter(zipkin); // attaching ourself to CamelContext zipkin.init(context); diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinClientRecipientListRouteTest.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinClientRecipientListRouteTest.java index fa1d915..7f6cf94 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinClientRecipientListRouteTest.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinClientRecipientListRouteTest.java @@ -24,11 +24,16 @@ import org.apache.camel.builder.NotifyBuilder; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; +import zipkin2.reporter.Reporter; public class ZipkinClientRecipientListRouteTest extends CamelTestSupport { private ZipkinTracer zipkin; + protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter(Reporter.NOOP); + } + @Override protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); @@ -41,7 +46,7 @@ public class ZipkinClientRecipientListRouteTest extends CamelTestSupport { zipkin.addServerServiceMapping("seda:a", "a"); zipkin.addServerServiceMapping("seda:b", "b"); zipkin.addServerServiceMapping("seda:c", "c"); - zipkin.setSpanCollector(new ZipkinLoggingSpanCollector()); + setSpanReporter(zipkin); // attaching ourself to CamelContext zipkin.init(context); diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinMulticastRouteTest.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinMulticastRouteTest.java index 22bd579..d1a036f 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinMulticastRouteTest.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinMulticastRouteTest.java @@ -24,11 +24,16 @@ import org.apache.camel.builder.NotifyBuilder; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; +import zipkin2.reporter.Reporter; public class ZipkinMulticastRouteTest extends CamelTestSupport { private ZipkinTracer zipkin; + protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter(Reporter.NOOP); + } + @Override protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); @@ -41,7 +46,7 @@ public class ZipkinMulticastRouteTest extends CamelTestSupport { zipkin.addServerServiceMapping("seda:a", "a"); zipkin.addServerServiceMapping("seda:b", "b"); zipkin.addServerServiceMapping("seda:c", "c"); - zipkin.setSpanCollector(new ZipkinLoggingSpanCollector()); + setSpanReporter(zipkin); // attaching ourself to CamelContext zipkin.init(context); diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinOneRouteFallbackScribe.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinOneRouteFallbackTest.java similarity index 78% copy from components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinOneRouteFallbackScribe.java copy to components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinOneRouteFallbackTest.java index ae5e5a7..abc7794 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinOneRouteFallbackScribe.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinOneRouteFallbackTest.java @@ -14,29 +14,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.zipkin.scribe; +package org.apache.camel.zipkin; -import com.github.kristofa.brave.scribe.ScribeSpanCollector; import org.apache.camel.CamelContext; import org.apache.camel.RoutesBuilder; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.test.junit4.CamelTestSupport; -import org.apache.camel.zipkin.ZipkinTracer; import org.junit.Test; +import zipkin2.reporter.Reporter; -/** - * Integration test requires running Zipkin/Scribe running - * - * The easiest way is to run using zipkin-docker: https://github.com/openzipkin/docker-zipkin - * - * Adjust the IP address to what IP docker-machines have assigned, you can use - * <tt>docker-machines ls</tt> - */ -public class ZipkinOneRouteFallbackScribe extends CamelTestSupport { +public class ZipkinOneRouteFallbackTest extends CamelTestSupport { - private String ip = "192.168.99.100"; private ZipkinTracer zipkin; + protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter(Reporter.NOOP); + } + @Override protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); @@ -46,7 +40,7 @@ public class ZipkinOneRouteFallbackScribe extends CamelTestSupport { // we do not want to trace any direct endpoints zipkin.addExcludePattern("direct:*"); zipkin.setIncludeMessageBody(true); - zipkin.setSpanCollector(new ScribeSpanCollector(ip, 9410)); + setSpanReporter(zipkin); // attaching ourself to CamelContext zipkin.init(context); diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinAutoConfigureScribe.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinOneRouteTest.java similarity index 80% copy from components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinAutoConfigureScribe.java copy to components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinOneRouteTest.java index 963329d..527bcf6 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinAutoConfigureScribe.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinOneRouteTest.java @@ -14,27 +14,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.zipkin.scribe; +package org.apache.camel.zipkin; import org.apache.camel.CamelContext; import org.apache.camel.RoutesBuilder; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.test.junit4.CamelTestSupport; -import org.apache.camel.zipkin.ZipkinTracer; import org.junit.Test; +import zipkin2.reporter.Reporter; -/** - * Integration test requires running Zipkin/Scribe running - * - * The easiest way is to run using zipkin-docker: https://github.com/openzipkin/docker-zipkin - * - * Adjust the IP address to what IP docker-machines have assigned, you can use - * <tt>docker-machines ls</tt> - */ -public class ZipkinAutoConfigureScribe extends CamelTestSupport { +public class ZipkinOneRouteTest extends CamelTestSupport { private ZipkinTracer zipkin; + protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter(Reporter.NOOP); + } + @Override protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); @@ -43,7 +39,7 @@ public class ZipkinAutoConfigureScribe extends CamelTestSupport { // we have one route as service zipkin.addClientServiceMapping("seda:cat", "cat"); zipkin.addServerServiceMapping("seda:cat", "cat"); - // should auto configure as we have not setup a spanCollector + setSpanReporter(zipkin); // attaching ourself to CamelContext zipkin.init(context); diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinRecipientListRouteTest.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinRecipientListRouteTest.java index a8b6083..d626326 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinRecipientListRouteTest.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinRecipientListRouteTest.java @@ -24,11 +24,16 @@ import org.apache.camel.builder.NotifyBuilder; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; +import zipkin2.reporter.Reporter; public class ZipkinRecipientListRouteTest extends CamelTestSupport { private ZipkinTracer zipkin; + protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter(Reporter.NOOP); + } + @Override protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); @@ -41,7 +46,7 @@ public class ZipkinRecipientListRouteTest extends CamelTestSupport { zipkin.addServerServiceMapping("seda:a", "a"); zipkin.addServerServiceMapping("seda:b", "b"); zipkin.addServerServiceMapping("seda:c", "c"); - zipkin.setSpanCollector(new ZipkinLoggingSpanCollector()); + setSpanReporter(zipkin); // attaching ourself to CamelContext zipkin.init(context); diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinRouteConcurrentTest.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinRouteConcurrentTest.java index f734a33..9491134 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinRouteConcurrentTest.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinRouteConcurrentTest.java @@ -24,11 +24,16 @@ import org.apache.camel.builder.NotifyBuilder; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; +import zipkin2.reporter.Reporter; public class ZipkinRouteConcurrentTest extends CamelTestSupport { private ZipkinTracer zipkin; + protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter(Reporter.NOOP); + } + @Override protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); @@ -36,7 +41,7 @@ public class ZipkinRouteConcurrentTest extends CamelTestSupport { zipkin = new ZipkinTracer(); zipkin.addClientServiceMapping("seda:foo", "foo"); zipkin.addServerServiceMapping("seda:bar", "bar"); - zipkin.setSpanCollector(new ZipkinLoggingSpanCollector()); + setSpanReporter(zipkin); // attaching ourself to CamelContext zipkin.init(context); diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSimpleFallbackRouteTest.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSimpleFallbackRouteTest.java index d1eb47c..306286b 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSimpleFallbackRouteTest.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSimpleFallbackRouteTest.java @@ -24,17 +24,22 @@ import org.apache.camel.builder.NotifyBuilder; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; +import zipkin2.reporter.Reporter; public class ZipkinSimpleFallbackRouteTest extends CamelTestSupport { private ZipkinTracer zipkin; + protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter(Reporter.NOOP); + } + @Override protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); zipkin = new ZipkinTracer(); - zipkin.setSpanCollector(new ZipkinLoggingSpanCollector()); + setSpanReporter(zipkin); // attaching ourself to CamelContext zipkin.init(context); diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSimpleLogStreamsRouteTest.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSimpleLogStreamsRouteTest.java index 4eab008..d2326aa 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSimpleLogStreamsRouteTest.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSimpleLogStreamsRouteTest.java @@ -24,11 +24,16 @@ import org.apache.camel.builder.NotifyBuilder; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; +import zipkin2.reporter.Reporter; public class ZipkinSimpleLogStreamsRouteTest extends CamelTestSupport { private ZipkinTracer zipkin; + protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter(Reporter.NOOP); + } + @Override protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); @@ -36,7 +41,7 @@ public class ZipkinSimpleLogStreamsRouteTest extends CamelTestSupport { zipkin = new ZipkinTracer(); zipkin.setServiceName("dude"); zipkin.setIncludeMessageBodyStreams(true); - zipkin.setSpanCollector(new ZipkinLoggingSpanCollector()); + setSpanReporter(zipkin); // attaching ourself to CamelContext zipkin.init(context); diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSimpleRouteTest.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSimpleRouteTest.java index 6875e27..ba536d5 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSimpleRouteTest.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSimpleRouteTest.java @@ -24,18 +24,23 @@ import org.apache.camel.builder.NotifyBuilder; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; +import zipkin2.reporter.Reporter; public class ZipkinSimpleRouteTest extends CamelTestSupport { private ZipkinTracer zipkin; + protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter(Reporter.NOOP); + } + @Override protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); zipkin = new ZipkinTracer(); zipkin.setServiceName("dude"); - zipkin.setSpanCollector(new ZipkinLoggingSpanCollector()); + setSpanReporter(zipkin); // attaching ourself to CamelContext zipkin.init(context); diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSpanCollectorInRegistryTest.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSpanReporterInRegistryTest.java similarity index 84% rename from components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSpanCollectorInRegistryTest.java rename to components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSpanReporterInRegistryTest.java index f696c41..7912053 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSpanCollectorInRegistryTest.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSpanReporterInRegistryTest.java @@ -20,8 +20,9 @@ import org.apache.camel.CamelContext; import org.apache.camel.impl.JndiRegistry; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; +import zipkin2.reporter.Reporter; -public class ZipkinSpanCollectorInRegistryTest extends CamelTestSupport { +public class ZipkinSpanReporterInRegistryTest extends CamelTestSupport { private ZipkinTracer zipkin; @@ -38,14 +39,14 @@ public class ZipkinSpanCollectorInRegistryTest extends CamelTestSupport { @Override protected JndiRegistry createRegistry() throws Exception { JndiRegistry registry = super.createRegistry(); - registry.bind("span", new ZipkinLoggingSpanCollector()); + registry.bind("span", Reporter.NOOP); return registry; } @Test public void testZipkinConfiguration() throws Exception { - assertNotNull(zipkin.getSpanCollector()); - assertTrue(zipkin.getSpanCollector() instanceof ZipkinLoggingSpanCollector); + assertNotNull(zipkin.getSpanReporter()); + assertTrue(zipkin.getSpanReporter() == Reporter.NOOP); } } diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinTimerRouteScribe.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinTimerRouteTest.java similarity index 80% copy from components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinTimerRouteScribe.java copy to components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinTimerRouteTest.java index f98249a..c867002 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinTimerRouteScribe.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinTimerRouteTest.java @@ -14,33 +14,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.zipkin.scribe; +package org.apache.camel.zipkin; import java.util.concurrent.TimeUnit; - -import com.github.kristofa.brave.scribe.ScribeSpanCollector; import org.apache.camel.CamelContext; import org.apache.camel.ExchangePattern; import org.apache.camel.RoutesBuilder; import org.apache.camel.builder.NotifyBuilder; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.test.junit4.CamelTestSupport; -import org.apache.camel.zipkin.ZipkinTracer; import org.junit.Test; +import zipkin2.reporter.Reporter; -/** - * Integration test requires running Zipkin/Scribe running - * - * The easiest way is to run using zipkin-docker: https://github.com/openzipkin/docker-zipkin - * - * Adjust the IP address to what IP docker-machines have assigned, you can use - * <tt>docker-machines ls</tt> - */ -public class ZipkinTimerRouteScribe extends CamelTestSupport { +public class ZipkinTimerRouteTest extends CamelTestSupport { - private String ip = "192.168.99.100"; private ZipkinTracer zipkin; + protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter(Reporter.NOOP); + } + @Override protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); @@ -49,7 +42,7 @@ public class ZipkinTimerRouteScribe extends CamelTestSupport { // we have one route as service zipkin.addClientServiceMapping("seda:timer", "timer"); zipkin.addServerServiceMapping("seda:timer", "timer"); - zipkin.setSpanCollector(new ScribeSpanCollector(ip, 9410)); + setSpanReporter(zipkin); // attaching ourself to CamelContext zipkin.init(context); diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinTwoRouteTest.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinTwoRouteTest.java index 9e6d1de..b51715d 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinTwoRouteTest.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinTwoRouteTest.java @@ -21,11 +21,16 @@ import org.apache.camel.RoutesBuilder; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; +import zipkin2.reporter.Reporter; public class ZipkinTwoRouteTest extends CamelTestSupport { private ZipkinTracer zipkin; + protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter(Reporter.NOOP); + } + @Override protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); @@ -38,7 +43,7 @@ public class ZipkinTwoRouteTest extends CamelTestSupport { zipkin.addServerServiceMapping("seda:dog", "dog"); // capture message body as well zipkin.setIncludeMessageBody(true); - zipkin.setSpanCollector(new ZipkinLoggingSpanCollector()); + setSpanReporter(zipkin); // attaching ourself to CamelContext zipkin.init(context); diff --git a/examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinABCRouteHttp.java similarity index 51% copy from examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java copy to components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinABCRouteHttp.java index 8ed8e19..017ed7f 100644 --- a/examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinABCRouteHttp.java @@ -14,30 +14,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package sample.camel; +package org.apache.camel.zipkin.http; -import javax.enterprise.event.Observes; - -import org.apache.camel.cdi.ContextName; -import org.apache.camel.management.event.CamelContextStartingEvent; +import org.apache.camel.zipkin.ZipkinABCRouteTest; import org.apache.camel.zipkin.ZipkinTracer; +import zipkin2.reporter.AsyncReporter; +import zipkin2.reporter.urlconnection.URLConnectionSender; -@ContextName("Server1") -public class ClientApplication { - - public void setupCamel(@Observes CamelContextStartingEvent event) { - // create zipkin - ZipkinTracer zipkin = new ZipkinTracer(); - zipkin.setHostName("localhost"); - zipkin.setPort(9410); - zipkin.addClientServiceMapping("http://localhost:9090/service1", "service1"); - // capture 100% of all the events - zipkin.setRate(1.0f); - // include message bodies in the traces (not recommended for production) - zipkin.setIncludeMessageBodyStreams(true); - - // register zipkin to CamelContext - zipkin.init(event.getContext()); +/** + * Integration test requires running Zipkin running + * + * <p>The easiest way to run is locally: + * <pre>{@code + * curl -sSL https://zipkin.io/quickstart.sh | bash -s + * java -jar zipkin.jar + * }</pre> + */ +public class ZipkinABCRouteHttp extends ZipkinABCRouteTest { + @Override protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter( + AsyncReporter.create(URLConnectionSender.create("http://locahost:9411/api/v2/spans")) + ); } - } diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinAutoConfigureScribe.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinAutoConfigureHttp.java similarity index 76% copy from components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinAutoConfigureScribe.java copy to components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinAutoConfigureHttp.java index 963329d..7be0adb 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinAutoConfigureScribe.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinAutoConfigureHttp.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.zipkin.scribe; +package org.apache.camel.zipkin.http; import org.apache.camel.CamelContext; import org.apache.camel.RoutesBuilder; @@ -24,14 +24,21 @@ import org.apache.camel.zipkin.ZipkinTracer; import org.junit.Test; /** - * Integration test requires running Zipkin/Scribe running + * Integration test requires running Zipkin running * - * The easiest way is to run using zipkin-docker: https://github.com/openzipkin/docker-zipkin + * <p>The easiest way to run is locally: + * <pre>{@code + * curl -sSL https://zipkin.io/quickstart.sh | bash -s + * java -jar zipkin.jar + * }</pre> * - * Adjust the IP address to what IP docker-machines have assigned, you can use - * <tt>docker-machines ls</tt> + * <p>This test has to be run with environment variables set. For example: + * <pre>{@code + * ZIPKIN_COLLECTOR_HTTP_SERVICE_HOST=localhost + * ZIPKIN_COLLECTOR_HTTP_SERVICE_PORT=9411 + * }</pre> */ -public class ZipkinAutoConfigureScribe extends CamelTestSupport { +public class ZipkinAutoConfigureHttp extends CamelTestSupport { private ZipkinTracer zipkin; @@ -43,7 +50,8 @@ public class ZipkinAutoConfigureScribe extends CamelTestSupport { // we have one route as service zipkin.addClientServiceMapping("seda:cat", "cat"); zipkin.addServerServiceMapping("seda:cat", "cat"); - // should auto configure as we have not setup a spanCollector + // should auto configure as we have not setup a span reporter + // NOTE: this won't work unless you have an auto-configuration file in src/test/resources // attaching ourself to CamelContext zipkin.init(context); diff --git a/examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinMulticastRouteHttp.java similarity index 51% copy from examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java copy to components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinMulticastRouteHttp.java index 8ed8e19..0a579a2 100644 --- a/examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinMulticastRouteHttp.java @@ -14,30 +14,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package sample.camel; +package org.apache.camel.zipkin.http; -import javax.enterprise.event.Observes; - -import org.apache.camel.cdi.ContextName; -import org.apache.camel.management.event.CamelContextStartingEvent; +import org.apache.camel.zipkin.ZipkinMulticastRouteTest; import org.apache.camel.zipkin.ZipkinTracer; +import zipkin2.reporter.AsyncReporter; +import zipkin2.reporter.urlconnection.URLConnectionSender; -@ContextName("Server1") -public class ClientApplication { - - public void setupCamel(@Observes CamelContextStartingEvent event) { - // create zipkin - ZipkinTracer zipkin = new ZipkinTracer(); - zipkin.setHostName("localhost"); - zipkin.setPort(9410); - zipkin.addClientServiceMapping("http://localhost:9090/service1", "service1"); - // capture 100% of all the events - zipkin.setRate(1.0f); - // include message bodies in the traces (not recommended for production) - zipkin.setIncludeMessageBodyStreams(true); - - // register zipkin to CamelContext - zipkin.init(event.getContext()); +/** + * Integration test requires running Zipkin running + * + * <p>The easiest way to run is locally: + * <pre>{@code + * curl -sSL https://zipkin.io/quickstart.sh | bash -s + * java -jar zipkin.jar + * }</pre> + */ +public class ZipkinMulticastRouteHttp extends ZipkinMulticastRouteTest { + @Override protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter( + AsyncReporter.create(URLConnectionSender.create("http://locahost:9411/api/v2/spans")) + ); } - } diff --git a/examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinOneRouteFallbackHttp.java similarity index 51% copy from examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java copy to components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinOneRouteFallbackHttp.java index 8ed8e19..63814b1 100644 --- a/examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinOneRouteFallbackHttp.java @@ -14,30 +14,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package sample.camel; +package org.apache.camel.zipkin.http; -import javax.enterprise.event.Observes; - -import org.apache.camel.cdi.ContextName; -import org.apache.camel.management.event.CamelContextStartingEvent; +import org.apache.camel.zipkin.ZipkinOneRouteFallbackTest; import org.apache.camel.zipkin.ZipkinTracer; +import zipkin2.reporter.AsyncReporter; +import zipkin2.reporter.urlconnection.URLConnectionSender; -@ContextName("Server1") -public class ClientApplication { - - public void setupCamel(@Observes CamelContextStartingEvent event) { - // create zipkin - ZipkinTracer zipkin = new ZipkinTracer(); - zipkin.setHostName("localhost"); - zipkin.setPort(9410); - zipkin.addClientServiceMapping("http://localhost:9090/service1", "service1"); - // capture 100% of all the events - zipkin.setRate(1.0f); - // include message bodies in the traces (not recommended for production) - zipkin.setIncludeMessageBodyStreams(true); - - // register zipkin to CamelContext - zipkin.init(event.getContext()); +/** + * Integration test requires running Zipkin running + * + * <p>The easiest way to run is locally: + * <pre>{@code + * curl -sSL https://zipkin.io/quickstart.sh | bash -s + * java -jar zipkin.jar + * }</pre> + */ +public class ZipkinOneRouteFallbackHttp extends ZipkinOneRouteFallbackTest { + @Override protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter( + AsyncReporter.create(URLConnectionSender.create("http://locahost:9411/api/v2/spans")) + ); } - } diff --git a/examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinOneRouteHttp.java similarity index 51% copy from examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java copy to components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinOneRouteHttp.java index 8ed8e19..ac29245 100644 --- a/examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinOneRouteHttp.java @@ -14,30 +14,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package sample.camel; +package org.apache.camel.zipkin.http; -import javax.enterprise.event.Observes; - -import org.apache.camel.cdi.ContextName; -import org.apache.camel.management.event.CamelContextStartingEvent; +import org.apache.camel.zipkin.ZipkinOneRouteTest; import org.apache.camel.zipkin.ZipkinTracer; +import zipkin2.reporter.AsyncReporter; +import zipkin2.reporter.urlconnection.URLConnectionSender; -@ContextName("Server1") -public class ClientApplication { - - public void setupCamel(@Observes CamelContextStartingEvent event) { - // create zipkin - ZipkinTracer zipkin = new ZipkinTracer(); - zipkin.setHostName("localhost"); - zipkin.setPort(9410); - zipkin.addClientServiceMapping("http://localhost:9090/service1", "service1"); - // capture 100% of all the events - zipkin.setRate(1.0f); - // include message bodies in the traces (not recommended for production) - zipkin.setIncludeMessageBodyStreams(true); - - // register zipkin to CamelContext - zipkin.init(event.getContext()); +/** + * Integration test requires running Zipkin running + * + * <p>The easiest way to run is locally: + * <pre>{@code + * curl -sSL https://zipkin.io/quickstart.sh | bash -s + * java -jar zipkin.jar + * }</pre> + */ +public class ZipkinOneRouteHttp extends ZipkinOneRouteTest { + @Override protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter( + AsyncReporter.create(URLConnectionSender.create("http://locahost:9411/api/v2/spans")) + ); } - } diff --git a/examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinSimpleRouteHttp.java similarity index 51% copy from examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java copy to components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinSimpleRouteHttp.java index 8ed8e19..a6c2a6a 100644 --- a/examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinSimpleRouteHttp.java @@ -14,30 +14,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package sample.camel; +package org.apache.camel.zipkin.http; -import javax.enterprise.event.Observes; - -import org.apache.camel.cdi.ContextName; -import org.apache.camel.management.event.CamelContextStartingEvent; +import org.apache.camel.zipkin.ZipkinSimpleRouteTest; import org.apache.camel.zipkin.ZipkinTracer; +import zipkin2.reporter.AsyncReporter; +import zipkin2.reporter.urlconnection.URLConnectionSender; -@ContextName("Server1") -public class ClientApplication { - - public void setupCamel(@Observes CamelContextStartingEvent event) { - // create zipkin - ZipkinTracer zipkin = new ZipkinTracer(); - zipkin.setHostName("localhost"); - zipkin.setPort(9410); - zipkin.addClientServiceMapping("http://localhost:9090/service1", "service1"); - // capture 100% of all the events - zipkin.setRate(1.0f); - // include message bodies in the traces (not recommended for production) - zipkin.setIncludeMessageBodyStreams(true); - - // register zipkin to CamelContext - zipkin.init(event.getContext()); +/** + * Integration test requires running Zipkin running + * + * <p>The easiest way to run is locally: + * <pre>{@code + * curl -sSL https://zipkin.io/quickstart.sh | bash -s + * java -jar zipkin.jar + * }</pre> + */ +public class ZipkinSimpleRouteHttp extends ZipkinSimpleRouteTest { + @Override protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter( + AsyncReporter.create(URLConnectionSender.create("http://locahost:9411/api/v2/spans")) + ); } - } diff --git a/examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinTimerRouteHttp.java similarity index 51% copy from examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java copy to components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinTimerRouteHttp.java index 8ed8e19..89251ce 100644 --- a/examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinTimerRouteHttp.java @@ -14,30 +14,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package sample.camel; +package org.apache.camel.zipkin.http; -import javax.enterprise.event.Observes; - -import org.apache.camel.cdi.ContextName; -import org.apache.camel.management.event.CamelContextStartingEvent; +import org.apache.camel.zipkin.ZipkinTimerRouteTest; import org.apache.camel.zipkin.ZipkinTracer; +import zipkin2.reporter.AsyncReporter; +import zipkin2.reporter.urlconnection.URLConnectionSender; -@ContextName("Server1") -public class ClientApplication { - - public void setupCamel(@Observes CamelContextStartingEvent event) { - // create zipkin - ZipkinTracer zipkin = new ZipkinTracer(); - zipkin.setHostName("localhost"); - zipkin.setPort(9410); - zipkin.addClientServiceMapping("http://localhost:9090/service1", "service1"); - // capture 100% of all the events - zipkin.setRate(1.0f); - // include message bodies in the traces (not recommended for production) - zipkin.setIncludeMessageBodyStreams(true); - - // register zipkin to CamelContext - zipkin.init(event.getContext()); +/** + * Integration test requires running Zipkin running + * + * <p>The easiest way to run is locally: + * <pre>{@code + * curl -sSL https://zipkin.io/quickstart.sh | bash -s + * java -jar zipkin.jar + * }</pre> + */ +public class ZipkinTimerRouteHttp extends ZipkinTimerRouteTest { + @Override protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter( + AsyncReporter.create(URLConnectionSender.create("http://locahost:9411/api/v2/spans")) + ); } - } diff --git a/examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinTwoRouteHttp.java similarity index 51% copy from examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java copy to components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinTwoRouteHttp.java index 8ed8e19..fbcba41 100644 --- a/examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/http/ZipkinTwoRouteHttp.java @@ -14,30 +14,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package sample.camel; +package org.apache.camel.zipkin.http; -import javax.enterprise.event.Observes; - -import org.apache.camel.cdi.ContextName; -import org.apache.camel.management.event.CamelContextStartingEvent; import org.apache.camel.zipkin.ZipkinTracer; +import org.apache.camel.zipkin.ZipkinTwoRouteTest; +import zipkin2.reporter.AsyncReporter; +import zipkin2.reporter.urlconnection.URLConnectionSender; -@ContextName("Server1") -public class ClientApplication { - - public void setupCamel(@Observes CamelContextStartingEvent event) { - // create zipkin - ZipkinTracer zipkin = new ZipkinTracer(); - zipkin.setHostName("localhost"); - zipkin.setPort(9410); - zipkin.addClientServiceMapping("http://localhost:9090/service1", "service1"); - // capture 100% of all the events - zipkin.setRate(1.0f); - // include message bodies in the traces (not recommended for production) - zipkin.setIncludeMessageBodyStreams(true); - - // register zipkin to CamelContext - zipkin.init(event.getContext()); +/** + * Integration test requires running Zipkin running + * + * <p>The easiest way to run is locally: + * <pre>{@code + * curl -sSL https://zipkin.io/quickstart.sh | bash -s + * java -jar zipkin.jar + * }</pre> + */ +public class ZipkinTwoRouteHttp extends ZipkinTwoRouteTest { + @Override protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanReporter( + AsyncReporter.create(URLConnectionSender.create("http://locahost:9411/api/v2/spans")) + ); } - } diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinABCRouteScribe.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinABCRouteScribe.java index 29a9e1c..913a58e 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinABCRouteScribe.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinABCRouteScribe.java @@ -16,81 +16,21 @@ */ package org.apache.camel.zipkin.scribe; -import java.util.concurrent.TimeUnit; - import com.github.kristofa.brave.scribe.ScribeSpanCollector; -import org.apache.camel.CamelContext; -import org.apache.camel.RoutesBuilder; -import org.apache.camel.builder.NotifyBuilder; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.test.junit4.CamelTestSupport; +import org.apache.camel.zipkin.ZipkinABCRouteTest; import org.apache.camel.zipkin.ZipkinTracer; -import org.junit.Test; /** * Integration test requires running Zipkin/Scribe running * - * The easiest way is to run using zipkin-docker: https://github.com/openzipkin/docker-zipkin - * - * Adjust the IP address to what IP docker-machines have assigned, you can use - * <tt>docker-machines ls</tt> + * <p>The easiest way to run is locally: + * <pre>{@code + * curl -sSL https://zipkin.io/quickstart.sh | bash -s + * SCRIBE_ENABLED=true java -jar zipkin.jar + * }</pre> */ -public class ZipkinABCRouteScribe extends CamelTestSupport { - - private String ip = "192.168.99.100"; - private ZipkinTracer zipkin; - - @Override - protected CamelContext createCamelContext() throws Exception { - CamelContext context = super.createCamelContext(); - - zipkin = new ZipkinTracer(); - - zipkin.addClientServiceMapping("seda:a", "a"); - zipkin.addClientServiceMapping("seda:b", "b"); - zipkin.addClientServiceMapping("seda:c", "c"); - zipkin.addServerServiceMapping("seda:a", "a"); - zipkin.addServerServiceMapping("seda:b", "b"); - zipkin.addServerServiceMapping("seda:c", "c"); - zipkin.setSpanCollector(new ScribeSpanCollector(ip, 9410)); - - // attaching ourself to CamelContext - zipkin.init(context); - - return context; - } - - @Test - public void testZipkinRoute() throws Exception { - NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create(); - - template.requestBody("direct:start", "Hello World"); - - assertTrue(notify.matches(30, TimeUnit.SECONDS)); - } - - @Override - protected RoutesBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("direct:start").to("seda:a").routeId("start"); - - from("seda:a").routeId("a") - .log("routing at ${routeId}") - .to("seda:b") - .delay(2000) - .to("seda:c") - .log("End of routing"); - - from("seda:b").routeId("b") - .log("routing at ${routeId}") - .delay(simple("${random(1000,2000)}")); - - from("seda:c").routeId("c") - .log("routing at ${routeId}") - .delay(simple("${random(0,100)}")); - } - }; +public class ZipkinABCRouteScribe extends ZipkinABCRouteTest { + @Override protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanCollector(new ScribeSpanCollector("127.0.0.1", 9410)); } } diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinAutoConfigureScribe.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinAutoConfigureScribe.java index 963329d..a7ce5ea 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinAutoConfigureScribe.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinAutoConfigureScribe.java @@ -26,10 +26,17 @@ import org.junit.Test; /** * Integration test requires running Zipkin/Scribe running * - * The easiest way is to run using zipkin-docker: https://github.com/openzipkin/docker-zipkin + * <p>The easiest way to run is locally: + * <pre>{@code + * curl -sSL https://zipkin.io/quickstart.sh | bash -s + * SCRIBE_ENABLED=true java -jar zipkin.jar + * }</pre> * - * Adjust the IP address to what IP docker-machines have assigned, you can use - * <tt>docker-machines ls</tt> + * <p>This test has to be run with environment variables set. For example: + * <pre>{@code + * ZIPKIN_COLLECTOR_THRIFT_SERVICE_HOST=localhost + * ZIPKIN_COLLECTOR_THRIFT_SERVICE_PORT=9410 + * }</pre> */ public class ZipkinAutoConfigureScribe extends CamelTestSupport { @@ -43,7 +50,7 @@ public class ZipkinAutoConfigureScribe extends CamelTestSupport { // we have one route as service zipkin.addClientServiceMapping("seda:cat", "cat"); zipkin.addServerServiceMapping("seda:cat", "cat"); - // should auto configure as we have not setup a spanCollector + // should auto configure as we have not setup a span reporter // attaching ourself to CamelContext zipkin.init(context); diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinMulticastRouteScribe.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinMulticastRouteScribe.java index d07b2c5..14e200e 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinMulticastRouteScribe.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinMulticastRouteScribe.java @@ -16,82 +16,21 @@ */ package org.apache.camel.zipkin.scribe; -import java.util.concurrent.TimeUnit; - import com.github.kristofa.brave.scribe.ScribeSpanCollector; -import org.apache.camel.CamelContext; -import org.apache.camel.RoutesBuilder; -import org.apache.camel.builder.NotifyBuilder; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.test.junit4.CamelTestSupport; +import org.apache.camel.zipkin.ZipkinMulticastRouteTest; import org.apache.camel.zipkin.ZipkinTracer; -import org.junit.Test; /** * Integration test requires running Zipkin/Scribe running * - * The easiest way is to run using zipkin-docker: https://github.com/openzipkin/docker-zipkin - * - * Adjust the IP address to what IP docker-machines have assigned, you can use - * <tt>docker-machines ls</tt> + * <p>The easiest way to run is locally: + * <pre>{@code + * curl -sSL https://zipkin.io/quickstart.sh | bash -s + * SCRIBE_ENABLED=true java -jar zipkin.jar + * }</pre> */ -public class ZipkinMulticastRouteScribe extends CamelTestSupport { - - private String ip = "192.168.99.100"; - private ZipkinTracer zipkin; - - @Override - protected CamelContext createCamelContext() throws Exception { - CamelContext context = super.createCamelContext(); - - zipkin = new ZipkinTracer(); - - zipkin.addClientServiceMapping("seda:a", "a"); - zipkin.addClientServiceMapping("seda:b", "b"); - zipkin.addClientServiceMapping("seda:c", "c"); - zipkin.addServerServiceMapping("seda:a", "a"); - zipkin.addServerServiceMapping("seda:b", "b"); - zipkin.addServerServiceMapping("seda:c", "c"); - zipkin.setSpanCollector(new ScribeSpanCollector(ip, 9410)); - - // attaching ourself to CamelContext - zipkin.init(context); - - return context; - } - - @Test - public void testZipkinRoute() throws Exception { - NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create(); - - template.requestBody("direct:start", "Hello World"); - - assertTrue(notify.matches(30, TimeUnit.SECONDS)); - } - - @Override - protected RoutesBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("direct:start").to("seda:a").routeId("start"); - - from("seda:a").routeId("a") - .log("routing at ${routeId}") - .multicast() - .to("seda:b") - .to("seda:c") - .end() - .log("End of routing"); - - from("seda:b").routeId("b") - .log("routing at ${routeId}") - .delay(simple("${random(1000,2000)}")); - - from("seda:c").routeId("c") - .log("routing at ${routeId}") - .delay(simple("${random(0,100)}")); - } - }; +public class ZipkinMulticastRouteScribe extends ZipkinMulticastRouteTest { + @Override protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanCollector(new ScribeSpanCollector("127.0.0.1", 9410)); } } diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinOneRouteFallbackScribe.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinOneRouteFallbackScribe.java index ae5e5a7..d389e26 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinOneRouteFallbackScribe.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinOneRouteFallbackScribe.java @@ -17,60 +17,20 @@ package org.apache.camel.zipkin.scribe; import com.github.kristofa.brave.scribe.ScribeSpanCollector; -import org.apache.camel.CamelContext; -import org.apache.camel.RoutesBuilder; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.test.junit4.CamelTestSupport; +import org.apache.camel.zipkin.ZipkinOneRouteFallbackTest; import org.apache.camel.zipkin.ZipkinTracer; -import org.junit.Test; /** * Integration test requires running Zipkin/Scribe running * - * The easiest way is to run using zipkin-docker: https://github.com/openzipkin/docker-zipkin - * - * Adjust the IP address to what IP docker-machines have assigned, you can use - * <tt>docker-machines ls</tt> + * <p>The easiest way to run is locally: + * <pre>{@code + * curl -sSL https://zipkin.io/quickstart.sh | bash -s + * SCRIBE_ENABLED=true java -jar zipkin.jar + * }</pre> */ -public class ZipkinOneRouteFallbackScribe extends CamelTestSupport { - - private String ip = "192.168.99.100"; - private ZipkinTracer zipkin; - - @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; - } - - @Test - public void testZipkinRoute() throws Exception { - template.requestBody("direct:start", "Hello Goofy"); - template.requestBody("direct:start", "Hello again Goofy"); - } - - @Override - protected RoutesBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("direct:start").to("seda:goofy"); - - from("seda:goofy").routeId("goofy") - .log("routing at ${routeId}") - .delay(simple("${random(1000,2000)}")); - } - }; +public class ZipkinOneRouteFallbackScribe extends ZipkinOneRouteFallbackTest { + @Override protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanCollector(new ScribeSpanCollector("127.0.0.1", 9410)); } } diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinOneRouteScribe.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinOneRouteScribe.java index c2ab130..2ef1001 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinOneRouteScribe.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinOneRouteScribe.java @@ -17,58 +17,20 @@ package org.apache.camel.zipkin.scribe; import com.github.kristofa.brave.scribe.ScribeSpanCollector; -import org.apache.camel.CamelContext; -import org.apache.camel.RoutesBuilder; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.test.junit4.CamelTestSupport; +import org.apache.camel.zipkin.ZipkinOneRouteTest; import org.apache.camel.zipkin.ZipkinTracer; -import org.junit.Test; /** * Integration test requires running Zipkin/Scribe running * - * The easiest way is to run using zipkin-docker: https://github.com/openzipkin/docker-zipkin - * - * Adjust the IP address to what IP docker-machines have assigned, you can use - * <tt>docker-machines ls</tt> + * <p>The easiest way to run is locally: + * <pre>{@code + * curl -sSL https://zipkin.io/quickstart.sh | bash -s + * SCRIBE_ENABLED=true java -jar zipkin.jar + * }</pre> */ -public class ZipkinOneRouteScribe extends CamelTestSupport { - - private String ip = "192.168.99.100"; - private ZipkinTracer zipkin; - - @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; - } - - @Test - public void testZipkinRoute() throws Exception { - template.requestBody("direct:start", "Hello Cat"); - } - - @Override - protected RoutesBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("direct:start").to("seda:cat"); - - from("seda:cat").routeId("cat") - .log("routing at ${routeId}") - .delay(simple("${random(1000,2000)}")); - } - }; +public class ZipkinOneRouteScribe extends ZipkinOneRouteTest { + @Override protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanCollector(new ScribeSpanCollector("127.0.0.1", 9410)); } } diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinSimpleRouteScribe.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinSimpleRouteScribe.java index 347cd3e..2d5e557 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinSimpleRouteScribe.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinSimpleRouteScribe.java @@ -17,60 +17,20 @@ package org.apache.camel.zipkin.scribe; import com.github.kristofa.brave.scribe.ScribeSpanCollector; -import org.apache.camel.CamelContext; -import org.apache.camel.RoutesBuilder; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.test.junit4.CamelTestSupport; +import org.apache.camel.zipkin.ZipkinSimpleRouteTest; import org.apache.camel.zipkin.ZipkinTracer; -import org.junit.Test; /** * Integration test requires running Zipkin/Scribe running * - * The easiest way is to run using zipkin-docker: https://github.com/openzipkin/docker-zipkin - * - * Adjust the IP address to what IP docker-machines have assigned, you can use - * <tt>docker-machines ls</tt> + * <p>The easiest way to run is locally: + * <pre>{@code + * curl -sSL https://zipkin.io/quickstart.sh | bash -s + * SCRIBE_ENABLED=true java -jar zipkin.jar + * }</pre> */ -public class ZipkinSimpleRouteScribe extends CamelTestSupport { - - private String ip = "192.168.99.100"; - private ZipkinTracer zipkin; - - @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; - } - - @Test - public void testZipkinRoute() throws Exception { - for (int i = 0; i < 5; i++) { - template.requestBody("direct:start", "Hello World"); - } - } - - @Override - protected RoutesBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("direct:start").to("seda:dude"); - - from("seda:dude").routeId("dude") - .log("routing at ${routeId}") - .delay(simple("${random(1000,2000)}")); - } - }; +public class ZipkinSimpleRouteScribe extends ZipkinSimpleRouteTest { + @Override protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanCollector(new ScribeSpanCollector("127.0.0.1", 9410)); } } diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinTimerRouteScribe.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinTimerRouteScribe.java index f98249a..816735e 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinTimerRouteScribe.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinTimerRouteScribe.java @@ -16,67 +16,21 @@ */ package org.apache.camel.zipkin.scribe; -import java.util.concurrent.TimeUnit; - import com.github.kristofa.brave.scribe.ScribeSpanCollector; -import org.apache.camel.CamelContext; -import org.apache.camel.ExchangePattern; -import org.apache.camel.RoutesBuilder; -import org.apache.camel.builder.NotifyBuilder; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.test.junit4.CamelTestSupport; +import org.apache.camel.zipkin.ZipkinTimerRouteTest; import org.apache.camel.zipkin.ZipkinTracer; -import org.junit.Test; /** * Integration test requires running Zipkin/Scribe running * - * The easiest way is to run using zipkin-docker: https://github.com/openzipkin/docker-zipkin - * - * Adjust the IP address to what IP docker-machines have assigned, you can use - * <tt>docker-machines ls</tt> + * <p>The easiest way to run is locally: + * <pre>{@code + * curl -sSL https://zipkin.io/quickstart.sh | bash -s + * SCRIBE_ENABLED=true java -jar zipkin.jar + * }</pre> */ -public class ZipkinTimerRouteScribe extends CamelTestSupport { - - private String ip = "192.168.99.100"; - private ZipkinTracer zipkin; - - @Override - protected CamelContext createCamelContext() throws Exception { - CamelContext context = super.createCamelContext(); - - zipkin = new ZipkinTracer(); - // we have one route as service - zipkin.addClientServiceMapping("seda:timer", "timer"); - zipkin.addServerServiceMapping("seda:timer", "timer"); - zipkin.setSpanCollector(new ScribeSpanCollector(ip, 9410)); - - // attaching ourself to CamelContext - zipkin.init(context); - - return context; - } - - @Test - public void testZipkinRoute() throws Exception { - NotifyBuilder notify = new NotifyBuilder(context).from("seda:timer").whenDone(1).create(); - - template.sendBody("direct:start", "Hello Timer"); - - assertTrue(notify.matches(30, TimeUnit.SECONDS)); - } - - @Override - protected RoutesBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("direct:start").to(ExchangePattern.InOut, "seda:timer"); - - from("seda:timer").routeId("timer") - .log("routing at ${routeId}") - .delay(simple("${random(1000,2000)}")); - } - }; +public class ZipkinTimerRouteScribe extends ZipkinTimerRouteTest { + @Override protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanCollector(new ScribeSpanCollector("127.0.0.1", 9410)); } } diff --git a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinTwoRouteScribe.java b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinTwoRouteScribe.java index 5a9c701..72fd92d 100644 --- a/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinTwoRouteScribe.java +++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/scribe/ZipkinTwoRouteScribe.java @@ -17,69 +17,20 @@ package org.apache.camel.zipkin.scribe; import com.github.kristofa.brave.scribe.ScribeSpanCollector; -import org.apache.camel.CamelContext; -import org.apache.camel.RoutesBuilder; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.test.junit4.CamelTestSupport; +import org.apache.camel.zipkin.ZipkinTwoRouteTest; import org.apache.camel.zipkin.ZipkinTracer; -import org.junit.Test; /** * Integration test requires running Zipkin/Scribe running * - * The easiest way is to run using zipkin-docker: https://github.com/openzipkin/docker-zipkin - * - * Adjust the IP address to what IP docker-machines have assigned, you can use - * <tt>docker-machines ls</tt> + * <p>The easiest way to run is locally: + * <pre>{@code + * curl -sSL https://zipkin.io/quickstart.sh | bash -s + * SCRIBE_ENABLED=true java -jar zipkin.jar + * }</pre> */ -public class ZipkinTwoRouteScribe extends CamelTestSupport { - - private String ip = "192.168.99.100"; - private ZipkinTracer zipkin; - - @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; - } - - @Test - public void testZipkinRoute() throws Exception { - template.requestBody("direct:start", "Camel say hello Cat"); - } - - @Override - protected RoutesBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("direct:start").to("seda:cat"); - - from("seda:cat").routeId("cat") - .log("routing at ${routeId}") - .delay(simple("${random(1000,2000)}")) - .setBody().constant("Cat says hello Dog") - .to("seda:dog"); - - from("seda:dog").routeId("dog") - .log("routing at ${routeId}") - .delay(simple("${random(0,500)}")) - .setBody().constant("Dog say hello Cat and Camel"); - } - }; +public class ZipkinTwoRouteScribe extends ZipkinTwoRouteTest { + @Override protected void setSpanReporter(ZipkinTracer zipkin) { + zipkin.setSpanCollector(new ScribeSpanCollector("127.0.0.1", 9410)); } } diff --git a/examples/camel-example-zipkin/README.md b/examples/camel-example-zipkin/README.md index c71b1b7..53c5e1f 100644 --- a/examples/camel-example-zipkin/README.md +++ b/examples/camel-example-zipkin/README.md @@ -24,7 +24,7 @@ Client is configured in the `src/main/java/sample/camel/ClientApplication.java` ### Build -First, start Zipkin as described below in the [Zipkin web console]("Zipkin web console") section +First, start Zipkin as described below in the [Installing Zipkin Server]("Installing Zipkin Server") section Then compile this example: @@ -55,18 +55,18 @@ $ cd client $ mvn compile camel:run ``` -### Zipkin web console +### Zipkin UI -You should be able to visualize the traces and timings from this example using the Zipkin Web Console. +You should be able to visualize the traces and timings from this example using the Zipkin UI. The services are named `service1` and `service2`. In the screen shot below we are showing a trace of a client calling service1 and service2. - + You can then click on each span and get annotated data from the Camel exchange and about the requests as shown: - + ### Installing Zipkin Server @@ -74,13 +74,13 @@ You can then click on each span and get annotated data from the Camel exchange a The quickest way to get Zipkin started is to fetch the [latest released server](https://search.maven.org/remote_content?g=io.zipkin.java&a=zipkin-server&v=LATEST&c=exec) as a self-contained executable jar. ```bash -wget -O zipkin.jar 'https://search.maven.org/remote_content?g=io.zipkin.java&a=zipkin-server&v=LATEST&c=exec' +curl -sSL https://zipkin.io/quickstart.sh | bash -s ``` .. and then run it ```bash -java -DSCRIBE_ENABLED=true -jar zipkin.jar +java -jar zipkin.jar ``` Finally, browse to http://localhost:9411 to find traces! diff --git a/examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java b/examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java index 8ed8e19..6376157 100644 --- a/examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java +++ b/examples/camel-example-zipkin/client/src/main/java/sample/camel/ClientApplication.java @@ -28,8 +28,7 @@ public class ClientApplication { public void setupCamel(@Observes CamelContextStartingEvent event) { // create zipkin ZipkinTracer zipkin = new ZipkinTracer(); - zipkin.setHostName("localhost"); - zipkin.setPort(9410); + zipkin.setEndpoint("http://localhost:9411/api/v2/spans"); zipkin.addClientServiceMapping("http://localhost:9090/service1", "service1"); // capture 100% of all the events zipkin.setRate(1.0f); diff --git a/examples/camel-example-zipkin/service1/src/main/resources/application.properties b/examples/camel-example-zipkin/service1/src/main/resources/application.properties index d6411fe..e3f6ebe 100644 --- a/examples/camel-example-zipkin/service1/src/main/resources/application.properties +++ b/examples/camel-example-zipkin/service1/src/main/resources/application.properties @@ -20,8 +20,7 @@ camel.springboot.name=Service1 camel.springboot.main-run-controller=true # configure zipkin -camel.zipkin.host-name=localhost -camel.zipkin.port=9410 +camel.zipkin.endpoint=http://localhost:9411/api/v2/spans # the zipkin service name camel.zipkin.server-service-mappings.*=service1 diff --git a/examples/camel-example-zipkin/service2/src/main/java/sample/camel/Service2Route.java b/examples/camel-example-zipkin/service2/src/main/java/sample/camel/Service2Route.java index 70fe2e0..bc33c4d 100644 --- a/examples/camel-example-zipkin/service2/src/main/java/sample/camel/Service2Route.java +++ b/examples/camel-example-zipkin/service2/src/main/java/sample/camel/Service2Route.java @@ -25,8 +25,7 @@ public class Service2Route extends RouteBuilder { public void configure() throws Exception { // create zipkin ZipkinTracer zipkin = new ZipkinTracer(); - zipkin.setHostName("localhost"); - zipkin.setPort(9410); + zipkin.setEndpoint("http://localhost:9411/api/v2/spans"); // set the service name zipkin.setServiceName("service2"); // capture 100% of all the events diff --git a/parent/pom.xml b/parent/pom.xml index 684427a..f69842e 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -98,7 +98,7 @@ <boxjavalibv2.version>3.2.1</boxjavalibv2.version> <box-java-sdk-version>2.8.2</box-java-sdk-version> <braintree-gateway-version>2.63.0</braintree-gateway-version> - <brave-zipkin-version>4.5.2</brave-zipkin-version> + <brave-zipkin-version>4.12.0</brave-zipkin-version> <build-helper-maven-plugin-version>1.10</build-helper-maven-plugin-version> <c3p0-version>0.9.5.2</c3p0-version> <c3p0-bundle-version>0.9.5.2_1</c3p0-bundle-version> @@ -743,8 +743,8 @@ <yammer-metrics-version>2.2.0</yammer-metrics-version> <zendesk-client-version>0.5.4</zendesk-client-version> <zipkin-libthrift-version>0.9.3</zipkin-libthrift-version> - <zipkin-reporter-version>1.0.1</zipkin-reporter-version> - <zipkin-version>1.29.1</zipkin-version> + <zipkin-reporter-version>2.2.1</zipkin-reporter-version> + <zipkin-version>2.4.1</zipkin-version> <zjsonpatch-version>0.3.0</zjsonpatch-version> <zookeeper-version>3.4.10</zookeeper-version> <zookeeper-guava-version>16.0</zookeeper-guava-version> diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml index c12af7d..adb776a 100644 --- a/platforms/karaf/features/src/main/resources/features.xml +++ b/platforms/karaf/features/src/main/resources/features.xml @@ -2414,10 +2414,12 @@ </feature> <feature name='camel-zipkin' version='${project.version}' resolver='(obr)' start-level='50'> <feature version='${project.version}'>camel-core</feature> + <bundle dependency='true'>mvn:io.zipkin.brave/brave/${brave-zipkin-version}</bundle> <bundle dependency='true'>mvn:io.zipkin.brave/brave-core/${brave-zipkin-version}</bundle> <bundle dependency='true'>mvn:io.zipkin.brave/brave-spancollector-scribe/${brave-zipkin-version}</bundle> <bundle dependency='true'>mvn:io.zipkin.java/zipkin/${zipkin-version}</bundle> - <bundle dependency='true'>mvn:io.zipkin.reporter/zipkin-reporter/${zipkin-reporter-version}</bundle> + <bundle dependency='true'>mvn:io.zipkin.reporter2/zipkin-reporter/${zipkin-reporter-version}</bundle> + <bundle dependency='true'>mvn:io.zipkin.reporter2/zipkin-sender-urlconnection/${zipkin-reporter-version}</bundle> <bundle dependency='true'>mvn:org.apache.thrift/libthrift/${zipkin-libthrift-version}</bundle> <bundle>mvn:org.apache.camel/camel-zipkin/${project.version}</bundle> </feature> diff --git a/platforms/spring-boot/components-starter/camel-zipkin-starter/src/main/java/org/apache/camel/zipkin/starter/ZipkinAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-zipkin-starter/src/main/java/org/apache/camel/zipkin/starter/ZipkinAutoConfiguration.java index e0e8ed7..333b373 100644 --- a/platforms/spring-boot/components-starter/camel-zipkin-starter/src/main/java/org/apache/camel/zipkin/starter/ZipkinAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-zipkin-starter/src/main/java/org/apache/camel/zipkin/starter/ZipkinAutoConfiguration.java @@ -37,6 +37,7 @@ public class ZipkinAutoConfiguration { ZipkinConfigurationProperties config) { ZipkinTracer zipkin = new ZipkinTracer(); + zipkin.setEndpoint(config.getEndpoint()); zipkin.setHostName(config.getHostName()); zipkin.setPort(config.getPort()); zipkin.setRate(config.getRate()); diff --git a/platforms/spring-boot/components-starter/camel-zipkin-starter/src/main/java/org/apache/camel/zipkin/starter/ZipkinConfigurationProperties.java b/platforms/spring-boot/components-starter/camel-zipkin-starter/src/main/java/org/apache/camel/zipkin/starter/ZipkinConfigurationProperties.java index 5a45f57..bc7defc 100644 --- a/platforms/spring-boot/components-starter/camel-zipkin-starter/src/main/java/org/apache/camel/zipkin/starter/ZipkinConfigurationProperties.java +++ b/platforms/spring-boot/components-starter/camel-zipkin-starter/src/main/java/org/apache/camel/zipkin/starter/ZipkinConfigurationProperties.java @@ -23,14 +23,19 @@ import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "camel.zipkin") public class ZipkinConfigurationProperties { + /** + * Sets the POST URL for zipkin's <a href="http://zipkin.io/zipkin-api/#/">v2 api</a>, usually + * "http://zipkinhost:9411/api/v2/spans" + */ + private String endpoint; /** - * Sets a hostname for the remote zipkin server to use. + * Sets the hostname if sending spans to a remote zipkin scribe (thrift RPC) collector. */ private String hostName; /** - * Sets the port number for the remote zipkin server to use. + * Sets the port if sending spans to a remote zipkin scribe (thrift RPC) collector. */ private int port; @@ -80,6 +85,14 @@ public class ZipkinConfigurationProperties { // Getters & setters + public String getEndpoint() { + return endpoint; + } + + public void setEndpoint(String endpoint) { + this.endpoint = endpoint; + } + public String getHostName() { return hostName; } -- To stop receiving notification emails like this one, please contact "commits@camel.apache.org" <commits@camel.apache.org>.