Skip to content

Commit 41eed19

Browse files
authored
Merge branch 'master' into nicholas.hulston/lambda-eventbridge-tracing-fix
2 parents 9cf207e + 85b316b commit 41eed19

File tree

338 files changed

+7209
-2223
lines changed

Some content is hidden

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

338 files changed

+7209
-2223
lines changed

.circleci/config.continue.yml.j2

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,11 +880,27 @@ jobs:
880880
881881
- run:
882882
name: Run APM Integrations tests
883+
environment:
884+
- AWS_ACCESS_KEY_ID: $SYSTEM_TESTS_IDM_AWS_ACCESS_KEY_ID
885+
- AWS_SECRET_ACCESS_KEY: $SYSTEM_TESTS_IDM_AWS_SECRET_ACCESS_KEY
886+
- AWS_REGION: us-east-1
887+
- AWS_DEFAULT_REGION: us-east-1 # AWS services should use `AWS_REGION`, but some still use the older `AWS_DEFAULT_REGION`
883888
# Stop the job after 5m to avoid excessive overhead. Will need adjustment as more tests are added.
884889
no_output_timeout: 5m
885890
command: |
886891
cd system-tests
887892
DD_SITE=datadoghq.com DD_API_KEY=$SYSTEM_TESTS_E2E_DD_API_KEY DD_APPLICATION_KEY=$SYSTEM_TESTS_E2E_DD_APP_KEY ./run.sh INTEGRATIONS
893+
894+
- run:
895+
name: Run IDM Crossed Tracing Libraries propagation tests for messaging
896+
environment:
897+
- AWS_ACCESS_KEY_ID: $SYSTEM_TESTS_IDM_AWS_ACCESS_KEY_ID
898+
- AWS_SECRET_ACCESS_KEY: $SYSTEM_TESTS_IDM_AWS_SECRET_ACCESS_KEY
899+
- AWS_REGION: us-east-1
900+
- AWS_DEFAULT_REGION: us-east-1 # AWS services should use `AWS_REGION`, but some still use the older `AWS_DEFAULT_REGION`
901+
command: |
902+
cd system-tests
903+
DD_API_KEY=$SYSTEM_TESTS_DD_API_KEY ./run.sh CROSSED_TRACING_LIBRARIES
888904
889905
- store_test_results:
890906
path: system-tests/logs_integrations

.github/workflows/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ _Action:_ Clean up old lib-injection OCI images from GitHub Container Registry.
8282

8383
_Recovery:_ Manually trigger the action again.
8484

85+
### prune-old-pull-requests [🔗](prune-old-pull-requests.yaml)
86+
87+
_Trigger:_ Every month or manually.
88+
89+
_Action:_ Mark as stale and comment on pull requests with no update during the last quarter.
90+
Close them if no following update within a week.
91+
92+
_Recovery:_ Manually trigger the action again.
93+
8594
## Code Quality and Security
8695

8796
### analyze-changes [🔗](analyze-changes-with-github-codeql.yaml)

