Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
cb81424
build: Enforce a JDK 21 to run Gradle
bric3 Sep 12, 2025
ca82eea
fix: SpotBugs needs 6.4.2 to run after JDK11, relax forbiddenApis on …
bric3 Sep 18, 2025
88ef442
fix: Try fixing spotted bugs
bric3 Sep 19, 2025
9510177
Merge branch 'bdu/test-decoupling-on-jdk21' into bdu/spotbugs-bump-ne…
AlexeyKuznetsov-DD Oct 22, 2025
095d027
Merged with master.
AlexeyKuznetsov-DD Oct 23, 2025
aae1e80
Made latest SpotBugs passing.
AlexeyKuznetsov-DD Oct 23, 2025
e4a8703
Cleanup classpath to resolve JUnit5 versions conflict.
AlexeyKuznetsov-DD Oct 24, 2025
261aea6
Cleanup classpath to resolve JUnit5 versions conflict.
AlexeyKuznetsov-DD Oct 24, 2025
b5f246e
Exclude logback.
AlexeyKuznetsov-DD Oct 24, 2025
03ac8e4
Merge branch 'master' into bdu/spotbugs-bump-need-jdk11-min
AlexeyKuznetsov-DD Oct 27, 2025
308bca2
Fixed failed log4j test.
AlexeyKuznetsov-DD Oct 27, 2025
9aa1611
Bump spotless
AlexeyKuznetsov-DD Oct 27, 2025
84c5e2d
Merge branch 'master' into alexeyk/spotless-attempt-2
AlexeyKuznetsov-DD Oct 27, 2025
ce287ac
Merge branch 'master' into alexeyk/spotless-attempt-2
AlexeyKuznetsov-DD Oct 27, 2025
34720dc
Latest spotless applied
AlexeyKuznetsov-DD Oct 27, 2025
48eff12
Fixing spotless build.
AlexeyKuznetsov-DD Oct 28, 2025
4115021
Fixing spotless build.
AlexeyKuznetsov-DD Oct 28, 2025
12489c2
attempt to collect dump
AlexeyKuznetsov-DD Oct 28, 2025
01d4356
Fixing build
AlexeyKuznetsov-DD Oct 28, 2025
6157b5c
Fixing build
AlexeyKuznetsov-DD Oct 29, 2025
7105b24
Fixing build.
AlexeyKuznetsov-DD Oct 29, 2025
6c37015
Fixed build
AlexeyKuznetsov-DD Oct 29, 2025
d0a4248
Merge branch 'master' into alexeyk/spotless-attempt-2
AlexeyKuznetsov-DD Oct 29, 2025
a27b7bf
merged
AlexeyKuznetsov-DD Oct 29, 2025
c8d5fd3
merged
AlexeyKuznetsov-DD Oct 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,16 @@ spotless:
script:
- ./gradlew --version
- ./gradlew spotlessCheck $GRADLE_ARGS
after_script:
- *cgroup_info
- source .gitlab/gitlab-utils.sh
- gitlab_section_start "collect-reports" "Collecting reports"
- .gitlab/collect_reports.sh
- gitlab_section_end "collect-reports"
artifacts:
when: always
paths:
- ./check_reports

