Fix Go tracer selection for orchestrion installs#22
Merged
tonyredondo merged 7 commits intomainfrom Mar 25, 2026
Merged
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 165446b4ed
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
daniel-mohedano
approved these changes
Mar 25, 2026
Contributor
daniel-mohedano
left a comment
There was a problem hiding this comment.
IIRC I based the Jenkins auto instrumentation logic on this script, so we might have to fix it too 🤕
Member
Author
I'm sure we can tell the AI to do the changes for jenkins |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the Go autoinstrumentation flow used by the Test Visibility install script when it installs
orchestrion.The original problem was that the script did not actually keep
dd-trace-goaligned with theorchestrionrelease selected by the user. It installedorchestrion, ranorchestrion pin, and letorchestrionresolvedd-trace-goon its own. In practice, that meant projects with no existingdd-trace-godependency could jump to the latest published tracer release, even when that release required a newer Go version than the customer project supported.That is what happened in the customer report from
orchestrionissue #806: a Go 1.24 project usingorchestrion v1.8.0drifted todd-trace-go v2.7.0, whoseorchestrion/allmodule requires Go 1.25.This change keeps the installation stable, but still allows newer compatible tracer releases when the project and runner can support them.
What changed
1. Resolve the
orchestrionversion once per runIf
DD_SET_TRACER_VERSION_GO=latest, the script now resolveslatestonce up front and reuses that exact tag for the rest of the flow.This avoids mid-run drift across different network calls.
2. Choose a tracer version based on the selected
orchestrion, the project Go version, and the runner Go versionThe new algorithm is:
orchestrionversion.dd-trace-go/v2version shipped by thatorchestrionrelease.godirective when possible.dd-trace-go/v2releases from newest to oldest.orchestrion/allmodule still supports that Go ceiling.@latest.This gives us the behavior we actually want:
3. Refuse to instrument projects that are below the minimum supported Go level
There are now two separate lower-bound checks:
orchestrionreleaseIf the project's
go.modsays something older than the minimum supported by the shipped tracer, the script now skips instrumentation cleanly instead of lettingorchestrion pinsilently rewrite the project to a newer Go version.4. Support repos where the Go module is not at the repository root
The script now supports:
DD_CIVISIBILITY_GO_MODULE_DIRas an explicit module-root overridego.modgo.modIf the override is explicitly set but invalid, the script fails fast with a clear error.
5. Keep the explicit
go getstep versionedThe script still updates the module graph with
go get github.com/DataDog/orchestrion@<resolved_tag>, but it now pins that step to the sameorchestrionversion already selected earlier in the run.6. Avoid dirtying
go.modwhenorchestrioncannot be installedThe script now installs the
orchestrionCLI before it edits the project'sgo.mod.This keeps the previous failure behavior where a failed
go install github.com/DataDog/orchestrion@...does not leave the module partially modified.7. Keep the script compatible with
/bin/bash3.2 on macOS runnersThe new Go-module discovery and tracer-selection logic now uses array-loading code that works on the default
/bin/bashshipped on macOS GitHub runners.This preserves:
Why this fixes the customer issue
With
orchestrion v1.8.0:dd-trace-go/v2baseline isv2.6.0dd-trace-go/orchestrion/all/v2 v2.6.0supports Go 1.24dd-trace-go/orchestrion/all/v2 v2.7.0requires Go 1.25So after this change:
v2.6.0v2.7.0Support matrix
go 1.24, runnergo 1.26.1dd-trace-go/v2andorchestrion/all/v2tov2.6.0.go 1.25, runnergo 1.26.1dd-trace-go/v2andorchestrion/all/v2tov2.7.0.go 1.22, runnergo 1.26.1go.modunchanged. Does not createorchestrion.tool.go.orchestrionminimumorchestrionbut is below the minimum shipped tracer bundle requirementgo 1.24, runnergo 1.26.1, no env overridedd-trace-go/v2andorchestrion/all/v2tov2.6.0.go 1.25, runnergo 1.26.1, no env overridedd-trace-go/v2andorchestrion/all/v2tov2.7.0.DD_CIVISIBILITY_GO_MODULE_DIR.DD_CIVISIBILITY_GO_MODULE_DIRDD_CIVISIBILITY_GO_MODULE_DIRpoints to a missing directoryDD_CIVISIBILITY_GO_MODULE_DIRpoints to a directory withoutgo.modgo.modin the repogo.modexists but has nogodirectiveorchestrionrelease and proceeds.dd-trace-goversion list cannot be retrievedorchestrionrelease and proceeds.DD_SET_TRACER_VERSION_GO=latestlatestonce, then uses that fixed resolved tag consistently for the whole run.go install github.com/DataDog/orchestrion@...fails after version resolutiongo.mod.Verification
I verified this in two ways:
Real targeted repros in
/tmpv2.6.0for Go 1.24 andv2.7.0for Go 1.25.v2.7.0for a nested Go 1.25 project.go.mod.Full scenario sweep with a lightweight harness
tests/run_go_matrix.shto exercise the Go decision matrix without relying on full upstreamorchestrionbuilds.go 1.25upgrade path and the failed-go installno-mutation path.I also ran:
bash -n install_test_visibility.shbash -n tests/run_go_matrix.sh/bin/bash -n tests/run_go_matrix.shtests/run_go_matrix.shNotes
The checked-in matrix harness uses fake
go,curl, andorchestrionbinaries so it can validate the script's control flow, version selection, and file mutation behavior deterministically without depending on repeated full upstream installs.