.github/workflows/increment-milestone-on-tag.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
const nextMilestoneTitle = versionNumbers.join('.')
5656
core.info(`Creating next version milestone: ${nextMilestoneTitle}`)
5757
// Create the next milestone
58-
await github.issues.createMilestone({
58+
await github.rest.issues.createMilestone({
5959
owner: context.repo.owner,
6060
repo: context.repo.repo,
6161
title: nextMilestoneTitle
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Prune old pull requests
2+
on:
3+
schedule:
4+
- cron: '0 3 1 * *'
5+
workflow_dispatch:
6+
7+
jobs:
8+
prune-old-pull-requests:
9+
name: Prune old pull requests
10+
runs-on: ubuntu-latest
11+
permissions:
12+
issues: write
13+
pull-requests: write
14+
steps:
15+
- name: Prune old pull requests
16+
uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0
17+
with:
18+
days-before-stale: -1 # Disable general stale bot
19+
days-before-pr-stale: 90 # Only enable stale bot for PRs with no activity for 90 days
20+
stale-pr-message: 'This pull request has been marked as stale because it has not had activity over the past quarter. It will be closed in 7 days if no further activity occurs. Feel free to reopen the PR if you are still working on it.'
21+
close-pr-message: 'This pull request has been closed because it has not had activity over the past quarter. Feel free to reopen the PR if you are still working on it.'
22+
stale-pr-label: 'tag: stale'
23+
operations-per-run: 500

.gitlab-ci.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ stages:
1717
- ci-visibility-tests
1818
- generate-signing-key
1919

20-
workflow:
21-
rules:
22-
- if: $POPULATE_CACHE == "true"
23-
variables:
24-
SKIP_SHARED_PIPELINE: "true"
25-
- when: always
26-
2720
variables:
2821
REGISTRY: 486234852809.dkr.ecr.us-east-1.amazonaws.com
2922
BUILD_JOB_NAME: "build"

BUILDING.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ $ ./setup.sh
2525
✅ The git command line is installed.
2626
✅ pre-commit hook is installed in repository.
2727
✅ git config submodule.recurse is set to true.
28+
✅ All git submodules are initialized.
2829
ℹ️ Checking Docker environment:
2930
✅ The docker command line is installed.
3031
✅ The Docker server is running.
@@ -190,4 +191,14 @@ To build the entire project with tests (this can take a very long time) run:
190191
./gradlew clean build
191192
```
192193

193-
After building the project, you can find the jar build artifact into the `dd-java-agent/build/libs` folder.
194+
>[!NOTE]
195+
> Running the complete test suite on a local development environment can be challenging.
196+
> It might take a very long time, and you might encounter few flaky tests along the way.
197+
> It is recommended to only run the tests related to your changes locally, and leave the whole test suite to the continuous integration platform.
198+
199+
To build the JVM agent artifact only run:
200+
```bash
201+
./gradlew :dd-java-agent:shadowJar
202+
```
203+
204+
After building the project, you can find the built JVM agent artifact into the `dd-java-agent/build/libs` folder.

CONTRIBUTING.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@
44

55
Pull requests for bug fixes are welcome, but before submitting new features or changes to current
66
functionality, please [open an issue](https://github.com/DataDog/dd-trace-java/issues/new)
7-
and discuss your ideas or propose the changes you wish to make first. After a resolution is reached a PR can be
8-
submitted for
9-
review.
10-
11-
When opening a pull request, please open it as
12-
a [draft](https://github.blog/2019-02-14-introducing-draft-pull-requests/) to not auto assign reviewers before you feel
13-
the pull request is in a reviewable state.
7+
and discuss your ideas or propose the changes you wish to make first. After a resolution is reached a [PR can be
8+
submitted](#pull-request-guidelines) for review.
149

1510
## Adding instrumentations
1611

@@ -91,6 +86,10 @@ command line should be Java 8.
9186

9287
## Pull Request Guidelines
9388

89+
### Draft first
90+
91+
When opening a pull request, please open it as a [draft](https://github.blog/2019-02-14-introducing-draft-pull-requests/) to not auto assign reviewers before you feel the pull request is in a reviewable state.
92+
9493
### Title Format
9594

9695
Pull request titles should briefly describe the proposed changes in a way that makes sense for the users.
@@ -133,3 +132,17 @@ Labels are not only used to categorize but also alter the continuous integration
133132
>[!NOTE]
134133
> For reference, the [full list of all labels available](https://github.com/DataDog/dd-trace-java/labels).
135134
> If you feel one is missing, let [the maintainer team](https://github.com/orgs/DataDog/teams/apm-java) know!
135+
136+
## Pull Request Reviews
137+
138+
### Review Expectations
139+
140+
After making you pull request ready for review by converting it from draft, you can expect getting an initial review comment within two working days, and a full review within a week of work.
141+
If you don't receive any update, feel free to send a nice reminder to the assigned reviewers using pull request comments or our internal Slack channel.
142+
143+
### Stale Pull Requests
144+
145+
A pull request is considered "stale" if it has had no activity (comments, updates) for the last quarter.
146+
Stale PRs will be commented and labelled as such (using the `tag: stale` label), then closed if they still receive no update for a week after.
147+
148+
Closed PRs can be reopened at any time, but may be closed again if they ever meet the same stale conditions.

communication/src/main/java/datadog/communication/BackendApiFactory.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@ public BackendApiFactory(Config config, SharedCommunicationObjects sharedCommuni
3434
"Agentless mode is enabled and api key is not set. Please set application key");
3535
}
3636
String traceId = config.getIdGenerationStrategy().generateTraceId().toString();
37-
long timeoutMillis = config.getCiVisibilityBackendApiTimeoutMillis();
38-
return new IntakeApi(agentlessUrl, apiKey, traceId, timeoutMillis, retryPolicyFactory, true);
37+
return new IntakeApi(
38+
agentlessUrl,
39+
apiKey,
40+
traceId,
41+
retryPolicyFactory,
42+
sharedCommunicationObjects.okHttpClient,
43+
true);
3944
}
4045

4146
DDAgentFeaturesDiscovery featuresDiscovery =

communication/src/main/java/datadog/communication/IntakeApi.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,15 @@ public IntakeApi(
3737
HttpUrl hostUrl,
3838
String apiKey,
3939
String traceId,
40-
long timeoutMillis,
4140
HttpRetryPolicy.Factory retryPolicyFactory,
41+
OkHttpClient httpClient,
4242
boolean responseCompression) {
4343
this.hostUrl = hostUrl;
4444
this.apiKey = apiKey;
4545
this.traceId = traceId;
4646
this.retryPolicyFactory = retryPolicyFactory;
4747
this.responseCompression = responseCompression;
48-
49-
httpClient = OkHttpUtils.buildHttpClient(hostUrl, timeoutMillis);
48+
this.httpClient = httpClient;
5049
}
5150

5251
@Override

communication/src/main/java/datadog/communication/ddagent/SharedCommunicationObjects.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,21 @@ public void createRemaining(Config config) {
3636
}
3737
}
3838
if (okHttpClient == null) {
39-
String unixDomainSocket = SocketUtils.discoverApmSocket(config);
40-
String namedPipe = config.getAgentNamedPipe();
39+
String unixDomainSocket;
40+
String namedPipe;
41+
HttpUrl url;
42+
if (!config.isCiVisibilityAgentlessEnabled()) {
43+
unixDomainSocket = SocketUtils.discoverApmSocket(config);
44+
namedPipe = config.getAgentNamedPipe();
45+
url = agentUrl;
46+
} else {
47+
unixDomainSocket = null;
48+
namedPipe = null;
49+
url = null;
50+
}
4151
okHttpClient =
4252
OkHttpUtils.buildHttpClient(
43-
agentUrl, unixDomainSocket, namedPipe, getHttpClientTimeout(config));
53+
url, unixDomainSocket, namedPipe, getHttpClientTimeout(config));
4454
}
4555
}
4656

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/iast/NamedContext.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public abstract class NamedContext {
1919

2020
public abstract void taintName(@Nullable String name);
2121

22+
public abstract void setCurrentName(@Nullable final String name);
23+
2224
@Nonnull
2325
public static <E> NamedContext getOrCreate(
2426
@Nonnull final ContextStore<E, NamedContext> store, @Nonnull final E target) {
@@ -47,6 +49,9 @@ public void taintValue(@Nullable final String value) {}
4749

4850
@Override
4951
public void taintName(@Nullable final String name) {}
52+
53+
@Override
54+
public void setCurrentName(@Nullable final String name) {}
5055
}
5156

5257
private static class NamedContextImpl extends NamedContext {
@@ -78,6 +83,11 @@ public void taintName(@Nullable final String name) {
7883
}
7984
}
8085

86+
@Override
87+
public void setCurrentName(@Nullable final String name) {
88+
currentName = name;
89+
}
90+
8191
private IastContext iastCtx() {
8292
if (!fetched) {
8393
fetched = true;

dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/ExcludeFilterTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import static datadog.trace.bootstrap.instrumentation.java.concurrent.ExcludeFil
99

1010
class ExcludeFilterTest extends DDSpecification {
1111

12-
def "test empty ExcludeFilter"() {
12+
def "test empty ExcludeFilter #type.name()"() {
1313
setup:
1414
def one = new One()
1515
def oneName = One.getName()
@@ -22,7 +22,7 @@ class ExcludeFilterTest extends DDSpecification {
2222
type << ExcludeFilter.ExcludeType.values()
2323
}
2424

25-
def "test ExcludeFilter"() {
25+
def "test ExcludeFilter #type.name()"() {
2626
setup:
2727
def another = new Another()
2828
def anotherName = Another.getName()

dd-java-agent/agent-builder/src/test/groovy/datadog/trace/agent/test/DefaultInstrumenterForkedTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class DefaultInstrumenterForkedTest extends DDSpecification {
2020
target.enabled
2121
}
2222

23-
def "default enabled override"() {
23+
def "default enabled override #enabled"() {
2424
expect:
2525
target.enabled == enabled
2626

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import datadog.trace.civisibility.source.SourcePathResolver;
3232
import datadog.trace.civisibility.source.index.RepoIndexProvider;
3333
import datadog.trace.civisibility.source.index.RepoIndexSourcePathResolver;
34-
import datadog.trace.civisibility.utils.ProcessHierarchyUtils;
3534
import java.nio.file.Path;
3635
import java.nio.file.Paths;
3736
import java.util.Map;
@@ -76,11 +75,12 @@ public class CiVisibilityRepoServices {
7675
codeowners = buildCodeowners(repoRoot);
7776
sourcePathResolver = buildSourcePathResolver(repoRoot, repoIndexProvider);
7877

79-
if (ProcessHierarchyUtils.isChild()) {
78+
if (services.processHierarchy.isChild()) {
8079
executionSettingsFactory = buildExecutionSettingsFetcher(services.signalClientFactory);
8180
} else {
8281
executionSettingsFactory =
8382
buildExecutionSettingsFactory(
83+
services.processHierarchy,
8484
services.config,
8585
services.metricCollector,
8686
services.backendApi,
@@ -122,6 +122,7 @@ private static ExecutionSettingsFactory buildExecutionSettingsFetcher(
122122
}
123123

124124
private static ExecutionSettingsFactory buildExecutionSettingsFactory(
125+
ProcessHierarchy processHierarchy,
125126
Config config,
126127
CiVisibilityMetricCollector metricCollector,
127128
BackendApi backendApi,
@@ -138,7 +139,7 @@ private static ExecutionSettingsFactory buildExecutionSettingsFactory(
138139

139140
ExecutionSettingsFactoryImpl factory =
140141
new ExecutionSettingsFactoryImpl(config, configurationApi, gitDataUploader, repoRoot);
141-
if (ProcessHierarchyUtils.isHeadless()) {
142+
if (processHierarchy.isHeadless()) {
142143
return factory;
143144
} else {
144145
return new MultiModuleExecutionSettingsFactory(config, factory);

0 commit comments

Comments
 (0)