]> source.dussan.org Git - sonarqube.git/commitdiff
SQDEVOPS-372 setup Datadog agent in java test through gradle config. output Datadog...
authorSteve Marion <steve.marion@sonarsource.com>
Tue, 27 Feb 2024 15:05:00 +0000 (16:05 +0100)
committersonartech <sonartech@sonarsource.com>
Mon, 4 Mar 2024 20:02:27 +0000 (20:02 +0000)
build.gradle

index 58ebefd688b9591c476c5dbc9abb59067c5ecf6f..05eeadfbaaaa92514eef1f9810ed40f34be0d4ba 100644 (file)
@@ -334,6 +334,7 @@ subprojects {
       }
       dependency 'com.onelogin:java-saml:2.9.0'
       dependency 'com.oracle.database.jdbc:ojdbc11:23.3.0.23.09'
+      dependency 'com.datadoghq:dd-java-agent:1.30.1'
       dependency 'org.aspectj:aspectjtools:1.9.21'
       // If this gets updated the dependency on okio 3.5.0 should be reviewed
       dependencySet(group: 'com.squareup.okhttp3', version: '4.12.0') {
@@ -691,6 +692,7 @@ subprojects {
     configurations {
       utMonitoring
       testMonitoring
+      ddAgent
     }
 
     dependencies {
@@ -699,6 +701,17 @@ subprojects {
 
       utMonitoring 'org.aspectj:aspectjweaver:1.9.21'
       testMonitoring 'org.aspectj:aspectjweaver:1.9.21'
+      ddAgent 'com.datadoghq:dd-java-agent'
+    }
+
+    if (System.getenv('CI') == "true") {
+      doFirst {
+        ext {
+          ddJavaAgent = configurations.ddAgent.resolvedConfiguration.resolvedArtifacts.find { it.name == 'dd-java-agent' }
+        }
+        jvmArgs "-javaagent:${ddJavaAgent.file}"
+        jvmArgs "-Ddatadog.slf4j.simpleLogger.logFile=${project.projectDir}/build/datadog.log"
+      }
     }
   }