Skip to content

Implement Go auto-instrumentation for Test Optimization#510

Merged
nikita-tkachenko-datadog merged 10 commits into
jenkinsci:masterfrom
daniel-mohedano:daniel.mohedano/go-auto-instrumentation
May 5, 2025
Merged

Implement Go auto-instrumentation for Test Optimization#510
nikita-tkachenko-datadog merged 10 commits into
jenkinsci:masterfrom
daniel-mohedano:daniel.mohedano/go-auto-instrumentation

Conversation

@daniel-mohedano

@daniel-mohedano daniel-mohedano commented Apr 29, 2025

Copy link
Copy Markdown
Collaborator

Requirements for Contributing to this repository

  • Fill out the template below. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • The pull request must only fix one issue at the time.
  • The pull request must update the test suite to demonstrate the changed functionality.
  • After you create the pull request, all status checks must be pass before a maintainer reviews your contribution. For more details, please see CONTRIBUTING.

What does this PR do?

  • Implements Test Optimization's auto-instrumentation logic for Go.

Description of the Change

  • Adds GoConfigurator class that checks the go version installed against the required one for Orchestrion and installs it. It then pins it and updates its dependencies. Finally, it updates GOFLAGS with '-toolexec=orchestrion toolexec' and sets DD_TRACER_VERSION_GO.
  • Adds GO to TracerLanguage enum.
  • Adds Go to README and to help-languages.html page.

Alternate Designs

Possible Drawbacks

Verification Process

Verified using docker compose setup for manual testing.

  1. Start jenkins on docker compose
  2. Run test-pipeline-go without test optimization
image
  1. Configure Test Optimization for test-pipeline-go
image
  1. Run test-pipeline with Datadog plugin and auto instrumentation
image
  1. Validate the tests are present in Datadog
image

Additional Notes

Release Notes

Review checklist (to be filled by reviewers)

  • Feature or bug fix MUST have appropriate tests (unit, integration, etc...)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have one changelog/ label attached. If applicable it should have the backward-incompatible label attached.
  • PR should not have do-not-merge/ label attached.
  • If Applicable, issue must have kind/ and severity/ labels attached at least.

@nikita-tkachenko-datadog

Copy link
Copy Markdown
Collaborator

I do hope you based your changes on #504 :)
Also, we need to make sure changes from DataDog/test-visibility-install-script#16 and DataDog/test-visibility-install-script#17 are incorporated (this is where my original PR fell short).
I will take a closer look at this

"orchestrion", "version"));
orchestrionVersion = orchestrionVersionOutput.split(" ")[1]; // Format: "orchestrion v1.0.2"
} catch (Exception e) {
orchestrionVersion = "vlatest";

@nikita-tkachenko-datadog nikita-tkachenko-datadog May 1, 2025

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's maybe log the exception with a debug level to aid issue investigations


private static final String TRACER_VERSION_ENV_VAR = "DD_SET_TRACER_VERSION_GO";
private static final String LATEST_TAG = "latest";
private static final String ORCHESTRION_LATEST_URL = "https://api.github.com/repos/datadog/orchestrion/releases/latest";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I wonder if we can come up with a fallback for cases when the current shell user is not logged in to GitHub

@nikita-tkachenko-datadog nikita-tkachenko-datadog added the changelog/Added Added features results into a minor version bump label May 5, 2025
@nikita-tkachenko-datadog
nikita-tkachenko-datadog merged commit 318c50c into jenkinsci:master May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/Added Added features results into a minor version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants