Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,12 @@ spotless:
extends: .gradle_build
stage: tests
needs: []
variables:
# TODO: Latest version of spotless is failing with OOM on CI only.
# Setting 8G memory solving this issue, but we need to solve it eventually.
GRADLE_MEM: 8G
KUBERNETES_MEMORY_REQUEST: 18Gi
KUBERNETES_MEMORY_LIMIT: 18Gi
script:
- ./gradlew --version
- ./gradlew spotlessCheck $GRADLE_ARGS
Expand Down
14 changes: 8 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
id("config-inversion-linter")
id("datadog.ci-jobs")

id("com.diffplug.spotless") version "6.13.0"
id("com.diffplug.spotless") version "8.0.0"
id("com.github.spotbugs") version "6.4.5"
id("de.thetaphi.forbiddenapis") version "3.10"
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
Expand All @@ -36,7 +36,7 @@ with(extensions["spotlessPredeclare"] as SpotlessExtension) {
removeUnusedImports()

// This is the last Google Java Format version that supports Java 8
googleJavaFormat("1.7")
googleJavaFormat("1.32.0")
}
groovyGradle {
greclipse()
Expand All @@ -45,13 +45,14 @@ with(extensions["spotlessPredeclare"] as SpotlessExtension) {
greclipse()
}
kotlinGradle {
ktlint("0.41.0")
ktlint("1.8.0")
}
kotlin {
ktlint("0.41.0")
ktlint("1.8.0")
}
scala {
scalafmt("2.7.5")
// TODO: For some reason Scala format is working correctly with this version only.
scalafmt("3.8.6")
}
}
apply(from = rootDir.resolve("gradle/spotless.gradle"))
Expand Down Expand Up @@ -145,7 +146,8 @@ 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",
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
5 changes: 2 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 @@ -17,8 +17,7 @@ spotless {
target("src/**/*.java")
// 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.32.0")
}
}

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 @@ -73,5 +73,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 @@ -1478,7 +1478,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 @@ -1508,7 +1510,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 @@ -1546,7 +1550,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 @@ -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 @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ private String sanitizeWorkspace(String workspace) {
: (realCiWorkspace.substring(0, realCiWorkspace.length() - 1));
}

/** @return Workspace path without the trailing separator */
/**
* @return Workspace path without the trailing separator
*/
public String getCiWorkspace() {
return ciWorkspace;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public interface Codeowners {
@Nullable
Collection<String> getOwners(@Nonnull String path);

/** @return {@code true} if {@code CODEOWNERS} file could be located and parsed */
/**
* @return {@code true} if {@code CODEOWNERS} file could be located and parsed
*/
boolean exist();
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ public ExecutionSettingsFactoryImpl(
this.repositoryRoot = repositoryRoot;
}

/** @return Executions settings by module name */
/**
* @return Executions settings by module name
*/
public Map<String, ExecutionSettings> create(@Nonnull JvmInfo jvmInfo) {
TracerEnvironment tracerEnvironment = buildTracerEnvironment(jvmInfo, null);
return create(tracerEnvironment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import javax.annotation.Nullable;

public interface PackageResolver {
/** @return the package path or <code>null</code> if the file is in the default package */
/**
* @return the package path or <code>null</code> if the file is in the default package
*/
@Nullable
Path getPackage(Path sourceFile) throws IOException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class CiVisibilityMetricCollectorImpl implements CiVisibilityMetricCollec
private final BlockingQueue<CiVisibilityMetricData> rawMetricsQueue;
private final BlockingQueue<DistributionSeriesPoint> rawDistributionPointsQueue;
private final AtomicLongArray counters;

/**
* Cards are used to avoid iterating over the entire {@link
* CiVisibilityMetricCollectorImpl#counters} array every time {@link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ class CiVisibilityMetricCollectorTest extends Specification {
def metricTags = metric.getTags()

int cartesianProductSizeLimit = 20 // limiting the number of combinations to avoid OOM/timeout
for (TagValue[] tags : cartesianProduct(metricTags, cartesianProductSizeLimit)) { // iterate over combinations of metric tags
for (TagValue[] tags : cartesianProduct(metricTags, cartesianProductSizeLimit)) {
// iterate over combinations of metric tags
possibleMetrics += new PossibleMetric(metric, tags)
}
}
Expand Down Expand Up @@ -231,5 +232,4 @@ class CiVisibilityMetricCollectorTest extends Specification {
this.tags = tags
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ public static boolean checkAndSetInProbe() {
IN_PROBE.set(Boolean.TRUE);
return true;
}

/**
* resolve probe details based on probe ids and evaluate the captured context regarding summary &
* conditions. This is for method probes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ public int getVersion() {
return version;
}

/** @return the encoded id as a string with format uuid:version */
/**
* @return the encoded id as a string with format uuid:version
*/
public String getEncodedId() {
return encoded;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class ReflectiveFieldValueResolver {
}
TRY_SET_ACCESSIBLE = methodHandle;
}

// We cannot create a Field instance from scratch to be used as special constant,
// so need to reflectively access itself
private static final Field INACCESSIBLE_FIELD;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ public static boolean isToStringSafe(String concreteType) {
return SAFE_TO_STRING_FUNCTIONS.containsKey(concreteType);
}

/** @return true if collection implementation is safe to call (only in-memory) */
/**
* @return true if collection implementation is safe to call (only in-memory)
*/
public static boolean isSafe(Collection<?> collection) {
String className = collection.getClass().getTypeName();
for (String safePackage : SAFE_COLLECTION_PACKAGES) {
Expand All @@ -232,7 +234,9 @@ public static boolean isSafe(Collection<?> collection) {
return false;
}

/** @return true if map implementation is safe to call (only in-memory) */
/**
* @return true if map implementation is safe to call (only in-memory)
*/
public static boolean isSafe(Map<?, ?> map) {
String className = map.getClass().getTypeName();
for (String safePackage : SAFE_MAP_PACKAGES) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

public class StringTemplateBuilder {
private static final Logger LOGGER = LoggerFactory.getLogger(StringTemplateBuilder.class);

/**
* Serialization limits for log messages. Most values are lower than snapshot because you can
* directly reference values that are in your interest with Expression Language:
Expand Down
Loading