You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/08/01 10:53:25 UTC

camel git commit: CAMEL-10211: spring boot - Auto configuration of tracer formatting options.

Repository: camel
Updated Branches:
  refs/heads/master c1c471af8 -> bd494acf1


CAMEL-10211: spring boot - Auto configuration of tracer formatting options.


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

Branch: refs/heads/master
Commit: bd494acf12b15309d7f9f8f27ebf86e680e49457
Parents: c1c471a
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Aug 1 12:53:02 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Aug 1 12:53:18 2016 +0200

----------------------------------------------------------------------
 .../spring/boot/CamelAutoConfiguration.java     |  31 +++-
 .../boot/CamelConfigurationProperties.java      | 183 +++++++++++++++++++
 2 files changed, 213 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/bd494acf/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
index 8b4e771..d9ed0a0 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
@@ -30,6 +30,7 @@ import org.apache.camel.TypeConverters;
 import org.apache.camel.component.properties.PropertiesComponent;
 import org.apache.camel.component.properties.PropertiesParser;
 import org.apache.camel.processor.interceptor.BacklogTracer;
+import org.apache.camel.processor.interceptor.DefaultTraceFormatter;
 import org.apache.camel.processor.interceptor.HandleFault;
 import org.apache.camel.processor.interceptor.TraceFormatter;
 import org.apache.camel.processor.interceptor.Tracer;
@@ -132,7 +133,6 @@ public class CamelAutoConfiguration {
             camelContext.getStreamCachingStrategy().setSpoolUsedHeapMemoryThreshold(config.getStreamCachingSpoolUsedHeapMemoryThreshold());
         }
 
-        camelContext.setTracing(config.isTracing());
         camelContext.setMessageHistory(config.isMessageHistory());
         camelContext.setLogExhaustedMessageBody(config.isLogExhaustedMessageBody());
         camelContext.setHandleFault(config.isHandleFault());
