Skip to content

Conversation

@nikita-tkachenko-datadog
Copy link
Contributor

@nikita-tkachenko-datadog nikita-tkachenko-datadog commented Mar 13, 2023

What Does This Do

Adds a new instrumentation for Gradle Daemon processes.
The instrumentation creates spans for entire build and for each Test task within a build.
The instrumentation passes IDs of created spans to forked test processes (so that the spans created in those processes could refer to the spans from the parent daemon process).

Motivation

This is needed in order to support Test Session and Test Module levels visibility (a CI Visibility feature) for Gradle builds.
"Test session" is a CI Visibility term that is equivalent to tests run for a single project, "Test module" is equivalent to tests run for a single module within a project.

Additional Notes

Gradle Daemon is supposed to be a long-lived process potentially reused for multiple builds.
Since multiple builds for different projects can be executed by the same daemon, repository root cannot be calculated during the agent's init phase and stored in a static field anymore.
Instead it is now a part of TestDecorator state (the decorator lifetime can now vary depending on whether it is used with a Gradle build or a forked test process run).
Some CI Visibility classes had to be moved from dd-java-agent/agent-ci-visibility module to internal-api module in order to accommodate this change.

@nikita-tkachenko-datadog nikita-tkachenko-datadog added the comp: ci visibility Continuous Integration Visibility label Mar 13, 2023
@nikita-tkachenko-datadog nikita-tkachenko-datadog force-pushed the nikita-tkachenko/gradle-test-events-instrumentation branch from cfc8aab to 59700d4 Compare March 14, 2023 10:33
@nikita-tkachenko-datadog nikita-tkachenko-datadog changed the title WIP: CI VIsibility Gradle instrumentation WIP: CI Visibility Gradle instrumentation Mar 14, 2023
Project rootProject = gradle.getRootProject();
Collection<GradleUtils.TestFramework> testFrameworks =
GradleUtils.collectTestFrameworks(rootProject);
if (testFrameworks.size() == 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to report back when customers do have multiples, either with a debug log so we can get it in troubleshooting, or a telemetry log message

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, added a log message

@nikita-tkachenko-datadog nikita-tkachenko-datadog changed the title WIP: CI Visibility Gradle instrumentation CI Visibility Gradle instrumentation Mar 21, 2023
@nikita-tkachenko-datadog nikita-tkachenko-datadog marked this pull request as ready for review March 21, 2023 11:37
@nikita-tkachenko-datadog nikita-tkachenko-datadog merged commit 51e0cd8 into master Mar 28, 2023
@nikita-tkachenko-datadog nikita-tkachenko-datadog deleted the nikita-tkachenko/gradle-test-events-instrumentation branch March 28, 2023 12:11
@github-actions github-actions bot added this to the 1.12.0 milestone Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: ci visibility Continuous Integration Visibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants