Add spring-cloud-sleuth for tracing 21/136921/1
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Thu, 4 Jan 2024 12:35:54 +0000 (13:35 +0100)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Thu, 4 Jan 2024 12:35:54 +0000 (13:35 +0100)
- add tracing dependencies
- align localhost-access-logback.xml with the one in the oom chart
- bump version to 1.13.1

Issue-ID: AAI-3714
Change-Id: I6565d63f070bbd04188f383fc88ea9ca884951dd
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
aai-traversal/pom.xml
aai-traversal/src/main/resources/application.properties
aai-traversal/src/main/resources/localhost-access-logback.xml
pom.xml
version.properties

index 125edea..b2da78a 100644 (file)
@@ -26,7 +26,7 @@
        <parent>
                <groupId>org.onap.aai.traversal</groupId>
                <artifactId>traversal</artifactId>
-               <version>1.13.0-SNAPSHOT</version>
+               <version>1.13.1-SNAPSHOT</version>
        </parent>
        <groupId>org.onap.aai.traversal</groupId>
        <artifactId>aai-traversal</artifactId>
@@ -96,6 +96,7 @@
                <!-- versions -->
                <spring.boot.version>2.4.13</spring.boot.version>
                <spring.version>5.3.13</spring.version>
+               <spring-cloud.version>2020.0.2</spring-cloud.version>
                <spring.test.version>${spring.version}</spring.test.version>
                <spring.jms.version>${spring.version}</spring.jms.version>
                <javax.servlet.version>4.0.1</javax.servlet.version>
                        <artifactId>spring-boot-starter-jetty</artifactId>
                </dependency>
                <dependency>
+                       <groupId>org.springframework.cloud</groupId>
+                       <artifactId>spring-cloud-starter-sleuth</artifactId>
+               </dependency>
+               <dependency>
+                               <groupId>org.springframework.cloud</groupId>
+                               <artifactId>spring-cloud-sleuth-zipkin</artifactId>
+               </dependency>
+               <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-test</artifactId>
       <scope>test</scope>
                                <type>pom</type>
                                <scope>import</scope>
                        </dependency>
+                       <dependency>
+                               <groupId>org.springframework.cloud</groupId>
+                               <artifactId>spring-cloud-dependencies</artifactId>
+                               <version>${spring-cloud.version}</version>
+                               <type>pom</type>
+                               <scope>import</scope>
+                       </dependency>
                </dependencies>
        </dependencyManagement>
        <build>
index 5e49d18..e624e96 100644 (file)
@@ -8,6 +8,14 @@ spring.application.name=aai-traversal
 spring.jersey.type=filter
 spring.main.allow-bean-definition-overriding=true
 
+spring.zipkin.baseUrl=http://jaeger-collector.istio-system:9411
+spring.sleuth.messaging.jms.enabled=false
+spring.sleuth.trace-id128=true
+spring.sleuth.sampler.probability=1.0
+spring.sleuth.propagation.type=w3c,b3
+spring.sleuth.supports-join=false
+spring.sleuth.web.skip-pattern=/aai/util.*
+
 server.servlet.context-path=${schema.uri.base.path}
 spring.autoconfigure.exclude=\
   org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,\
index cb0b9a6..35a2c5c 100644 (file)
@@ -1,54 +1,78 @@
 <!--
+       ============LICENSE_START=======================================================
+       org.onap.aai
+       ================================================================================
+       Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+       Modifications Copyright © 2018 Amdocs, Bell Canada
+       Modifications Copyright © 2020 Orange
+       Modifications Copyright © 2024 Deutsche Telekom SA
+       ================================================================================
+       Licensed 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
 
-    ============LICENSE_START=======================================================
-    org.onap.aai
-    ================================================================================
-    Copyright © 2017 AT&T Intellectual Property. All rights reserved.
-    ================================================================================
-    Licensed 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.
-    ============LICENSE_END=========================================================
-
-    ECOMP is a trademark and service mark of AT&T Intellectual Property.
+                       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.
+       ============LICENSE_END=========================================================
 -->
-<configuration>
-       <property name="AJSC_HOME" value="${AJSC_HOME:-.}" />
-       <property name="maxHistory" value='7' />
-       <property name="totalSizeCap" value='1GB' />
-       <appender name="ACCESS"
-               class="ch.qos.logback.core.rolling.RollingFileAppender">
-               <file>${AJSC_HOME}/logs/ajsc-jetty/localhost_access.log</file>
-               <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-                       <fileNamePattern>${AJSC_HOME}/logs/ajsc-jetty/localhost_access.log.%d{yyyy-MM-dd}
-                       </fileNamePattern>
-                       <maxHistory>${maxHistory}</maxHistory>
-                       <totalSizeCap>${totalSizeCap}</totalSizeCap>
-               </rollingPolicy>
-               <encoder class="org.onap.aai.logging.CustomLogPatternLayoutEncoder">
-                       <Pattern>%a %u %z [%t] "%m %U%q" %s %b %y %i{X-TransactionId} %i{X-FromAppId} %i{X-Forwarded-For} %i{X-AAI-SSL-Client-CN} %i{X-AAI-SSL-Client-OU} %i{X-AAI-SSL-Client-O} %i{X-AAI-SSL-Client-L} %i{X-AAI-SSL-Client-ST} %i{X-AAI-SSL-Client-C} %i{X-AAI-SSL-Client-NotBefore} %i{X-AAI-SSL-Client-NotAfter} %i{X-AAI-SSL-Client-DN} %D</Pattern>
-               </encoder>
-       </appender>
-       <appender-ref ref="ACCESS" />
+<configuration scan="true" scanPeriod="60 seconds" debug="false">
+<property name="AJSC_HOME" value="${AJSC_HOME:-.}" />
+<property name="maxHistory" value='7' />
+<property name="totalSizeCap" value='1GB' />
+<property name="logToFileEnabled" value='false' />
+<property name="livenessAccessLogEnabled"      value='false' />
 
