Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ default:
- export ORG_GRADLE_PROJECT_mavenRepositoryProxy=$MAVEN_REPOSITORY_PROXY
- export ORG_GRADLE_PROJECT_gradlePluginProxy=$GRADLE_PLUGIN_PROXY
- mkdir -p .gradle
- export GRADLE_USER_HOME=$(pwd)/.gradle
# replace maven central part by MAVEN_REPOSITORY_PROXY in .mvn/wrapper/maven-wrapper.properties
- sed -i "s|https://repo.maven.apache.org/maven2/|$MAVEN_REPOSITORY_PROXY|g" .mvn/wrapper/maven-wrapper.properties
- export GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xms$GRADLE_MEM -Xmx$GRADLE_MEM -XX:ErrorFile=/tmp/hs_err_pid%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp'"
Expand Down
57 changes: 34 additions & 23 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ plugins {
id("datadog.tracer-version")
id("datadog.dump-hanged-test")

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 @@ -33,7 +33,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 @@ -42,13 +42,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 @@ -59,13 +59,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 @@ -82,7 +84,7 @@ allprojects {
jvmArgs(
"-XX:ErrorFile=/tmp/hs_err_pid%p.log",
"-XX:+HeapDumpOnOutOfMemoryError",
"-XX:HeapDumpPath=/tmp"
"-XX:HeapDumpPath=/tmp",
)
}
}
Expand Down Expand Up @@ -121,15 +123,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 Down
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("com.github.spotbugs", "spotbugs-annotations", "4.9.8")
}

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 @@ -21,6 +22,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressFBWarnings("PA_PUBLIC_PRIMITIVE_ATTRIBUTE")
public class SharedCommunicationObjects {
private static final Logger log = LoggerFactory.getLogger(SharedCommunicationObjects.class);

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

private DDAgentStatsDClientManager() {
// No-op.
}

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 @@ -1465,7 +1465,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 +1497,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 +1537,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 @@ -17,7 +17,9 @@ public final class InstanceStore<T> implements ContextStore<String, T> {
private static final ClassValue<? super ContextStore<String, ?>> classInstanceStore =
GenericClassValue.of(input -> 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 (InstanceStore<T>) classInstanceStore.get(type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,37 @@
* were not supported prior to Java 8 and will lead to a class verification error.
*/
public class Java8BytecodeBridge {
/** @see Context#root() */
/**
* @see Context#root()
*/
public static Context getRootContext() {
return Context.root();
}

/** @see Context#current() */
/**
* @see Context#current()
*/
public static Context getCurrentContext() {
return Context.current();
}

/** @see Context#from(Object) */
/**
* @see Context#from(Object)
*/
public static Context getContextFrom(Object carrier) {
return Context.from(carrier);
}

/** @see Context#detachFrom(Object) */
/**
* @see Context#detachFrom(Object)
*/
public static Context detachContextFrom(Object carrier) {
return Context.detachFrom(carrier);
}

/** @see AgentSpan#fromContext(Context) */
/**
* @see AgentSpan#fromContext(Context)
*/
public static AgentSpan spanFromContext(Context context) {
return AgentSpan.fromContext(context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import datadog.trace.api.Config;
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayDeque;
import java.util.Collections;
import java.util.Comparator;
Expand Down Expand Up @@ -65,7 +64,6 @@ public int compare(Map.Entry<Thread, TimeInQueue> o1, Map.Entry<Thread, TimeInQu
private volatile int timeInQueueSpanCount = 0;

// this field is protected by synchronization of capturedSpans, but SpotBugs miss that
@SuppressFBWarnings("IS2_INCONSISTENT_SYNC")
private boolean capturingFlipped = false;

public SessionState(int ackMode, boolean timeInQueueEnabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ private boolean checkIfContextCanBePassed(
return result;
}

/** @return {@code true} when no error happened during call */
/**
* @return {@code true} when no error happened during call
*/
private boolean syntheticCall(
final Connection c, final ContextPayload payload, final int operationId) {
final StreamRemoteCall shareContextCall = new StreamRemoteCall(c);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class SafeHasSuperTypeMatcher<T extends TypeDescription>
private final boolean interfacesOnly;
private final boolean rejectInterfaceTargets;
private final boolean checkInterfaces;

/**
* Creates a new matcher for a super type.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ abstract class CiVisibilityTestUtils {
}

static List<TestFQN> getTestIdentifiers(List<Map<?,?>> events) {
events.sort(Comparator.comparing { it['content']['start'] as Long })
events.sort(Comparator.comparing {
it['content']['start'] as Long
})
def testIdentifiers = []
for (Map event : events) {
if (event['content']['meta']['test.name']) {
Expand Down Expand Up @@ -275,7 +277,6 @@ abstract class CiVisibilityTestUtils {
StringWriter coveragesOut = new StringWriter()
coveragesTemplate.process(replacements, coveragesOut)
return coveragesOut.toString()

} catch (Exception e) {
throw new RuntimeException("Could not get Freemarker template " + templatePath + "; replacements map: " + replacements + "; replacements source: " + replacementsSource, e)
}
Expand Down Expand Up @@ -304,7 +305,6 @@ abstract class CiVisibilityTestUtils {
return label.forTemplateKey(dynamicPath.rawPath)
})
}

}
return JSON_MAPPER
.writeValueAsString(objects)
Expand Down
Loading