Skip to content

Commit aec4371

Browse files
committed
Merge remote-tracking branch 'origin/master' into bdu/enable-css-only-after-agent-7.65.0
2 parents c08baa1 + 89639f7 commit aec4371

File tree

1,051 files changed

+6463
-3409
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,051 files changed

+6463
-3409
lines changed

.github/workflows/analyze-changes.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
${{ runner.os }}-gradle-
3131
3232
- name: Initialize CodeQL
33-
uses: github/codeql-action/init@fdbfb4d2750291e159f0156def62b853c2798ca2 # v4.31.5
33+
uses: github/codeql-action/init@fe4161a26a8629af62121b670040955b330f9af2 # v4.31.6
3434
with:
3535
languages: 'java'
3636
build-mode: 'manual'
@@ -49,7 +49,7 @@ jobs:
4949
--build-cache --parallel --stacktrace --no-daemon --max-workers=4
5050
5151
- name: Perform CodeQL Analysis and upload results to GitHub Security tab
52-
uses: github/codeql-action/analyze@fdbfb4d2750291e159f0156def62b853c2798ca2 # v4.31.5
52+
uses: github/codeql-action/analyze@fe4161a26a8629af62121b670040955b330f9af2 # v4.31.6
5353

5454
trivy:
5555
name: Analyze changes with Trivy
@@ -114,7 +114,7 @@ jobs:
114114
TRIVY_JAVA_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-java-db,public.ecr.aws/aquasecurity/trivy-java-db
115115

116116
- name: Upload Trivy scan results to GitHub Security tab
117-
uses: github/codeql-action/upload-sarif@fdbfb4d2750291e159f0156def62b853c2798ca2 # v4.31.5
117+
uses: github/codeql-action/upload-sarif@fe4161a26a8629af62121b670040955b330f9af2 # v4.31.6
118118
if: always()
119119
with:
120120
sarif_file: 'trivy-results.sarif'