-       <appender name="STDOUTACCESS" class="ch.qos.logback.core.ConsoleAppender">
-               <encoder class="org.onap.aai.logging.CustomLogPatternLayoutEncoder">
-                       <Pattern>%a %u %z [%t] "%m %U%q" %s %b %y %i{X-TransactionId} %i{X-FromAppId} %i{X-Forwarded-For} %i{X-AAI-SSL-Client-CN} %i{X-AAI-SSL-Client-OU} %i{X-AAI-SSL-Client-O} %i{X-AAI-SSL-Client-L} %i{X-AAI-SSL-Client-ST} %i{X-AAI-SSL-Client-C} %i{X-AAI-SSL-Client-NotBefore} %i{X-AAI-SSL-Client-NotAfter} %i{X-AAI-SSL-Client-DN} %D - "logType": "access"</Pattern>
-               </encoder>
-       </appender>
-       <appender-ref ref="STDOUTACCESS" />
+<if condition='property("logToFileEnabled").contains("true")'>
+       <then>
+               <appender name="ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender">
+                       <file>${AJSC_HOME}/logs/ajsc-jetty/localhost_access.log</file>
+                       <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+                               <fileNamePattern>${AJSC_HOME}/logs/ajsc-jetty/localhost_access.log.%d{yyyy-MM-dd}
+                               </fileNamePattern>
+                               <maxHistory>${maxHistory}</maxHistory>
+                               <totalSizeCap>${totalSizeCap}</totalSizeCap>
+                       </rollingPolicy>
+                       <encoder class="org.onap.aai.logging.CustomLogPatternLayoutEncoder">
+                               <Pattern>%a %u %z [%t] "%m %U%q" %s %b %y %i{X-TransactionId} %i{X-FromAppId}
+                                       %i{X-Forwarded-For} %i{X-AAI-SSL-Client-CN} %i{X-AAI-SSL-Client-OU}
+                                       %i{X-AAI-SSL-Client-O} %i{X-AAI-SSL-Client-L} %i{X-AAI-SSL-Client-ST}
+                                       %i{X-AAI-SSL-Client-C} %i{X-AAI-SSL-Client-NotBefore} %i{X-AAI-SSL-Client-NotAfter}
+                                       %i{X-AAI-SSL-Client-DN} %D</Pattern>
+                       </encoder>
+               </appender>
+               <appender-ref ref="ACCESS" />
+       </then>
+</if>
+
+<appender name="STDOUTACCESS" class="ch.qos.logback.core.ConsoleAppender">
+       <encoder class="org.onap.aai.logging.CustomLogPatternLayoutEncoder">
+               <Pattern>%a %u %z [%t] "%m %U%q" %s %b %y %i{X-TransactionId} %i{X-FromAppId}
+                       %i{X-Forwarded-For} %i{X-AAI-SSL-Client-CN} %i{X-AAI-SSL-Client-OU} %i{X-AAI-SSL-Client-O}
+                       %i{X-AAI-SSL-Client-L} %i{X-AAI-SSL-Client-ST} %i{X-AAI-SSL-Client-C}
+                       %i{X-AAI-SSL-Client-NotBefore} %i{X-AAI-SSL-Client-NotAfter} %i{X-AAI-SSL-Client-DN} %D -
+                       "logType": "access"</Pattern>
+       </encoder>
+       <if condition='property("livenessAccessLogEnabled").contains("false")'>
+               <then>
+                       <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+                               <evaluator class="ch.qos.logback.access.net.URLEvaluator">
+                                       <URL>/aai/util/echo</URL>
+                               </evaluator>
+                               <OnMismatch>NEUTRAL</OnMismatch>
+                               <OnMatch>DENY</OnMatch>
+                       </filter>
+               </then>
+       </if>
+</appender>
+<appender-ref ref="STDOUTACCESS" />
 </configuration>
 
-<!-- 
+<!--
 %a - Remote IP address
 %A - Local IP address
 %b - Bytes sent, excluding HTTP headers, or '-' if no bytes were sent
@@ -70,4 +94,4 @@
 
 %z - Custom pattern that parses the cert for the subject
 %y - Custom pattern determines rest or dme2
- -->
\ No newline at end of file
+-->
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index a820c3b..cf67554 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
     </parent>
     <groupId>org.onap.aai.traversal</groupId>
     <artifactId>traversal</artifactId>
-    <version>1.13.0-SNAPSHOT</version>
+    <version>1.13.1-SNAPSHOT</version>
     <name>aai-traversal</name>
     <packaging>pom</packaging>
     <modules>
index 39cb3bf..0c0fa8e 100644 (file)
@@ -5,7 +5,7 @@
 
 major_version=1
 minor_version=13
-patch_version=0
+patch_version=1
 
 base_version=${major_version}.${minor_version}.${patch_version}