@@ -148,6 +148,35 @@ public class CamelAutoConfiguration {
 
         camelContext.setPackageScanClassResolver(new FatJarPackageScanClassResolver());
 
+        // tracing
+        camelContext.setTracing(config.isTracing());
+        if (camelContext.getDefaultTracer() instanceof Tracer) {
+            Tracer tracer = (Tracer) camelContext.getDefaultTracer();
+            if (tracer.getDefaultTraceFormatter() != null) {
+                DefaultTraceFormatter formatter = tracer.getDefaultTraceFormatter();
+                if (config.getTracerFormatterBreadCrumbLength() != null) {
+                    formatter.setBreadCrumbLength(config.getTracerFormatterBreadCrumbLength());
+                }
+                if (config.getTracerFormatterMaxChars() != null) {
+                    formatter.setMaxChars(config.getTracerFormatterMaxChars());
+                }
+                if (config.getTracerFormatterNodeLength() != null) {
+                    formatter.setNodeLength(config.getTracerFormatterNodeLength());
+                }
+                formatter.setShowBody(config.isTraceFormatterShowBody());
+                formatter.setShowBodyType(config.isTracerFormatterShowBodyType());
+                formatter.setShowBreadCrumb(config.isTraceFormatterShowBreadCrumb());
+                formatter.setShowException(config.isTraceFormatterShowException());
+                formatter.setShowExchangeId(config.isTraceFormatterShowExchangeId());
+                formatter.setShowExchangePattern(config.isTraceFormatterShowExchangePattern());
+                formatter.setShowHeaders(config.isTraceFormatterShowHeaders());
+                formatter.setShowNode(config.isTraceFormatterShowNode());
+                formatter.setShowProperties(config.isTraceFormatterShowProperties());
+                formatter.setShowRouteId(config.isTraceFormatterShowRouteId());
+                formatter.setShowShortExchangeId(config.isTraceFormatterShowShortExchangeId());
+            }
+        }
+
         // additional advanced configuration which is not configured using CamelConfigurationProperties
         afterPropertiesSet(applicationContext, camelContext);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/bd494acf/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java
index 42c1628..100aa18 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java
@@ -17,6 +17,7 @@
 package org.apache.camel.spring.boot;
 
 import org.apache.camel.ManagementStatisticsLevel;
+import org.apache.camel.api.management.ManagedAttribute;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 
 @ConfigurationProperties(prefix = "camel.springboot")
@@ -245,6 +246,76 @@ public class CamelConfigurationProperties {
      */
     private boolean jmxCreateConnector;
 
+    /**
+     * Tracer should output message body
+     */
+    private boolean traceFormatterShowBody = true;
+
+    /**
+     * Tracer should output message body type
+     */
+    private boolean tracerFormatterShowBodyType = true;
+
+    /**
+     * Tracer should output breadcrumb
+     */
+    private boolean traceFormatterShowBreadCrumb = true;
+
+    /**
+     * Tracer should output exchange id
+     */
+    private boolean traceFormatterShowExchangeId;
+
+    /**
+     * Tracer should output message headers
+     */
+    private boolean traceFormatterShowHeaders = true;
+
+    /**
+     * Tracer should output exchange properties
+     */
+    private boolean traceFormatterShowProperties;
+
+    /**
+     * Tracer should output EIP node
+     */
+    private boolean traceFormatterShowNode = true;
+
+    /**
+     * Tracer should output message exchange pattern (MEP)
+     */
+    private boolean traceFormatterShowExchangePattern = true;
+
+    /**
+     * Tracer should output exception
+     */
+    private boolean traceFormatterShowException = true;
+
+    /**
+     * Tracer should output route id
+     */
+    private boolean traceFormatterShowRouteId = true;
+
+    /**
+     * Tracer maximum length of breadcrumb ids
+     */
+    private Integer tracerFormatterBreadCrumbLength;
+
+    /**
+     * Tracer should output short exchange id
+     */
+    private boolean traceFormatterShowShortExchangeId;
+
+    /**
+     * Tracer maximum length of node
+     */
+    private Integer tracerFormatterNodeLength;
+
+    /**
+     * Tracer maximum characters in total
+     */
+    private Integer tracerFormatterMaxChars = 10000;
+
     // Getters & setters
 
     public String getName() {
@@ -496,4 +567,116 @@ public class CamelConfigurationProperties {
     public void setFileConfigurations(String fileConfigurations) {
         this.fileConfigurations = fileConfigurations;
     }
+
+    public boolean isTraceFormatterShowBody() {
+        return traceFormatterShowBody;
+    }
+
+    public void setTraceFormatterShowBody(boolean traceFormatterShowBody) {
+        this.traceFormatterShowBody = traceFormatterShowBody;
+    }
+
+    public boolean isTracerFormatterShowBodyType() {
+        return tracerFormatterShowBodyType;
+    }
+
+    public void setTracerFormatterShowBodyType(boolean tracerFormatterShowBodyType) {
+        this.tracerFormatterShowBodyType = tracerFormatterShowBodyType;
+    }
+
+    public boolean isTraceFormatterShowBreadCrumb() {
+        return traceFormatterShowBreadCrumb;
+    }
+
+    public void setTraceFormatterShowBreadCrumb(boolean traceFormatterShowBreadCrumb) {
+        this.traceFormatterShowBreadCrumb = traceFormatterShowBreadCrumb;
+    }
+
+    public boolean isTraceFormatterShowExchangeId() {
+        return traceFormatterShowExchangeId;
+    }
+
+    public void setTraceFormatterShowExchangeId(boolean traceFormatterShowExchangeId) {
+        this.traceFormatterShowExchangeId = traceFormatterShowExchangeId;
+    }
+
+    public boolean isTraceFormatterShowHeaders() {
+        return traceFormatterShowHeaders;
+    }
+
+    public void setTraceFormatterShowHeaders(boolean traceFormatterShowHeaders) {
+        this.traceFormatterShowHeaders = traceFormatterShowHeaders;
+    }
+
+    public boolean isTraceFormatterShowProperties() {
+        return traceFormatterShowProperties;
+    }
+
+    public void setTraceFormatterShowProperties(boolean traceFormatterShowProperties) {
+        this.traceFormatterShowProperties = traceFormatterShowProperties;
+    }
+
+    public boolean isTraceFormatterShowNode() {
+        return traceFormatterShowNode;
+    }
+
+    public void setTraceFormatterShowNode(boolean traceFormatterShowNode) {
+        this.traceFormatterShowNode = traceFormatterShowNode;
+    }
+
+    public boolean isTraceFormatterShowExchangePattern() {
+        return traceFormatterShowExchangePattern;
+    }
+
+    public void setTraceFormatterShowExchangePattern(boolean traceFormatterShowExchangePattern) {
+        this.traceFormatterShowExchangePattern = traceFormatterShowExchangePattern;
+    }
+
+    public boolean isTraceFormatterShowException() {
+        return traceFormatterShowException;
+    }
+
+    public void setTraceFormatterShowException(boolean traceFormatterShowException) {
+        this.traceFormatterShowException = traceFormatterShowException;
+    }
+
+    public boolean isTraceFormatterShowRouteId() {
+        return traceFormatterShowRouteId;
+    }
+
+    public void setTraceFormatterShowRouteId(boolean traceFormatterShowRouteId) {
+        this.traceFormatterShowRouteId = traceFormatterShowRouteId;
+    }
+
+    public Integer getTracerFormatterBreadCrumbLength() {
+        return tracerFormatterBreadCrumbLength;
+    }
+
+    public void setTracerFormatterBreadCrumbLength(Integer tracerFormatterBreadCrumbLength) {
+        this.tracerFormatterBreadCrumbLength = tracerFormatterBreadCrumbLength;
+    }
+
+    public boolean isTraceFormatterShowShortExchangeId() {
+        return traceFormatterShowShortExchangeId;
+    }
+
+    public void setTraceFormatterShowShortExchangeId(boolean traceFormatterShowShortExchangeId) {
+        this.traceFormatterShowShortExchangeId = traceFormatterShowShortExchangeId;
+    }
+
+    public Integer getTracerFormatterNodeLength() {
+        return tracerFormatterNodeLength;
+    }
+
+    public void setTracerFormatterNodeLength(Integer tracerFormatterNodeLength) {
+        this.tracerFormatterNodeLength = tracerFormatterNodeLength;
+    }
+
+    public Integer getTracerFormatterMaxChars() {
+        return tracerFormatterMaxChars;
+    }
+
+    public void setTracerFormatterMaxChars(Integer tracerFormatterMaxChars) {
+        this.tracerFormatterMaxChars = tracerFormatterMaxChars;
+    }
 }