.github/workflows/check-pull-request-labels.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
repo: context.repo.repo
4646
})
4747
const commentMarker = '<!-- dd-trace-java-check-pr-labels-workflow -->'
48-
const blockingComment = comments.data.find(comment => comment.body.includes(commentMarker))
48+
let blockingComment = comments.data.find(comment => comment.body.includes(commentMarker))
4949
// Create or update blocking comment if there are invalid labels
5050
if (hasInvalidLabels) {
5151
const commentBody = '**PR Blocked - Invalid Label**\n\n' +

.github/workflows/run-system-tests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
build:
2222
runs-on:
2323
group: APM Larger Runners
24+
environment:
25+
name: ci-build
2426
steps:
2527
- name: Checkout repository
2628
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # 6.0.0

.gitlab-ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ workflow:
6161
- "17"
6262
- "21"
6363
- "25"
64+
- "26"
6465
- "semeru11"
6566
- "oracle8"
6667
- "zulu8"
@@ -363,6 +364,12 @@ spotless:
363364
extends: .gradle_build
364365
stage: tests
365366
needs: []
367+
variables:
368+
# TODO: Latest version of spotless is failing with OOM on CI only.
369+
# Setting 8G memory solving this issue, but we need to solve it eventually.
370+
GRADLE_MEM: 8G
371+
KUBERNETES_MEMORY_REQUEST: 18Gi
372+
KUBERNETES_MEMORY_LIMIT: 18Gi
366373
script:
367374
- ./gradlew --version
368375
- ./gradlew spotlessCheck $GRADLE_ARGS

build.gradle.kts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ plugins {
99
id("dd-trace-java.config-inversion-linter")
1010
id("dd-trace-java.ci-jobs")
1111

12-
id("com.diffplug.spotless") version "6.13.0"
13-
id("com.github.spotbugs") version "5.0.14"
14-
id("de.thetaphi.forbiddenapis") version "3.8"
12+
id("com.diffplug.spotless") version "8.1.0"
13+
id("com.github.spotbugs") version "6.4.7"
14+
id("de.thetaphi.forbiddenapis") version "3.10"
1515
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
1616
id("com.gradleup.shadow") version "8.3.6" apply false
1717
id("me.champeau.jmh") version "0.7.3" apply false
@@ -36,7 +36,7 @@ with(extensions["spotlessPredeclare"] as SpotlessExtension) {
3636
removeUnusedImports()
3737

3838
// This is the last Google Java Format version that supports Java 8
39-
googleJavaFormat("1.7")
39+
googleJavaFormat("1.32.0")
4040
}
4141
groovyGradle {
4242
greclipse()
@@ -45,13 +45,14 @@ with(extensions["spotlessPredeclare"] as SpotlessExtension) {
4545
greclipse()
4646
}
4747
kotlinGradle {
48-
ktlint("0.41.0")
48+
ktlint("1.8.0")
4949
}
5050
kotlin {
51-
ktlint("0.41.0")
51+
ktlint("1.8.0")
5252
}
5353
scala {
54-
scalafmt("2.7.5")
54+
// TODO: For some reason Scala format is working correctly with this version only.
55+
scalafmt("3.8.6")
5556
}
5657
}
5758
apply(from = rootDir.resolve("gradle/spotless.gradle"))
@@ -145,7 +146,8 @@ testAggregate("instrumentation", listOf(":dd-java-agent:instrumentation"), empty
145146
testAggregate("profiling", listOf(":dd-java-agent:agent-profiling"), emptyList())
146147
testAggregate("debugger", listOf(":dd-java-agent:agent-debugger"), forceCoverage = true)
147148
testAggregate(
148-
"base", listOf(":"),
149+
"base",
150+
listOf(":"),
149151
listOf(
150152
":dd-java-agent:instrumentation",
151153
":dd-smoke-tests",

buildSrc/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
`java-gradle-plugin`
44
`kotlin-dsl`
55
`jvm-test-suite`
6-
id("com.diffplug.spotless") version "6.13.0"
6+
id("com.diffplug.spotless") version "8.1.0"
77
}
88

99
java {

buildSrc/call-site-instrumentation-plugin/build.gradle.kts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
22
java
33
groovy
4-
id("com.diffplug.spotless") version "6.13.0"
4+
id("com.diffplug.spotless") version "8.1.0"
55
id("com.gradleup.shadow") version "8.3.6"
66
}
77

@@ -17,8 +17,7 @@ spotless {
1717
target("src/**/*.java")
1818
// ignore embedded test projects
1919
targetExclude("src/test/resources/**")
20-
// This is the last Google Java Format version that supports Java 8
21-
googleJavaFormat("1.7")
20+
googleJavaFormat("1.32.0")
2221
}
2322
}
2423

@@ -38,7 +37,7 @@ dependencies {
3837
testImplementation(libs.groovy)
3938
testImplementation(libs.bundles.spock)
4039
testImplementation("javax.servlet", "javax.servlet-api", "3.0.1")
41-
testImplementation("com.github.spotbugs", "spotbugs-annotations", "4.2.0")
40+
testImplementation(libs.spotbugs.annotations)
4241
}
4342

4443
sourceSets {

buildSrc/src/main/kotlin/datadog/gradle/plugin/config/ConfigInversionLinter.kt

Lines changed: 54 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,40 @@ class ConfigInversionLinter : Plugin<Project> {
2626
}
2727
}
2828

29+
// Data class for fields from generated class
30+
private data class LoadedConfigFields(
31+
val supported: Set<String>,
32+
val aliasMapping: Map<String, String> = emptyMap()
33+
)
34+
35+
// Cache for fields from generated class
36+
private var cachedConfigFields: LoadedConfigFields? = null
37+
38+
// Helper function to load fields from the generated class
39+
private fun loadConfigFields(
40+
mainSourceSetOutput: org.gradle.api.file.FileCollection,
41+
generatedClassName: String
42+
): LoadedConfigFields {
43+
return cachedConfigFields ?: run {
44+
val urls = mainSourceSetOutput.files.map { it.toURI().toURL() }.toTypedArray()
45+
URLClassLoader(urls, LoadedConfigFields::class.java.classLoader).use { cl ->
46+
val clazz = Class.forName(generatedClassName, true, cl)
47+
48+
val supportedField = clazz.getField("SUPPORTED").get(null)
49+
@Suppress("UNCHECKED_CAST")
50+
val supportedSet = when (supportedField) {
51+
is Set<*> -> supportedField as Set<String>
52+
is Map<*, *> -> supportedField.keys as Set<String>
53+
else -> throw IllegalStateException("SUPPORTED field must be either Set<String> or Map<String, Any>, but was ${supportedField?.javaClass}")
54+
}
55+
56+
@Suppress("UNCHECKED_CAST")
57+
val aliasMappingMap = clazz.getField("ALIAS_MAPPING").get(null) as Map<String, String>
58+
LoadedConfigFields(supportedSet, aliasMappingMap)
59+
}.also { cachedConfigFields = it }
60+
}
61+
}
62+
2963
/** Registers `logEnvVarUsages` (scan for DD_/OTEL_ tokens and fail if unsupported). */
3064
private fun registerLogEnvVarUsages(target: Project, extension: SupportedTracerConfigurations) {
3165
val ownerPath = extension.configOwnerPath
@@ -52,16 +86,11 @@ private fun registerLogEnvVarUsages(target: Project, extension: SupportedTracerC
5286
inputs.files(javaFiles)
5387
outputs.upToDateWhen { true }
5488
doLast {
55-
// 1) Build classloader from the owner project’s runtime classpath
56-
val urls = mainSourceSetOutput.get().get().files.map { it.toURI().toURL() }.toTypedArray()
57-
val supported: Set<String> = URLClassLoader(urls, javaClass.classLoader).use { cl ->
58-
// 2) Load the generated class + read static field
59-
val clazz = Class.forName(generatedFile.get(), true, cl)
60-
@Suppress("UNCHECKED_CAST")
61-
clazz.getField("SUPPORTED").get(null) as Set<String>
62-
}
89+
// 1) Load configuration fields from the generated class
90+
val configFields = loadConfigFields(mainSourceSetOutput.get().get(), generatedFile.get())
91+
val supported = configFields.supported
6392

64-
// 3) Scan our sources and compare
93+
// 2) Scan our sources and compare
6594
val repoRoot = target.projectDir.toPath()
6695
val tokenRegex = Regex("\"(?:DD_|OTEL_)[A-Za-z0-9_]+\"")
6796

@@ -79,7 +108,7 @@ private fun registerLogEnvVarUsages(target: Project, extension: SupportedTracerC
79108
}
80109
tokenRegex.findAll(raw).forEach { m ->
81110
val token = m.value.trim('"')
82-
if (token !in supported) add("$rel:${i + 1} -> Unsupported token'$token'")
111+
if (token !in supported) add("$rel:${i + 1} -> Unsupported token '$token'")
83112
}
84113
}
85114
}
@@ -167,15 +196,9 @@ private fun registerCheckConfigStringsTask(project: Project, extension: Supporte
167196
throw GradleException("Config directory not found: ${configDir.absolutePath}")
168197
}
169198

170-
val urls = mainSourceSetOutput.get().get().files.map { it.toURI().toURL() }.toTypedArray()
171-
val (supported, aliasMapping) = URLClassLoader(urls, javaClass.classLoader).use { cl ->
172-
val clazz = Class.forName(generatedFile.get(), true, cl)
173-
@Suppress("UNCHECKED_CAST")
174-
val supportedSet = clazz.getField("SUPPORTED").get(null) as Set<String>
175-
@Suppress("UNCHECKED_CAST")
176-
val aliasMappingMap = clazz.getField("ALIAS_MAPPING").get(null) as Map<String, String>
177-
Pair(supportedSet, aliasMappingMap)
178-
}
199+
val configFields = loadConfigFields(mainSourceSetOutput.get().get(), generatedFile.get())
200+
val supported = configFields.supported
201+
val aliasMapping = configFields.aliasMapping
179202

180203
var parserConfig = ParserConfiguration()
181204
parserConfig.setLanguageLevel(ParserConfiguration.LanguageLevel.JAVA_8)
@@ -192,23 +215,23 @@ private fun registerCheckConfigStringsTask(project: Project, extension: Supporte
192215
.map { it as? FieldDeclaration }
193216
.ifPresent { field ->
194217
if (field.hasModifiers(Modifier.Keyword.PUBLIC, Modifier.Keyword.STATIC, Modifier.Keyword.FINAL) &&
195-
varDecl.typeAsString == "String") {
218+
varDecl.typeAsString == "String") {
196219

197-
val fieldName = varDecl.nameAsString
198-
if (fieldName.endsWith("_DEFAULT")) return@ifPresent
199-
val init = varDecl.initializer.orElse(null) ?: return@ifPresent
220+
val fieldName = varDecl.nameAsString
221+
if (fieldName.endsWith("_DEFAULT")) return@ifPresent
222+
val init = varDecl.initializer.orElse(null) ?: return@ifPresent
200223

201-
if (init !is StringLiteralExpr) return@ifPresent
202-
val rawValue = init.value
224+
if (init !is StringLiteralExpr) return@ifPresent
225+
val rawValue = init.value
203226

204-
val normalized = normalize(rawValue)
205-
if (normalized !in supported && normalized !in aliasMapping) {
206-
val line = varDecl.range.map { it.begin.line }.orElse(1)
207-
add("$fileName:$line -> Config '$rawValue' normalizes to '$normalized' " +
208-
"which is missing from '${extension.jsonFile.get()}'")
227+
val normalized = normalize(rawValue)
228+
if (normalized !in supported && normalized !in aliasMapping) {
229+
val line = varDecl.range.map { it.begin.line }.orElse(1)
230+
add("$fileName:$line -> Config '$rawValue' normalizes to '$normalized' " +
231+
"which is missing from '${extension.jsonFile.get()}'")
232+
}
209233
}
210234
}
211-
}
212235
}
213236
}
214237
}

buildSrc/src/main/kotlin/datadog/gradle/plugin/testJvmConstraints/TestJvmSpec.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class TestJvmSpec(val project: Project) {
5656
"stable" -> {
5757
val javaVersions = project.providers.environmentVariablesPrefixedBy("JAVA_").map { javaHomes ->
5858
javaHomes
59-
.filter { it.key.matches(Regex("^JAVA_[0-9]+_HOME$")) }
59+
.filter { it.key.matches(Regex("^JAVA_[0-9]+_HOME$")) && it.key != "JAVA_26_HOME" } // JDK 26 is EA
6060
.map { Regex("^JAVA_(\\d+)_HOME$").find(it.key)!!.groupValues[1].toInt() }
6161
}.get()
6262

communication/gradle.lockfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ io.leangen.geantyref:geantyref:1.3.16=testRuntimeClasspath
4747
jaxen:jaxen:1.2.0=spotbugs
4848
jline:jline:2.14.6=testRuntimeClasspath
4949
junit:junit:4.13.2=testCompileClasspath,testRuntimeClasspath
50-
net.bytebuddy:byte-buddy-agent:1.17.7=testCompileClasspath,testRuntimeClasspath
51-
net.bytebuddy:byte-buddy:1.17.7=testCompileClasspath,testRuntimeClasspath
50+
net.bytebuddy:byte-buddy-agent:1.18.1=testCompileClasspath,testRuntimeClasspath
51+
net.bytebuddy:byte-buddy:1.18.1=testCompileClasspath,testRuntimeClasspath
5252
net.jcip:jcip-annotations:1.0=compileClasspath,spotbugs,testCompileClasspath,testRuntimeClasspath
5353
net.sf.saxon:Saxon-HE:11.4=spotbugs
5454
org.apache.ant:ant-antlr:1.10.14=codenarc

0 commit comments

Comments
 (0)