Skip to content

Commit fe96451

Browse files
committed
Merge branch 'dougqh/interceptor-bypass' of github.com:DataDog/dd-trace-java into dougqh/interceptor-bypass
2 parents 1c0b641 + 96422cf commit fe96451

File tree

80 files changed

+295
-115
lines changed

Some content is hidden

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

80 files changed

+295
-115
lines changed

.circleci/config.continue.yml.j2

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,24 @@ build_test_jobs: &build_test_jobs
13371337
cacheType: smoke
13381338
testJvm: "semeru8"
13391339
1340+
- tests:
1341+
requires:
1342+
- ok_to_test
1343+
name: test_graalvm17_smoke
1344+
gradleTarget: "stageMainDist :dd-smoke-test:quarkus-native:test"
1345+
stage: smoke
1346+
cacheType: smoke
1347+
testJvm: "graalvm17"
1348+
1349+
- tests:
1350+
requires:
1351+
- ok_to_test
1352+
name: test_graalvm21_smoke
1353+
gradleTarget: "stageMainDist :dd-smoke-test:quarkus-native:test"
1354+
stage: smoke
1355+
cacheType: smoke
1356+
testJvm: "graalvm21"
1357+
13401358
- tests:
13411359
requires:
13421360
- ok_to_test

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ plugins {
2222
id 'pl.allegro.tech.build.axion-release' version '1.14.4'
2323
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
2424

25-
id "com.github.johnrengelman.shadow" version "8.1.1" apply false
25+
id "com.gradleup.shadow" version "8.3.6" apply false
2626
id "me.champeau.jmh" version "0.7.0" apply false
2727
id 'org.gradle.playframework' version '0.13' apply false
2828
id 'info.solidsoft.pitest' version '1.9.11' apply false

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
java
55
groovy
66
id("com.diffplug.spotless") version "6.13.0"
7-
id("com.github.johnrengelman.shadow") version "8.1.1"
7+
id("com.gradleup.shadow") version "8.3.6"
88
}
99

