Skip to content

CI Visibility Maven instrumentation - #4934

Merged
nikita-tkachenko-datadog merged 51 commits into
masterfrom
nikita-tkachenko/maven-test-events-instrumentation
Apr 6, 2023
Merged

nikita-tkachenko-datadog merged 51 commits into
masterfrom
nikita-tkachenko/maven-test-events-instrumentation

Conversation

@nikita-tkachenko-datadog

Copy link
Copy Markdown
Contributor

What Does This Do

Adds a new instrumentation for Maven build processes.
The instrumentation creates spans for entire build and for each surefire/failsafe plugins goal 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 Maven 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.

…k & test command calculation in Gradle build listener
… only in the project, but also in the included builds
…s stubbing of that particular class does not work on Java 9+
…rnal-api, since corresponding classes were moved
@nikita-tkachenko-datadog nikita-tkachenko-datadog added the comp: ci visibility Continuous Integration Visibility label Mar 22, 2023
@nikita-tkachenko-datadog
nikita-tkachenko-datadog marked this pull request as ready for review March 28, 2023 14:25

@devinsba devinsba left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me

@nikita-tkachenko-datadog
nikita-tkachenko-datadog merged commit 66075c3 into master Apr 6, 2023
@nikita-tkachenko-datadog
nikita-tkachenko-datadog deleted the nikita-tkachenko/maven-test-events-instrumentation branch April 6, 2023 14:23
@github-actions github-actions Bot added this to the 1.12.0 milestone Apr 6, 2023

@albertvaka albertvaka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

public static String getCommandLine(MavenSession session) {
String mavenCmdLineArgsEnvVar = System.getenv(MAVEN_CMD_LINE_ARGS_ENVIRONMENT_VAR);
if (mavenCmdLineArgsEnvVar != null) {
return "mvn" + mavenCmdLineArgsEnvVar;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we add a space between mvn and the args or does MAVEN_CMD_LINE_ARGS_ENVIRONMENT_VAR begin with an empty space character?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yep, the environment var begins with a whitespace, so there's no need to add one manually

String mavenCmdLineArgsProp =
sessionSystemProperties.getProperty("env." + MAVEN_CMD_LINE_ARGS_ENVIRONMENT_VAR);
if (mavenCmdLineArgsProp != null) {
return MVN_CMD_LINE_INVOCATION + mavenCmdLineArgsProp;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Small inconsistency: You use the MVN_CMD_LINE_INVOCATION constant here but there are two instances of using the string literal mvn directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch! I was too quick to merge this after Brian's approval, but I'll be sure to address this in an upcoming PR

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