[1/3] camel git commit: CAMEL-10920: lookup zipkin span collector from registry

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[1/3] camel git commit: CAMEL-10920: lookup zipkin span collector from registry

nferraro
Repository: camel
Updated Branches:
  refs/heads/master 45710b3fd -> e74975e8f


CAMEL-10920: lookup zipkin span collector from registry


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e74975e8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e74975e8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e74975e8

Branch: refs/heads/master
Commit: e74975e8fd0197d85e48999c1e1be191f5c42da1
Parents: f6b495b
Author: Nicola Ferraro <[hidden email]>
Authored: Wed Mar 15 13:56:07 2017 +0100
Committer: Nicola Ferraro <[hidden email]>
Committed: Wed Mar 15 13:56:43 2017 +0100

----------------------------------------------------------------------
 .../org/apache/camel/zipkin/ZipkinTracer.java   |  8 +++
 .../ZipkinSpanCollectorInRegistryTest.java      | 51 ++++++++++++++++++++
 2 files changed, 59 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e74975e8/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinTracer.java
----------------------------------------------------------------------
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 fc6fb7e..9e5878f 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
@@ -323,6 +323,14 @@ public class ZipkinTracer extends ServiceSupport implements RoutePolicyFactory,
             }
         }
 
+        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();
+            }
+        }
+
         ObjectHelper.notNull(spanCollector, "SpanCollector", this);
 
         if (clientServiceMappings.isEmpty() && serverServiceMappings.isEmpty()) {

http://git-wip-us.apache.org/repos/asf/camel/blob/e74975e8/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSpanCollectorInRegistryTest.java
----------------------------------------------------------------------
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/ZipkinSpanCollectorInRegistryTest.java
new file mode 100644
index 0000000..f696c41
--- /dev/null
+++ b/components/camel-zipkin/src/test/java/org/apache/camel/zipkin/ZipkinSpanCollectorInRegistryTest.java
@@ -0,0 +1,51 @@
+/**
+ * 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 org.apache.camel.CamelContext;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class ZipkinSpanCollectorInRegistryTest extends CamelTestSupport {
+
+    private ZipkinTracer zipkin;
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext context = super.createCamelContext();
+
+        zipkin = new ZipkinTracer();
+        zipkin.init(context);
+
+        return context;
+    }
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry registry = super.createRegistry();
+        registry.bind("span", new ZipkinLoggingSpanCollector());
+        return registry;
+    }
+
+    @Test
+    public void testZipkinConfiguration() throws Exception {
+        assertNotNull(zipkin.getSpanCollector());
+        assertTrue(zipkin.getSpanCollector() instanceof ZipkinLoggingSpanCollector);
+    }
+
+}

Reply | Threaded
Open this post in threaded view
|

[2/3] camel git commit: Updated descriptions and starters

nferraro
Updated descriptions and starters


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f6b495b9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f6b495b9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f6b495b9

Branch: refs/heads/master
Commit: f6b495b9c9c6ba1a798ead288e39233c6cec84b3
Parents: 3783ab1
Author: Nicola Ferraro <[hidden email]>
Authored: Wed Mar 15 13:39:26 2017 +0100
Committer: Nicola Ferraro <[hidden email]>
Committed: Wed Mar 15 13:56:43 2017 +0100

----------------------------------------------------------------------
 .../src/main/docs/atmosphere-websocket-component.adoc              | 2 +-
 components/camel-jetty9/src/main/docs/jetty-component.adoc         | 2 +-
 components/camel-servlet/src/main/docs/servlet-component.adoc      | 2 +-
 .../websocket/springboot/WebsocketComponentConfiguration.java      | 2 +-
 .../jetty9/springboot/JettyHttpComponentConfiguration9.java        | 2 +-
 .../servlet/springboot/ServletComponentConfiguration.java          | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f6b495b9/components/camel-atmosphere-websocket/src/main/docs/atmosphere-websocket-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-atmosphere-websocket/src/main/docs/atmosphere-websocket-component.adoc b/components/camel-atmosphere-websocket/src/main/docs/atmosphere-websocket-component.adoc
index bbff37f..4418a14 100644
--- a/components/camel-atmosphere-websocket/src/main/docs/atmosphere-websocket-component.adoc
+++ b/components/camel-atmosphere-websocket/src/main/docs/atmosphere-websocket-component.adoc
@@ -46,7 +46,7 @@ The Atmosphere Websocket component supports 8 options which are listed below.
 | attachmentMultipartBinding | common | false | boolean | Whether to automatic bind multipart/form-data as attachments on the Camel Exchange. The options attachmentMultipartBinding=true and disableStreamCache=false cannot work together. Remove disableStreamCache to use AttachmentMultipartBinding. This is turn off by default as this may require servlet specific configuration to enable this when using Servlet's.
 | httpBinding | advanced |  | HttpBinding | To use a custom HttpBinding to control the mapping between Camel message and HttpClient.
 | httpConfiguration | advanced |  | HttpConfiguration | To use the shared HttpConfiguration as base configuration.
-| allowJavaSerializedObject | advanced | false | boolean | Whether to allow java serialization when a request uses context-type=application/x-java-serialized-object This is by default turned off. If you enable this then be aware that Java will deserialize the incoming data from the request to Java and that can be a potential security risk.
+| allowJavaSerializedObject | advanced | false | boolean | Whether to allow java serialization when a request uses context-type=application/x-java-serialized-object. This is by default turned off. If you enable this then be aware that Java will deserialize the incoming data from the request to Java and that can be a potential security risk.
 | headerFilterStrategy | filter |  | HeaderFilterStrategy | To use a custom org.apache.camel.spi.HeaderFilterStrategy to filter header to and from Camel message.
 | resolvePropertyPlaceholders | advanced | true | boolean | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders.
 |=======================================================================

http://git-wip-us.apache.org/repos/asf/camel/blob/f6b495b9/components/camel-jetty9/src/main/docs/jetty-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/main/docs/jetty-component.adoc b/components/camel-jetty9/src/main/docs/jetty-component.adoc
index fc0c0c0..e132c4f 100644
--- a/components/camel-jetty9/src/main/docs/jetty-component.adoc
+++ b/components/camel-jetty9/src/main/docs/jetty-component.adoc
@@ -88,7 +88,7 @@ The Jetty 9 component supports 32 options which are listed below.
 | proxyPort | proxy |  | Integer | To use a http proxy to configure the port number.
 | useXForwardedForHeader | common | false | boolean | To use the X-Forwarded-For header in HttpServletRequest.getRemoteAddr.
 | sendServerVersion | consumer | true | boolean | If the option is true jetty server will send the date header to the client which sends the request. NOTE please make sure there is no any other camel-jetty endpoint is share the same port otherwise this option may not work as expected.
-| allowJavaSerializedObject | advanced | false | boolean | Whether to allow java serialization when a request uses context-type=application/x-java-serialized-object This is by default turned off. If you enable this then be aware that Java will deserialize the incoming data from the request to Java and that can be a potential security risk.
+| allowJavaSerializedObject | advanced | false | boolean | Whether to allow java serialization when a request uses context-type=application/x-java-serialized-object. This is by default turned off. If you enable this then be aware that Java will deserialize the incoming data from the request to Java and that can be a potential security risk.
 | headerFilterStrategy | filter |  | HeaderFilterStrategy | To use a custom org.apache.camel.spi.HeaderFilterStrategy to filter header to and from Camel message.
 | resolvePropertyPlaceholders | advanced | true | boolean | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders.
 |=======================================================================

http://git-wip-us.apache.org/repos/asf/camel/blob/f6b495b9/components/camel-servlet/src/main/docs/servlet-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-servlet/src/main/docs/servlet-component.adoc b/components/camel-servlet/src/main/docs/servlet-component.adoc
index 9407fa3..7e9468a 100644
--- a/components/camel-servlet/src/main/docs/servlet-component.adoc
+++ b/components/camel-servlet/src/main/docs/servlet-component.adoc
@@ -54,7 +54,7 @@ The Servlet component supports 8 options which are listed below.
 | attachmentMultipartBinding | consumer | false | boolean | Whether to automatic bind multipart/form-data as attachments on the Camel Exchange. The options attachmentMultipartBinding=true and disableStreamCache=false cannot work together. Remove disableStreamCache to use AttachmentMultipartBinding. This is turn off by default as this may require servlet specific configuration to enable this when using Servlet's.
 | httpBinding | advanced |  | HttpBinding | To use a custom HttpBinding to control the mapping between Camel message and HttpClient.
 | httpConfiguration | advanced |  | HttpConfiguration | To use the shared HttpConfiguration as base configuration.
-| allowJavaSerializedObject | advanced | false | boolean | Whether to allow java serialization when a request uses context-type=application/x-java-serialized-object This is by default turned off. If you enable this then be aware that Java will deserialize the incoming data from the request to Java and that can be a potential security risk.
+| allowJavaSerializedObject | advanced | false | boolean | Whether to allow java serialization when a request uses context-type=application/x-java-serialized-object. This is by default turned off. If you enable this then be aware that Java will deserialize the incoming data from the request to Java and that can be a potential security risk.
 | headerFilterStrategy | filter |  | HeaderFilterStrategy | To use a custom org.apache.camel.spi.HeaderFilterStrategy to filter header to and from Camel message.
 | resolvePropertyPlaceholders | advanced | true | boolean | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders.
 |=======================================================================

http://git-wip-us.apache.org/repos/asf/camel/blob/f6b495b9/platforms/spring-boot/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentConfiguration.java
index 7df9249..af474e8 100644
--- a/platforms/spring-boot/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentConfiguration.java
@@ -62,7 +62,7 @@ public class WebsocketComponentConfiguration {
     private HttpConfiguration httpConfiguration;
     /**
      * Whether to allow java serialization when a request uses
-     * context-type=application/x-java-serialized-object This is by default
+     * context-type=application/x-java-serialized-object. This is by default
      * turned off. If you enable this then be aware that Java will deserialize
      * the incoming data from the request to Java and that can be a potential
      * security risk.

http://git-wip-us.apache.org/repos/asf/camel/blob/f6b495b9/platforms/spring-boot/components-starter/camel-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentConfiguration9.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentConfiguration9.java b/platforms/spring-boot/components-starter/camel-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentConfiguration9.java
index dbfb880..1d532e9 100644
--- a/platforms/spring-boot/components-starter/camel-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentConfiguration9.java
+++ b/platforms/spring-boot/components-starter/camel-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentConfiguration9.java
@@ -189,7 +189,7 @@ public class JettyHttpComponentConfiguration9 {
     private Boolean sendServerVersion = true;
     /**
      * Whether to allow java serialization when a request uses
-     * context-type=application/x-java-serialized-object This is by default
+     * context-type=application/x-java-serialized-object. This is by default
      * turned off. If you enable this then be aware that Java will deserialize
      * the incoming data from the request to Java and that can be a potential
      * security risk.

http://git-wip-us.apache.org/repos/asf/camel/blob/f6b495b9/platforms/spring-boot/components-starter/camel-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletComponentConfiguration.java
index 7aee22d..bddd727 100644
--- a/platforms/spring-boot/components-starter/camel-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletComponentConfiguration.java
@@ -63,7 +63,7 @@ public class ServletComponentConfiguration {
     private HttpConfiguration httpConfiguration;
     /**
      * Whether to allow java serialization when a request uses
-     * context-type=application/x-java-serialized-object This is by default
+     * context-type=application/x-java-serialized-object. This is by default
      * turned off. If you enable this then be aware that Java will deserialize
      * the incoming data from the request to Java and that can be a potential
      * security risk.

Reply | Threaded
Open this post in threaded view
|

[3/3] camel git commit: Enabling camel-zipkin in mojo

nferraro
In reply to this post by nferraro
Enabling camel-zipkin in mojo


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3783ab11
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3783ab11
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3783ab11

Branch: refs/heads/master
Commit: 3783ab11d639c569b9867d5b5286202e87e2a5b3
Parents: 45710b3
Author: Nicola Ferraro <[hidden email]>
Authored: Wed Mar 15 13:39:04 2017 +0100
Committer: Nicola Ferraro <[hidden email]>
Committed: Wed Mar 15 13:56:43 2017 +0100

----------------------------------------------------------------------
 .../camel-zipkin-starter/pom.xml                  | 18 ++++++++++++------
 .../src/main/resources/META-INF/spring.provides   | 18 ++++++++++++++++++
 .../maven/packaging/SpringBootStarterMojo.java    |  2 +-
 3 files changed, 31 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3783ab11/platforms/spring-boot/components-starter/camel-zipkin-starter/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-zipkin-starter/pom.xml b/platforms/spring-boot/components-starter/camel-zipkin-starter/pom.xml
index 573d4cc..ca3e863 100644
--- a/platforms/spring-boot/components-starter/camel-zipkin-starter/pom.xml
+++ b/platforms/spring-boot/components-starter/camel-zipkin-starter/pom.xml
@@ -15,8 +15,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.apache.camel</groupId>
@@ -24,8 +23,9 @@
     <version>2.19.0-SNAPSHOT</version>
   </parent>
   <artifactId>camel-zipkin-starter</artifactId>
+  <packaging>jar</packaging>
   <name>Spring-Boot Starter :: Camel :: Zipkin</name>
-  <description>Spring-Boot Starter for Camel Zipkin Support</description>
+  <description>Spring-Boot Starter for Distributed message tracing using Zipkin</description>
   <dependencies>
     <dependency>
       <groupId>org.springframework.boot</groupId>
@@ -34,12 +34,18 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
-      <artifactId>camel-spring-boot</artifactId>
+      <artifactId>camel-zipkin</artifactId>
+      <version>${project.version}</version>
     </dependency>
+    <!--START OF GENERATED CODE-->
     <dependency>
       <groupId>org.apache.camel</groupId>
-      <artifactId>camel-zipkin</artifactId>
+      <artifactId>camel-core-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring-boot-starter</artifactId>
     </dependency>
+    <!--END OF GENERATED CODE-->
   </dependencies>
 </project>
-

http://git-wip-us.apache.org/repos/asf/camel/blob/3783ab11/platforms/spring-boot/components-starter/camel-zipkin-starter/src/main/resources/META-INF/spring.provides
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-zipkin-starter/src/main/resources/META-INF/spring.provides b/platforms/spring-boot/components-starter/camel-zipkin-starter/src/main/resources/META-INF/spring.provides
new file mode 100644
index 0000000..a85c883
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-zipkin-starter/src/main/resources/META-INF/spring.provides
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+provides: camel-zipkin
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/3783ab11/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java
index 1924b4e..5d99b3d 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java
@@ -86,7 +86,7 @@ public class SpringBootStarterMojo extends AbstractMojo {
         /* Java EE -> */ "camel-cdi", "camel-ejb",
         /* deprecated (and not working perfectly) -> */ "camel-swagger", "camel-mina", "camel-ibatis", "camel-quartz",
         /* currently incompatible */ "camel-jclouds", "camel-spark-rest",
-        /* others (not managed) -> */ "camel-groovy-dsl", "camel-scala", "camel-zipkin"};
+        /* others (not managed) -> */ "camel-groovy-dsl", "camel-scala"};
 
     private static final boolean IGNORE_TEST_MODULES = true;