test_published_artifacts:
extends: .gradle_build
Expand Down
1 change: 1 addition & 0 deletions .gitlab/collect_reports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ cp /tmp/java_pid*.hprof $REPORTS_DIR 2>/dev/null || true
cp /tmp/javacore.* $REPORTS_DIR 2>/dev/null || true
cp /tmp/*.trc $REPORTS_DIR 2>/dev/null || true
cp /tmp/*.dmp $REPORTS_DIR 2>/dev/null || true
cp /tmp/*.hprof $REPORTS_DIR 2>/dev/null || true
cp /tmp/dd-profiler/*.jfr $REPORTS_DIR 2>/dev/null || true

function process_reports () {
Expand Down
64 changes: 38 additions & 26 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ plugins {
id("datadog.dump-hanged-test")
id("datadog.ci-jobs")

id("com.diffplug.spotless") version "6.13.0"
id("com.github.spotbugs") version "5.0.14"
id("de.thetaphi.forbiddenapis") version "3.8"
id("com.diffplug.spotless") version "8.0.0"
id("com.github.spotbugs") version "6.4.4"
id("de.thetaphi.forbiddenapis") version "3.10"
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
id("com.gradleup.shadow") version "8.3.6" apply false
id("me.champeau.jmh") version "0.7.3" apply false
Expand All @@ -35,7 +35,7 @@ with(extensions["spotlessPredeclare"] as SpotlessExtension) {
removeUnusedImports()

// This is the last Google Java Format version that supports Java 8
googleJavaFormat("1.7")
googleJavaFormat("1.29.0")
}
groovyGradle {
greclipse()
Expand All @@ -44,13 +44,13 @@ with(extensions["spotlessPredeclare"] as SpotlessExtension) {
greclipse()
}
kotlinGradle {
ktlint("0.41.0")
ktlint("1.7.1")
}
kotlin {
ktlint("0.41.0")
ktlint("1.7.1")
}
scala {
scalafmt("2.7.5")
scalafmt("3.9.10")
}
}
apply(from = rootDir.resolve("gradle/spotless.gradle"))
Expand All @@ -61,13 +61,15 @@ allprojects {
group = "com.datadoghq"

if (isCI.isPresent) {
layout.buildDirectory = providers.provider {
val newProjectCIPath = projectDir.path.replace(
rootDir.path,
""
)
rootDir.resolve("workspace/$newProjectCIPath/build/")
}
layout.buildDirectory =
providers.provider {
val newProjectCIPath =
projectDir.path.replace(
rootDir.path,
"",
)
rootDir.resolve("workspace/$newProjectCIPath/build/")
}
}

apply(from = rootDir.resolve("gradle/dependencies.gradle"))
Expand All @@ -84,7 +86,7 @@ allprojects {
jvmArgs(
"-XX:ErrorFile=/tmp/hs_err_pid%p.log",
"-XX:+HeapDumpOnOutOfMemoryError",
"-XX:HeapDumpPath=/tmp"
"-XX:HeapDumpPath=/tmp",
)
}
}
Expand Down Expand Up @@ -123,15 +125,24 @@ nexusPublishing {
}
}

val writeMainVersionFileTask = tasks.register("writeMainVersionFile") {
val versionFile = rootProject.layout.buildDirectory.file("main.version")
inputs.property("version", project.version)
outputs.file(versionFile)
doFirst {
require(versionFile.get().asFile.parentFile.mkdirs() || versionFile.get().asFile.parentFile.isDirectory)
versionFile.get().asFile.writeText(project.version.toString())
val writeMainVersionFileTask =
tasks.register("writeMainVersionFile") {
val versionFile = rootProject.layout.buildDirectory.file("main.version")
inputs.property("version", project.version)
outputs.file(versionFile)
doFirst {
require(
versionFile
.get()
.asFile.parentFile
.mkdirs() ||
versionFile
.get()
.asFile.parentFile.isDirectory,
)
versionFile.get().asFile.writeText(project.version.toString())
}
}
}

allprojects {
tasks.withType<PublishToMavenLocal>().configureEach {
Expand All @@ -144,11 +155,12 @@ testAggregate("instrumentation", listOf(":dd-java-agent:instrumentation"), empty
testAggregate("profiling", listOf(":dd-java-agent:agent-profiling"), emptyList())
testAggregate("debugger", listOf(":dd-java-agent:agent-debugger"), forceCoverage = true)
testAggregate(
"base", listOf(":"),
"base",
listOf(":"),
listOf(
":dd-java-agent:instrumentation",
":dd-smoke-tests",
":dd-java-agent:agent-profiling",
":dd-java-agent:agent-debugger"
)
":dd-java-agent:agent-debugger",
),
)
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
`java-gradle-plugin`
`kotlin-dsl`
`jvm-test-suite`
id("com.diffplug.spotless") version "6.13.0"
id("com.diffplug.spotless") version "8.0.0"
}

java {
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/call-site-instrumentation-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
java
groovy
id("com.diffplug.spotless") version "6.13.0"
id("com.diffplug.spotless") version "8.0.0"
id("com.gradleup.shadow") version "8.3.6"
}

Expand All @@ -18,7 +18,7 @@ spotless {
// ignore embedded test projects
targetExclude("src/test/resources/**")
// This is the last Google Java Format version that supports Java 8
googleJavaFormat("1.7")
googleJavaFormat("1.29.0")
}
}

Expand All @@ -39,7 +39,7 @@ dependencies {
testImplementation("org.objenesis", "objenesis", "3.0.1")
testImplementation(libs.groovy)
testImplementation("javax.servlet", "javax.servlet-api", "3.0.1")
testImplementation("com.github.spotbugs", "spotbugs-annotations", "4.2.0")
testImplementation(libs.spotbugs.annotations)
}

sourceSets {
Expand Down
11 changes: 7 additions & 4 deletions communication/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ dependencies {
testImplementation(
group = "com.squareup.okhttp3",
name = "mockwebserver",
version = libs.versions.okhttp.legacy.get() // actually a version range
version =
libs.versions.okhttp.legacy
.get(),
// actually a version range
)
}

Expand Down Expand Up @@ -57,15 +60,15 @@ val excludedClassesCoverage by extra(
"datadog.communication.IntakeApi",
"datadog.communication.util.IOUtils",
"datadog.communication.util.IOUtils.1",
)
),
)
val excludedClassesBranchCoverage by extra(
listOf(
"datadog.communication.ddagent.TracerVersion",
"datadog.communication.BackendApiFactory",
"datadog.communication.EvpProxyApi",
"datadog.communication.IntakeApi",
)
),
)
val excludedClassesInstructionCoverage by extra(
listOf(
Expand All @@ -79,5 +82,5 @@ val excludedClassesInstructionCoverage by extra(
"datadog.communication.IntakeApi",
"datadog.communication.util.IOUtils",
"datadog.communication.util.IOUtils.1",
)
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import datadog.remoteconfig.DefaultConfigurationPoller;
import datadog.trace.api.Config;
import datadog.trace.util.AgentTaskScheduler;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.security.Security;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -31,6 +32,7 @@ public class SharedCommunicationObjects {
* HTTP client for making requests to Datadog agent. Depending on configuration, this client may
* use regular HTTP, UDS or named pipe.
*/
@SuppressFBWarnings("PA_PUBLIC_PRIMITIVE_ATTRIBUTE")
public OkHttpClient agentHttpClient;

