Skip to content

Commit 4a8ee16

Browse files
authored
Merge branch 'master' into mhlidd/implement_config_inversion_ci
2 parents 5976431 + 9329e98 commit 4a8ee16

File tree

16 files changed

+137
-60
lines changed

16 files changed

+137
-60
lines changed

.github/workflows/create-release-branch.yaml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
create-release-branch:
1616
runs-on: ubuntu-latest
1717
permissions:
18-
contents: read
18+
contents: write # Allow pushing the empty release branch
1919
id-token: write # Required for OIDC token federation
2020
steps:
2121
- uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
@@ -45,8 +45,10 @@ jobs:
4545
BRANCH="release/${TAG%.0}.x"
4646
echo "branch=${BRANCH}" >> "$GITHUB_OUTPUT"
4747
48-
- name: Checkout dd-trace-java
48+
- name: Checkout dd-trace-java at tag
4949
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
50+
with:
51+
ref: ${{ github.sha }}
5052

5153
- name: Check if branch already exists
5254
id: check-branch
@@ -60,22 +62,16 @@ jobs:
6062
echo "Branch $BRANCH does not exist - proceeding with following steps"
6163
fi
6264
63-
- name: Push empty release branch
65+
- name: Create and push empty release branch
6466
if: steps.check-branch.outputs.creating_new_branch == 'true'
65-
uses: DataDog/commit-headless@5a0f3876e0fbdd3a86b3e008acf4ec562db59eee # action/v2.0.1
66-
with:
67-
token: "${{ steps.octo-sts.outputs.token }}"
68-
branch: "${{ steps.define-branch.outputs.branch }}"
69-
head-sha: "${{ github.sha }}"
70-
create-branch: true
71-
command: push
67+
run: |
68+
git checkout -b "${{ steps.define-branch.outputs.branch }}"
69+
git push -u origin "${{ steps.define-branch.outputs.branch }}"
7270
7371
- name: Define temp branch name
7472
if: steps.check-branch.outputs.creating_new_branch == 'true'
7573
id: define-temp-branch
76-
run: |
77-
TEMP_BRANCH="${{ steps.define-branch.outputs.branch }}-pin-system-tests"
78-
echo "branch=${TEMP_BRANCH}" >> "$GITHUB_OUTPUT"
74+
run: echo "branch=ci/pin-system-tests-$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
7975

8076
- name: Update system-tests references to latest commit SHA on main
8177
if: steps.check-branch.outputs.creating_new_branch == 'true'

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
env:
2727
ORG_GRADLE_PROJECT_akkaRepositoryToken: ${{ secrets.AKKA_REPO_TOKEN }}
2828
run: |
29+
find . -name 'gradle.lockfile' -delete
2930
GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx3G -Xms2G'" \
3031
JAVA_HOME=$JAVA_HOME_8_X64 \
3132
JAVA_8_HOME=$JAVA_HOME_8_X64 \

