Skip to content

Commit 76c6260

Browse files
committed
Merge branch 'master' into sarahchen6/test-graalvm25
2 parents 7b74fad + 5e2a9e4 commit 76c6260

File tree

91 files changed

+1446
-1124
lines changed

Some content is hidden

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

91 files changed

+1446
-1124
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@
2828
/internal-api/src/test/groovy/datadog/trace/api/sampling @DataDog/apm-sdk-api-java
2929

3030
# @DataDog/apm-serverless
31-
/dd-trace-core/src/main/java/datadog/trace/lambda/ @DataDog/apm-serverless
32-
/dd-trace-core/src/test/groovy/datadog/trace/lambda/ @DataDog/apm-serverless
31+
/dd-trace-core/src/main/java/datadog/trace/lambda/ @DataDog/apm-serverless
32+
/dd-trace-core/src/test/groovy/datadog/trace/lambda/ @DataDog/apm-serverless
33+
**/InferredProxy*.java @DataDog/apm-serverless
34+
**/InferredProxy*.groovy @DataDog/apm-serverless
3335

3436
# @DataDog/apm-lang-platform-java
3537
/.circleci/ @DataDog/apm-lang-platform-java

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@ name: Run system tests
33
on:
44
pull_request:
55
workflow_dispatch:
6+
schedule:
7+
- cron: 0 4 * * *
8+
push:
9+
branches:
10+
- master
611

712
# Cancel long-running jobs when a new commit is pushed
813
concurrency:
9-
group: ${{ github.workflow }}-${{ github.ref }}
14+
# this ensures that only one workflow runs at a time for a given branch on pull requests
15+
# as the group key is the workflow name and the branch name
16+
# for scheduled runs and pushes to master, we use the run id to ensure that all runs are executed
17+
group: ${{ (github.event_name == 'pull_request' && format('{0}-{1}', github.workflow, github.ref)) || format('{0}-{1}', github.workflow, github.run_id) }}
1018
cancel-in-progress: true
1119

1220
jobs:

.github/workflows/update-gradle-dependencies.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
GH_ADD_ARGS=""
4949
COUNT=0
5050
BRANCH_HEAD=$(git rev-parse HEAD)
51-
for lockfile in $(git status --porcelain=v1 | awk '{ print $NF }'); do
51+
for lockfile in $(git status --porcelain=v1 -- ':(glob)**/gradle.lockfile' | awk '{ print $NF }'); do
5252
echo "Found lockfile: $lockfile"
5353
GH_ADD_ARGS="$GH_ADD_ARGS --add $lockfile"
5454
COUNT=$((COUNT+1))

.gitlab/macrobenchmarks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,4 @@ notify-slo-breaches:
142142
when: never
143143
- when: always
144144
variables:
145-
CHANNEL: "apm-release-platform"
145+
CHANNEL: "apm-java"

boolean-conversion-proposal.md

Lines changed: 0 additions & 139 deletions
This file was deleted.