1010
java {

dd-java-agent/agent-bootstrap/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// The shadowJar of this project will be injected into the JVM's bootstrap classloader
22
plugins {
3-
id "com.github.johnrengelman.shadow"
3+
id "com.gradleup.shadow"
44
id 'me.champeau.jmh'
55
}
66

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Agent.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,11 @@ public static void start(
184184

185185
if (Platform.isNativeImageBuilder()) {
186186
// these default services are not used during native-image builds
187-
jmxFetchEnabled = false;
188187
remoteConfigEnabled = false;
189188
telemetryEnabled = false;
190-
// apply trace instrumentation, but skip starting other services
189+
// apply trace instrumentation, but skip other products at native-image build time
191190
startDatadogAgent(initTelemetry, inst);
192191
StaticEventLogger.end("Agent.start");
193-
194192
return;
195193
}
196194

dd-java-agent/agent-ci-visibility/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ buildscript {
2323
}
2424

2525
plugins {
26-
id 'com.github.johnrengelman.shadow'
26+
id 'com.gradleup.shadow'
2727
id 'java-test-fixtures'
2828
}
2929

dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/CiVisibilityRepoServices.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import datadog.trace.civisibility.source.index.RepoIndexProvider;
3636
import datadog.trace.civisibility.source.index.RepoIndexSourcePathResolver;
3737
import datadog.trace.util.Strings;
38-
import java.io.File;
3938
import java.nio.file.Path;
4039
import java.nio.file.Paths;
4140
import java.util.Map;
@@ -72,7 +71,7 @@ public class CiVisibilityRepoServices {
7271
LOGGER.info("PR detected: {}", pullRequestInfo);
7372
}
7473

75-
repoRoot = appendSlashIfNeeded(getRepoRoot(ciInfo, services.gitClientFactory));
74+
repoRoot = getRepoRoot(ciInfo, services.gitClientFactory);
7675
moduleName = getModuleName(services.config, repoRoot, path);
7776
ciTags = new CITagsProvider().getCiTags(ciInfo, pullRequestInfo);
7877

@@ -126,7 +125,7 @@ private static PullRequestInfo buildPullRequestInfo(
126125
}
127126

128127
private static String getRepoRoot(CIInfo ciInfo, GitClient.Factory gitClientFactory) {
129-
String ciWorkspace = ciInfo.getNormalizedCiWorkspace();
128+
String ciWorkspace = ciInfo.getCiWorkspace();
130129
if (Strings.isNotBlank(ciWorkspace)) {
131130
return ciWorkspace;
132131

@@ -146,14 +145,6 @@ private static String getRepoRoot(CIInfo ciInfo, GitClient.Factory gitClientFact
146145
}
147146
}
148147

149-
private static String appendSlashIfNeeded(String repoRoot) {
150-
if (repoRoot != null && !repoRoot.endsWith(File.separator)) {
151-
return repoRoot + File.separator;
152-
} else {
153-
return repoRoot;
154-
}
155-
}
156-
157148
static String getModuleName(Config config, @Nullable String repoRoot, Path path) {
158149
// if parent process is instrumented, it will provide build system's module name
159150
String parentModuleName = config.getCiVisibilityModuleName();

dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/ci/CIInfo.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public CIInfo(
170170
this.ciPipelineNumber = ciPipelineNumber;
171171
this.ciPipelineUrl = ciPipelineUrl;
172172
this.ciJobUrl = ciJobUrl;
173-
this.ciWorkspace = ciWorkspace;
173+
this.ciWorkspace = sanitizeWorkspace(ciWorkspace);
174174
this.ciNodeName = ciNodeName;
175175
this.ciNodeLabels = ciNodeLabels;
176176
this.ciEnvVars = ciEnvVars;
@@ -209,20 +209,18 @@ public String getCiJobUrl() {
209209
return ciJobUrl;
210210
}
211211

212-
/**
213-
* @deprecated This method is here only to satisfy CI spec tests. Use {@link
214-
* #getNormalizedCiWorkspace()}
215-
*/
216-
@Deprecated
217-
public String getCiWorkspace() {
218-
return ciWorkspace;
212+
private String sanitizeWorkspace(String workspace) {
213+
String realCiWorkspace = FileUtils.toRealPath(workspace);
214+
return (realCiWorkspace == null
215+
|| !realCiWorkspace.endsWith(File.separator)
216+
|| realCiWorkspace.length() == 1) // root path "/"
217+
? realCiWorkspace
218+
: (realCiWorkspace.substring(0, realCiWorkspace.length() - 1));
219219
}
220220

221-
public String getNormalizedCiWorkspace() {
222-
String realCiWorkspace = FileUtils.toRealPath(ciWorkspace);
223-
return (realCiWorkspace == null || realCiWorkspace.endsWith(File.separator))
224-
? realCiWorkspace
225-
: (realCiWorkspace + File.separator);
221+
/** @return Workspace path without the trailing separator */
222+
public String getCiWorkspace() {
223+
return ciWorkspace;
226224
}
227225

228226
public String getCiNodeName() {

dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/ci/CITagsProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public CITagsProvider() {
2222
}
2323

2424
public Map<String, String> getCiTags(CIInfo ciInfo, PullRequestInfo pullRequestInfo) {
25-
String repoRoot = ciInfo.getNormalizedCiWorkspace();
25+
String repoRoot = ciInfo.getCiWorkspace();
2626
GitInfo gitInfo = gitInfoProvider.getGitInfo(repoRoot);
2727

2828
return new CITagsBuilder()

dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/source/CompilerAidedSourcePathResolver.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package datadog.trace.civisibility.source;
22

33
import datadog.compiler.utils.CompilerUtils;
4+
import java.io.File;
45
import javax.annotation.Nonnull;
56
import javax.annotation.Nullable;
67

@@ -9,7 +10,7 @@ public class CompilerAidedSourcePathResolver implements SourcePathResolver {
910
private final String repoRoot;
1011

1112
public CompilerAidedSourcePathResolver(String repoRoot) {
12-
this.repoRoot = repoRoot;
13+
this.repoRoot = repoRoot.endsWith(File.separator) ? repoRoot : repoRoot + File.separator;
1314
}
1415

1516
@Nullable

0 commit comments

Comments
 (0)