dd-java-agent/agent-debugger/debugger-bootstrap/src/main/java/datadog/trace/bootstrap/debugger/CapturedContext.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ public Status evaluate(
297297
ProbeImplementation probeImplementation,
298298
String thisClassName,
299299
long startTimestamp,
300-
MethodLocation methodLocation) {
300+
MethodLocation methodLocation,
301+
boolean singleProbe) {
301302
Status status =
302303
statusByProbeId.computeIfAbsent(
303304
probeImplementation.getProbeId().getEncodedId(),
@@ -311,7 +312,7 @@ public Status evaluate(
311312
boolean shouldEvaluate =
312313
MethodLocation.isSame(methodLocation, probeImplementation.getEvaluateAt());
313314
if (shouldEvaluate) {
314-
probeImplementation.evaluate(this, status, methodLocation);
315+
probeImplementation.evaluate(this, status, methodLocation, singleProbe);
315316
}
316317
return status;
317318
}

dd-java-agent/agent-debugger/debugger-bootstrap/src/main/java/datadog/trace/bootstrap/debugger/DebuggerContext.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,11 @@ public static void evalContext(
311311
}
312312
CapturedContext.Status status =
313313
context.evaluate(
314-
probeImplementation, callingClass.getTypeName(), startTimestamp, methodLocation);
314+
probeImplementation,
315+
callingClass.getTypeName(),
316+
startTimestamp,
317+
methodLocation,
318+
false);
315319
needFreeze |= status.shouldFreezeContext();
316320
}
317321
// only freeze the context when we have at lest one snapshot probe, and we should send
@@ -343,7 +347,11 @@ public static void evalContext(
343347
}
344348
CapturedContext.Status status =
345349
context.evaluate(
346-
probeImplementation, callingClass.getTypeName(), startTimestamp, methodLocation);
350+
probeImplementation,
351+
callingClass.getTypeName(),
352+
startTimestamp,
353+
methodLocation,
354+
true);
347355
boolean needFreeze = status.shouldFreezeContext();
348356
// only freeze the context when we have at lest one snapshot probe, and we should send
349357
// snapshot
@@ -371,7 +379,7 @@ public static void evalContextAndCommit(
371379
continue;
372380
}
373381
context.evaluate(
374-
probeImplementation, callingClass.getTypeName(), -1, MethodLocation.DEFAULT);
382+
probeImplementation, callingClass.getTypeName(), -1, MethodLocation.DEFAULT, false);
375383
probeImplementations.add(probeImplementation);
376384
}
377385
for (ProbeImplementation probeImplementation : probeImplementations) {
@@ -395,7 +403,8 @@ public static void evalContextAndCommit(
395403
if (probeImplementation == null) {
396404
return;
397405
}
398-
context.evaluate(probeImplementation, callingClass.getTypeName(), -1, MethodLocation.DEFAULT);
406+
context.evaluate(
407+
probeImplementation, callingClass.getTypeName(), -1, MethodLocation.DEFAULT, true);
399408
probeImplementation.commit(context, line);
400409
} catch (Exception ex) {
401410
LOGGER.debug("Error in evalContextAndCommit: ", ex);

dd-java-agent/agent-debugger/debugger-bootstrap/src/main/java/datadog/trace/bootstrap/debugger/ProbeImplementation.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ public interface ProbeImplementation {
1717
String getStrTags();
1818

1919
void evaluate(
20-
CapturedContext context, CapturedContext.Status status, MethodLocation methodLocation);
20+
CapturedContext context,
21+
CapturedContext.Status status,
22+
MethodLocation methodLocation,
23+
boolean singleProbe);
2124

2225
void commit(
2326
CapturedContext entryContext,
@@ -82,7 +85,10 @@ public String getStrTags() {
8285

8386
@Override
8487
public void evaluate(
85-
CapturedContext context, CapturedContext.Status status, MethodLocation methodLocation) {}
88+
CapturedContext context,
89+
CapturedContext.Status status,
90+
MethodLocation methodLocation,
91+
boolean singleProbe) {}
8692

8793
@Override
8894
public void commit(

dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/probe/ExceptionProbe.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ public CapturedContext.Status createStatus() {
7171

7272
@Override
7373
public void evaluate(
74-
CapturedContext context, CapturedContext.Status status, MethodLocation methodLocation) {
74+
CapturedContext context,
75+
CapturedContext.Status status,
76+
MethodLocation methodLocation,
77+
boolean singleProbe) {
7578
ExceptionProbeStatus exceptionStatus;
7679
if (status instanceof ExceptionProbeStatus) {
7780
exceptionStatus = (ExceptionProbeStatus) status;
@@ -108,7 +111,7 @@ public void evaluate(
108111
exceptionStatus.setForceSampling(true);
109112
}
110113
exceptionStatus.setCapture(true);
111-
super.evaluate(context, status, methodLocation);
114+
super.evaluate(context, status, methodLocation, singleProbe);
112115
}
113116
}
114117

dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/probe/LogProbe.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ public InstrumentationResult.Status instrument(
485485

486486
@Override
487487
public boolean isReadyToCapture() {
488-
if (isLineProbe() && !hasCondition()) {
488+
if (!hasCondition()) {
489489
// we are sampling here to avoid creating CapturedContext when the sampling result is negative
490490
return ProbeRateLimiter.tryProbe(id);
491491
}
@@ -494,20 +494,25 @@ public boolean isReadyToCapture() {
494494

495495
@Override
496496
public void evaluate(
497-
CapturedContext context, CapturedContext.Status status, MethodLocation methodLocation) {
497+
CapturedContext context,
498+
CapturedContext.Status status,
499+
MethodLocation methodLocation,
500+
boolean singleProbe) {
498501
if (!(status instanceof LogStatus)) {
499502
throw new IllegalStateException("Invalid status: " + status.getClass());
500503
}
501504
LogStatus logStatus = (LogStatus) status;
502-
if (isLineProbe() && !hasCondition()) {
503-
// sampling was already done in isReadToCapture so we assume that if we are executing the
504-
// current method it means the status should be sampled
505-
if (!logStatus.getDebugSessionStatus().isDisabled()) {
506-
logStatus.setSampled(true);
505+
if (!hasCondition()) {
506+
if (singleProbe) {
507+
// sampling was already done in isReadToCapture so we assume that if we are executing the
508+
// current method it means the status should be sampled
509+
if (!logStatus.getDebugSessionStatus().isDisabled()) {
510+
logStatus.setSampled(true);
511+
}
512+
} else {
513+
// sample when no condition associated
514+
sample(logStatus, methodLocation);
507515
}
508-
} else if (!hasCondition()) {
509-
// sample when no condition associated
510-
sample(logStatus, methodLocation);
511516
}
512517
logStatus.setCondition(evaluateCondition(context, logStatus));
513518
CapturedContext.CapturedThrowable throwable = context.getCapturedThrowable();

dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/probe/ProbeDefinition.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ public ProbeLocation getLocation() {
137137

138138
@Override
139139
public void evaluate(
140-
CapturedContext context, CapturedContext.Status status, MethodLocation methodLocation) {}
140+
CapturedContext context,
141+
CapturedContext.Status status,
142+
MethodLocation methodLocation,
143+
boolean singleProbe) {}
141144

142145
@Override
143146
public void commit(

dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/probe/SpanDecorationProbe.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ public InstrumentationResult.Status instrument(
143143

144144
@Override
145145
public void evaluate(
146-
CapturedContext context, CapturedContext.Status status, MethodLocation methodLocation) {
146+
CapturedContext context,
147+
CapturedContext.Status status,
148+
MethodLocation methodLocation,
149+
boolean singleProbe) {
147150
for (Decoration decoration : decorations) {
148151
if (decoration.when != null) {
149152
try {

dd-java-agent/agent-debugger/src/main/java/com/datadog/debugger/probe/TriggerProbe.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ public TriggerProbe setProbeCondition(ProbeCondition probeCondition) {
9696

9797
@Override
9898
public void evaluate(
99-
CapturedContext context, CapturedContext.Status status, MethodLocation location) {
99+
CapturedContext context,
100+
CapturedContext.Status status,
101+
MethodLocation location,
102+
boolean singleProbe) {
100103

101104
Sampling sampling = getSampling();
102105
if (sampling == null || !sampling.inCoolDown()) {

0 commit comments

Comments
 (0)