buildSrc/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ testing {
7676
val integTest by registering(JvmTestSuite::class) {
7777
dependencies {
7878
implementation(gradleTestKit())
79-
implementation("org.assertj:assertj-core:3.25.3")
8079
}
8180
// Makes the gradle plugin publish its declared plugins to this source set
8281
gradlePlugin.testSourceSet(sources)

buildSrc/src/integTest/kotlin/datadog/gradle/plugin/version/TracerVersionIntegrationTest.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
package datadog.gradle.plugin.version
22

3-
import org.assertj.core.api.Assertions.assertThat
43
import org.gradle.testkit.runner.GradleRunner
5-
import org.junit.jupiter.api.Disabled
4+
import org.junit.jupiter.api.Assertions.assertEquals
65
import org.junit.jupiter.api.Test
7-
import org.junit.jupiter.api.io.CleanupMode
86
import org.junit.jupiter.api.io.TempDir
97
import java.io.File
108
import java.io.IOException
@@ -289,7 +287,7 @@ class TracerVersionIntegrationTest {
289287
// .withDebug(true)
290288
.build()
291289

292-
assertThat(buildResult.output).isEqualToIgnoringNewLines(expectedVersion)
290+
assertEquals(expectedVersion, buildResult.output.lines().first())
293291
}
294292

295293
private fun exec(workingDirectory: File, vararg args: String) {

communication/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ dependencies {
2323

2424
testImplementation(project(":utils:test-utils"))
2525
testImplementation(libs.bundles.junit5)
26-
testImplementation(libs.truth)
2726
testImplementation(libs.bytebuddy)
2827
testImplementation("org.msgpack:msgpack-core:0.8.20")
2928
testImplementation("org.msgpack:jackson-dataformat-msgpack:0.8.20")
Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,34 @@
11
package datadog.communication.http
22

3-
import com.google.common.truth.Truth
43
import okhttp3.Request
5-
import org.junit.jupiter.api.Assertions
64
import org.junit.jupiter.api.Test
75

6+
import static org.junit.jupiter.api.Assertions.assertFalse
7+
import static org.junit.jupiter.api.Assertions.assertThrows
8+
import static org.junit.jupiter.api.Assertions.assertTrue
9+
810
class SafeRequestBuilderTest {
911
Request.Builder testBuilder = new Request.Builder()
1012

1113
@Test
1214
void "test adding bad header"() {
1315
def name = 'bad'
1416
def password = 'very-secret-password'
15-
IllegalArgumentException ex = Assertions.assertThrows(IllegalArgumentException, {
17+
IllegalArgumentException ex = assertThrows(IllegalArgumentException, {
1618
testBuilder.url("http:localhost").addHeader(name, "$password\n")
1719
})
18-
Truth.assertThat(ex).hasMessageThat().contains(name)
19-
Truth.assertThat(ex).hasMessageThat().doesNotContain(password)
20+
assertTrue(ex.getMessage().contains(name))
21+
assertFalse(ex.getMessage().contains(password))
2022
}
23+
2124
@Test
2225
void "test adding bad header2"(){
2326
def name = '\u0019'
2427
def password = 'very-secret-password'
25-
IllegalArgumentException ex = Assertions.assertThrows(IllegalArgumentException, {
28+
IllegalArgumentException ex = assertThrows(IllegalArgumentException, {
2629
testBuilder.url("http:localhost").addHeader(name, "\u0080$password")
2730
})
28-
Truth.assertThat(ex).hasMessageThat().contains(name)
29-
Truth.assertThat(ex).hasMessageThat().doesNotContain(password)
31+
assertTrue(ex.getMessage().contains(name))
32+
assertFalse(ex.getMessage().contains(password))
3033
}
3134
}

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/HttpServerDecorator.java

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import datadog.trace.api.gateway.Flow;
2121
import datadog.trace.api.gateway.Flow.Action.RequestBlockingAction;
2222
import datadog.trace.api.gateway.IGSpanInfo;
23+
import datadog.trace.api.gateway.InferredProxySpan;
2324
import datadog.trace.api.gateway.RequestContext;
2425
import datadog.trace.api.gateway.RequestContextSlot;
2526
import datadog.trace.api.naming.SpanNaming;
@@ -147,21 +148,32 @@ public Context startSpan(REQUEST_CARRIER carrier, Context parentContext) {
147148
instrumentationNames != null && instrumentationNames.length > 0
148149
? instrumentationNames[0]
149150
: DEFAULT_INSTRUMENTATION_NAME;
150-
AgentSpanContext.Extracted extracted =
151-
callIGCallbackStart(getExtractedSpanContext(parentContext));
151+
AgentSpanContext extracted = getExtractedSpanContext(parentContext);
152+
// Call IG callbacks
153+
extracted = callIGCallbackStart(extracted);
154+
// Create gateway inferred span if needed
155+
extracted = startInferredProxySpan(parentContext, extracted);
152156
AgentSpan span =
153157
tracer().startSpan(instrumentationName, spanName(), extracted).setMeasured(true);
158+
// Apply RequestBlockingAction if any
154159
Flow<Void> flow = callIGCallbackRequestHeaders(span, carrier);
155160
if (flow.getAction() instanceof RequestBlockingAction) {
156161
span.setRequestBlockingAction((RequestBlockingAction) flow.getAction());
157162
}
158-
AgentPropagation.ContextVisitor<REQUEST_CARRIER> getter = getter();
159-
if (null != carrier && null != getter) {
160-
tracer().getDataStreamsMonitoring().setCheckpoint(span, forHttpServer());
161-
}
163+
// DSM Checkpoint
164+
tracer().getDataStreamsMonitoring().setCheckpoint(span, forHttpServer());
162165
return parentContext.with(span);
163166
}
164167

168+
protected AgentSpanContext startInferredProxySpan(Context context, AgentSpanContext extracted) {
169+
InferredProxySpan span;
170+
if (!Config.get().isInferredProxyPropagationEnabled()
171+
|| (span = InferredProxySpan.fromContext(context)) == null) {
172+
return extracted;
173+
}
174+
return span.start(extracted);
175+
}
176+
165177
public AgentSpan onRequest(
166178
final AgentSpan span,
167179
final CONNECTION connection,
@@ -390,8 +402,7 @@ public AgentSpan onResponse(final AgentSpan span, final RESPONSE response) {
390402
return span;
391403
}
392404

393-
private AgentSpanContext.Extracted callIGCallbackStart(
394-
@Nullable final AgentSpanContext.Extracted extracted) {
405+
private AgentSpanContext callIGCallbackStart(@Nullable final AgentSpanContext extracted) {
395406
AgentTracer.TracerAPI tracer = tracer();
396407
Supplier<Flow<Object>> startedCbAppSec =
397408
tracer.getCallbackProvider(RequestContextSlot.APPSEC).getCallback(EVENTS.requestStarted());
@@ -527,10 +538,20 @@ private Flow<Void> callIGCallbackURI(
527538

528539
@Override
529540
public AgentSpan beforeFinish(AgentSpan span) {
541+
// TODO Migrate beforeFinish to Context API
530542
onRequestEndForInstrumentationGateway(span);
543+
// Close Serverless Gateway Inferred Span if any
544+
// finishInferredProxySpan(context);
531545
return super.beforeFinish(span);
532546
}
533547

548+
protected void finishInferredProxySpan(Context context) {
549+
InferredProxySpan span;
550+
if ((span = InferredProxySpan.fromContext(context)) != null) {
551+
span.finish();
552+
}
553+
}
554+
534555
private void onRequestEndForInstrumentationGateway(@Nonnull final AgentSpan span) {
535556
if (span.getLocalRootSpan() != span) {
536557
return;

0 commit comments

Comments
 (0)