Add tracing to schema-service 89/139689/2
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Fri, 6 Dec 2024 17:44:10 +0000 (18:44 +0100)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Fri, 6 Dec 2024 19:23:43 +0000 (20:23 +0100)
- add tracing
- cleanup pom by removing not necessary dependencies

Issue-ID: AAI-4083
Change-Id: Ie491b8a6e20b0189473b88118f4310df8cdb4ac5
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
aai-schema-gen/pom.xml
aai-schema-gen/src/main/java/org/onap/aai/schemagen/genxsd/ConfigTranslatorForDocs.java
aai-schema-gen/src/main/java/org/onap/aai/schemagen/swagger/GenerateSwagger.java
aai-schema-service/pom.xml
aai-schema-service/src/main/resources/application.properties
pom.xml

index 80a6440..71331ad 100644 (file)
             <artifactId>spring-webmvc</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-test</artifactId>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.vaadin.external.google</groupId>
+                    <artifactId>android-json</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.yaml</groupId>
         <dependency>
             <groupId>org.onap.aai.aai-common</groupId>
             <artifactId>aai-schema-ingest</artifactId>
-            <version>1.9.3</version>
             <scope>compile</scope>
             <exclusions>
                 <exclusion>
         <dependency>
             <groupId>com.fasterxml.jackson.dataformat</groupId>
             <artifactId>jackson-dataformat-yaml</artifactId>
-            <version>2.2.3</version>
         </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
-            <!-- <version>3.7</version> -->
             <scope>compile</scope>
         </dependency>
         <dependency>
             <version>1.2</version>
             <scope>compile</scope>
         </dependency>
-        <dependency>
-            <groupId>org.hamcrest</groupId>
-            <artifactId>java-hamcrest</artifactId>
-            <version>2.0.0.0</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.hamcrest</groupId>
-            <artifactId>hamcrest-core</artifactId>
-            <version>1.3</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.hamcrest</groupId>
-            <artifactId>hamcrest-junit</artifactId>
-            <scope>test</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>junit</groupId>
-                    <artifactId>junit</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
         <dependency>
             <groupId>org.mockito</groupId>
             <artifactId>mockito-core</artifactId>
-            <version>4.11.0</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter-api</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter-engine</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter-params</artifactId>
+            <version>4.4.0</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
index ca1c71e..f9884c0 100644 (file)
@@ -35,9 +35,12 @@ import org.onap.aai.setup.SchemaVersion;
 
 public class ConfigTranslatorForDocs extends AAIConfigTranslator {
 
+    private final SchemaLocationsBean bean;
+
     public ConfigTranslatorForDocs(SchemaLocationsBean bean,
         SchemaConfigVersions schemaConfigVersions) {
         super(bean, schemaConfigVersions);
+        this.bean = bean;
     }
 
     @Override
index c050063..9b2fa2c 100644 (file)
@@ -20,8 +20,9 @@
 
 package org.onap.aai.schemagen.swagger;
 
-import com.fasterxml.jackson.dataformat.yaml.snakeyaml.Yaml;
-import com.fasterxml.jackson.dataformat.yaml.snakeyaml.constructor.SafeConstructor;
+import org.yaml.snakeyaml.LoaderOptions;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.constructor.Constructor;
 
 import freemarker.template.Configuration;
 import freemarker.template.Template;
@@ -109,7 +110,10 @@ public class GenerateSwagger {
             System.exit(1);
         }
 
-        Yaml yaml = new Yaml(new SafeConstructor());
+        LoaderOptions loaderOptions = new LoaderOptions();
+        int codePointLimit = 100 * 1024 * 1024; // 100MB
+        loaderOptions.setCodePointLimit(codePointLimit);
+        Yaml yaml = new Yaml(new Constructor(loaderOptions));
         Map<String, Object> swaggerMap = null;
 
         try (BufferedReader reader = new BufferedReader(new FileReader(swaggerYamlFile))) {
index 79fb75a..f69b2dd 100644 (file)
         </profile>
     </profiles>
     <dependencies>
-        <dependency>
-            <groupId>jakarta.xml.bind</groupId>
-            <artifactId>jakarta.xml.bind-api</artifactId>
-            <version>3.0.0</version>
-        </dependency>
-        <dependency>
-            <groupId>javax.annotation</groupId>
-            <artifactId>javax.annotation-api</artifactId>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>javax.el</groupId>
-            <artifactId>javax.el-api</artifactId>
-            <version>3.0.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.glassfish</groupId>
-            <artifactId>javax.el</artifactId>
-            <version>3.0.0</version>
-        </dependency>
-        <dependency>
-            <groupId>javax.jms</groupId>
-            <artifactId>javax.jms-api</artifactId>
-            <version>2.0.1</version>
-        </dependency>
-        <dependency>
-            <groupId>javax.ws.rs</groupId>
-            <artifactId>javax.ws.rs-api</artifactId>
-            <version>2.1</version>
-        </dependency>
         <dependency>
             <groupId>com.att.eelf</groupId>
             <artifactId>eelf-core</artifactId>
                 </exclusion>
             </exclusions>
         </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>io.micrometer</groupId>
+            <artifactId>micrometer-registry-prometheus</artifactId>
+        </dependency>
         <dependency>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-test</artifactId>
+            <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
             <artifactId>mockito-core</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter-api</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter-engine</artifactId>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
     <build>
         <resources>
index dd03362..8581348 100644 (file)
@@ -3,10 +3,17 @@ info.build.name=@project.name@
 info.build.description=@project.description@
 info.build.version=@project.version@
 
-spring.application.name=Schema Service Microservice
+spring.application.name=aai-schema-service
 spring.jersey.type=filter
 spring.main.allow-bean-definition-overriding=true
 
+spring.sleuth.enabled=false
+spring.zipkin.baseUrl=http://jaeger-collector.istio-system:9411
+spring.sleuth.trace-id128=true
+spring.sleuth.sampler.probability=1.0
+spring.sleuth.propagation.type=w3c, b3
+spring.sleuth.supports-join=false
+
 server.servlet.context-path=${schema.uri.base.path}
 
 spring.autoconfigure.exclude=\
diff --git a/pom.xml b/pom.xml
index 5c0f0f0..801e6e2 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -45,7 +45,6 @@
             Nexus Proxy Properties and Snapshot Locations
             Ideally this can be overwritten at runtime per internal environment specific values at runtime
         -->
-        <aai.common.version>1.15.2</aai.common.version>
         <nexusproxy>https://nexus.onap.org</nexusproxy>
         <site.path>/content/sites/site/org/onap/aai/resources/${project.artifactId}/${project.version}</site.path>
         <release.path>/content/repositories/releases/</release.path>
@@ -53,6 +52,8 @@
         <!-- GMaven plugin uses this property to figure out the name of the docker tag -->
         <aai.project.version>${project.version}</aai.project.version>
         <checkstyle.skip>false</checkstyle.skip>
+        <aai.common.version>1.15.2</aai.common.version>
+        <spring-cloud.version>2021.0.9</spring-cloud.version>
     </properties>
     <dependencyManagement>
         <dependencies>
                 <artifactId>org.eclipse.persistence.moxy</artifactId>
                 <version>2.7.15</version>
             </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>