/**
Expand All @@ -39,10 +41,18 @@ public class SharedCommunicationObjects {
*/
private volatile OkHttpClient intakeHttpClient;

@SuppressFBWarnings("PA_PUBLIC_PRIMITIVE_ATTRIBUTE")
public long httpClientTimeout;

@SuppressFBWarnings("PA_PUBLIC_PRIMITIVE_ATTRIBUTE")
public boolean forceClearTextHttpForIntakeClient;

@SuppressFBWarnings("PA_PUBLIC_PRIMITIVE_ATTRIBUTE")
public HttpUrl agentUrl;

@SuppressFBWarnings("PA_PUBLIC_PRIMITIVE_ATTRIBUTE")
public Monitoring monitoring;

private volatile DDAgentFeaturesDiscovery featuresDiscovery;
private ConfigurationPoller configurationPoller;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
public final class DDAgentStatsDClientManager implements StatsDClientManager {
private static final DDAgentStatsDClientManager INSTANCE = new DDAgentStatsDClientManager();

private DDAgentStatsDClientManager() {}

private static final boolean USE_LOGGING_CLIENT =
LOGGING_WRITER_TYPE.equals(Config.get().getWriterType());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
*/
public final class ContextKey<T> {
private static final AtomicInteger NEXT_INDEX = new AtomicInteger(0);

/** The key name, for debugging purpose only. */
private final String name;

/** The key unique context, related to {@link IndexedContext} implementation. */
final int index;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
public class Concern {
/** The concern default priority. */
public static final int DEFAULT_PRIORITY = 100;

/** The concern name, for debugging purpose only. */
private final String name;

/** The concern priority, lower value means higher priority. */
private final int priority;

Expand Down
1 change: 0 additions & 1 deletion dd-java-agent/agent-bootstrap/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,4 @@ tasks.withType(Test).configureEach {
JavaVersion.VERSION_16,
['--add-opens', 'java.base/java.net=ALL-UNNAMED'] // for HostNameResolverForkedTest
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import datadog.trace.util.AgentTaskScheduler;
import datadog.trace.util.AgentThreadFactory.AgentThread;
import datadog.trace.util.throwable.FatalAgentMisconfigurationError;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.lang.instrument.Instrumentation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
Expand Down Expand Up @@ -198,6 +199,7 @@ private static void safelySetContextClassLoader(ClassLoader classLoader) {
* <p>The Agent is considered to start successfully if Instrumentation can be activated. All other
* pieces are considered optional.
*/
@SuppressFBWarnings("AT_STALE_THREAD_WRITE_OF_PRIMITIVE")
public static void start(
final Object bootstrapInitTelemetry,
final Instrumentation inst,
Expand Down Expand Up @@ -446,6 +448,7 @@ private static void injectAgentArgsConfig(String agentArgs) {
}
}

@SuppressFBWarnings("AT_STALE_THREAD_WRITE_OF_PRIMITIVE")
private static void configureCiVisibility(URL agentJarURL) {
// Retro-compatibility for the old way to configure CI Visibility
if ("true".equals(ddGetProperty("dd.integration.junit.enabled"))
Expand Down Expand Up @@ -1465,7 +1468,9 @@ private static boolean isDebugMode() {
return false;
}

/** @return {@code true} if the agent feature is enabled */
/**
* @return {@code true} if the agent feature is enabled
*/
private static boolean isFeatureEnabled(AgentFeature feature) {
// must be kept in sync with logic from Config!
final String featureConfigKey = feature.getConfigKey();
Expand Down Expand Up @@ -1495,7 +1500,9 @@ private static boolean isFeatureEnabled(AgentFeature feature) {
}
}

/** @see datadog.trace.api.ProductActivation#fromString(String) */
/**
* @see datadog.trace.api.ProductActivation#fromString(String)
*/
private static boolean isFullyDisabled(final AgentFeature feature) {
// must be kept in sync with logic from Config!
final String featureConfigKey = feature.getConfigKey();
Expand Down Expand Up @@ -1533,7 +1540,9 @@ private static String getNullIfEmpty(final String value) {
return value;
}

/** @return configured JMX start delay in seconds */
/**
* @return configured JMX start delay in seconds
*/
private static int getJmxStartDelay() {
String startDelay = ddGetProperty("dd.dogstatsd.start-delay");
if (startDelay == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ static final class BootstrapProxy extends InitializationTelemetry {
// DQH - Decided not to eager access MethodHandles, since exceptions are uncommon
// However, MethodHandles are cached on lookup

/** @param bootstrapInitTelemetry - non-null BootstrapInitializationTelemetry */
/**
* @param bootstrapInitTelemetry - non-null BootstrapInitializationTelemetry
*/
BootstrapProxy(final Object bootstrapInitTelemetry) {
this.bootstrapInitTelemetry = bootstrapInitTelemetry;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public final class InstanceStore<T> {
private static final ClassValue<InstanceStore> classInstanceStore =
GenericClassValue.of(type -> new InstanceStore<>());

/** @return global store of instances with the same common type */
/**
* @return global store of instances with the same common type
*/
@SuppressWarnings("unchecked")
public static <T> InstanceStore<T> of(Class<T> type) {
return classInstanceStore.get(type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static PatchLogger getAnonymousLogger(final String resourceBundleName) {
return SAFE_LOGGER;
}

protected PatchLogger(final String name, final String resourceBundleName) {
private PatchLogger(final String name, final String resourceBundleName) {
// super(name, resourceBundleName);
}

Expand Down
Loading