Repository: camel
Updated Branches:
  refs/heads/master ddfecf079 -> 61eca42a6


CAMEL-9759: camel-zipkin - Instrument Camel. Work in progress.


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

Branch: refs/heads/master
Commit: 61eca42a690fbeaae8992d5e2d5c0d9897650045
Parents: ddfecf0
Author: Claus Ibsen <davscl...@apache.org>
Authored: Tue Mar 29 17:41:13 2016 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Tue Mar 29 17:43:56 2016 +0200

----------------------------------------------------------------------
 .../zipkin/ZipkinClientRequestAdapter.java      |  6 ++--
 .../apache/camel/zipkin/ZipkinConstants.java    | 34 ++++++++++++++++++++
 .../camel/zipkin/ZipkinEventNotifier.java       |  2 +-
 .../zipkin/ZipkinServerRequestAdapter.java      |  6 ++--
 4 files changed, 41 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/61eca42a/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinClientRequestAdapter.java
----------------------------------------------------------------------
diff --git 
a/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinClientRequestAdapter.java
 
b/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinClientRequestAdapter.java
index 03028ba..1d54e85 100644
--- 
a/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinClientRequestAdapter.java
+++ 
b/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinClientRequestAdapter.java
@@ -56,10 +56,10 @@ public final class ZipkinClientRequestAdapter implements 
ClientRequestAdapter {
 
     @Override
     public void addSpanIdToRequest(@Nullable SpanId spanId) {
-        exchange.getIn().setHeader("CamelZipkinTraceId", 
IdConversion.convertToString(spanId.getTraceId()));
-        exchange.getIn().setHeader("CamelZipkinSpanId", 
IdConversion.convertToString(spanId.getSpanId()));
+        exchange.getIn().setHeader(ZipkinConstants.TRACE_ID, 
IdConversion.convertToString(spanId.getTraceId()));
+        exchange.getIn().setHeader(ZipkinConstants.SPAN_ID, 
IdConversion.convertToString(spanId.getSpanId()));
         if (spanId.getParentSpanId() != null) {
-            exchange.getIn().setHeader("CamelZipkinParentSpanId", 
IdConversion.convertToString(spanId.getParentSpanId()));
+            exchange.getIn().setHeader(ZipkinConstants.PARENT_SPAN_ID, 
IdConversion.convertToString(spanId.getParentSpanId()));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/61eca42a/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinConstants.java
----------------------------------------------------------------------
diff --git 
a/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinConstants.java
 
b/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinConstants.java
new file mode 100644
index 0000000..810a3e9
--- /dev/null
+++ 
b/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinConstants.java
@@ -0,0 +1,34 @@
+/**
+ * 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;
+
+/**
+ * Contains the header keys that are used to represent trace id, span id, 
parent span id, sampled.
+ * <p/>
+ * The names correspond with the zipkin header values.
+ */
+public final class ZipkinConstants {
+
+    public static final String TRACE_ID = "X-B3-TraceId";
+    public static final String SPAN_ID = "X-B3-SpanId";
+    public static final String PARENT_SPAN_ID = "X-B3-ParentSpanId";
+    public static final String SAMPLED = "X-B3-Sampled";
+
+    private ZipkinConstants() {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/61eca42a/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinEventNotifier.java
----------------------------------------------------------------------
diff --git 
a/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinEventNotifier.java
 
b/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinEventNotifier.java
index ed3efa7..9c78d34 100644
--- 
a/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinEventNotifier.java
+++ 
b/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinEventNotifier.java
@@ -200,7 +200,7 @@ public class ZipkinEventNotifier extends 
EventNotifierSupport implements Statefu
             String host = 
camelContext.resolvePropertyPlaceholders("{{service.host:zipkin}}");
             String port = 
camelContext.resolvePropertyPlaceholders("{{service.port:zipkin}}");
             if (ObjectHelper.isNotEmpty(host) && 
ObjectHelper.isNotEmpty(port)) {
-                log.info("Auto-configuring ZipkinScribeSpanCollector using 
host: {} and port: {}", host, port);
+                log.info("Auto-configuring Zipkin ScribeSpanCollector using 
host: {} and port: {}", host, port);
                 int num = 
camelContext.getTypeConverter().mandatoryConvertTo(Integer.class, port);
                 spanCollector = new ScribeSpanCollector(host, num);
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/61eca42a/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinServerRequestAdapter.java
----------------------------------------------------------------------
diff --git 
a/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinServerRequestAdapter.java
 
b/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinServerRequestAdapter.java
index 17281de..c65243c 100644
--- 
a/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinServerRequestAdapter.java
+++ 
b/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinServerRequestAdapter.java
@@ -50,9 +50,9 @@ public class ZipkinServerRequestAdapter implements 
ServerRequestAdapter {
 
     @Override
     public TraceData getTraceData() {
-        String traceId = exchange.getIn().getHeader("CamelZipkinTraceId", 
String.class);
-        String spanId = exchange.getIn().getHeader("CamelZipkinSpanId", 
String.class);
-        String parentSpanId = 
exchange.getIn().getHeader("CamelZipkinParentSpanId", String.class);
+        String traceId = exchange.getIn().getHeader(ZipkinConstants.TRACE_ID, 
String.class);
+        String spanId = exchange.getIn().getHeader(ZipkinConstants.SPAN_ID, 
String.class);
+        String parentSpanId = 
exchange.getIn().getHeader(ZipkinConstants.PARENT_SPAN_ID, String.class);
         if (traceId != null && spanId != null) {
             SpanId span = getSpanId(traceId, spanId, parentSpanId);
             return TraceData.builder().sample(true).spanId(span).build();

Reply via email to