You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes CI Visibility test source resolution when Go test binaries are built with -trimpath.
runtime.Func.FileLine can return a logical module path such as github.com/DataDog/dd-trace-go/v2/internal/... instead of a local filesystem path. SetTestFunc previously used that single value for both source tags and source parsing, which could leave test.source.file with the module prefix and prevent AST parsing from finding source ranges.
This PR adds a source-path resolver that keeps those concerns separate:
repository-relative paths for test.source.file, CODEOWNERS, and impacted-tests inputs
best-effort filesystem paths for source parsing
The resolver preserves the existing legacy helper behavior for other callers, handles repository URL normalization, supports semantic import suffixes like /v2, preserves monorepo module subdirectories, and includes Windows-specific path coverage.
Motivation
Fix CI Visibility source metadata for -trimpath test binaries, including the bug reported in DataDog/orchestrion#826, without changing unrelated path handling for existing CI Visibility callers.
Testing
go test ./internal/civisibility/utils -count=1
go test ./internal/civisibility/integrations -count=1
go test ./internal/civisibility/integrations/gotesting -count=1
go test ./internal/civisibility/... -count=1
go test -trimpath ./internal/civisibility/... -count=1
go test -race ./internal/civisibility/... -count=1
go test -race -trimpath ./internal/civisibility/... -count=1
Comparing candidate commit f0078b3 in PR branch feat/civisibility-trimpath-source-paths with baseline commit 2743f8e in branch main.
Found 0 performance improvements and 0 performance regressions! Performance is the same for 207 metrics, 9 unstable metrics.
Explanation
This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:
🟩 = significantly better candidate vs. baseline
🟥 = significantly worse candidate vs. baseline
We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.
If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.
Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.
More details about the CI and significant changes
You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.
CIs of the difference of means are often centered around 0%, because often changes are not that big:
---------------------------------(------|---^--------)-------------------------------->
-0.6% 0% 0.3% +1.2%
| | |
lower bound of the CI --' | |
sample mean (center of the CI) -------------' |
upper bound of the CI ----------------------'
As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).
For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:
----------------------------------------|---------|---(---------^---------)---------->
0% 1% 1.3% 2.2% 3.1%
| | | |
significant impact threshold --------------' | | |
lower bound of CI --------------' | |
sample mean (center of the CI) --------------------------' |
upper bound of CI ----------------------------------'
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
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.
What does this PR do?
Fixes CI Visibility test source resolution when Go test binaries are built with
-trimpath.runtime.Func.FileLinecan return a logical module path such asgithub.com/DataDog/dd-trace-go/v2/internal/...instead of a local filesystem path.SetTestFuncpreviously used that single value for both source tags and source parsing, which could leavetest.source.filewith the module prefix and prevent AST parsing from finding source ranges.This PR adds a source-path resolver that keeps those concerns separate:
test.source.file, CODEOWNERS, and impacted-tests inputsThe resolver preserves the existing legacy helper behavior for other callers, handles repository URL normalization, supports semantic import suffixes like
/v2, preserves monorepo module subdirectories, and includes Windows-specific path coverage.Motivation
Fix CI Visibility source metadata for
-trimpathtest binaries, including the bug reported in DataDog/orchestrion#826, without changing unrelated path handling for existing CI Visibility callers.Testing
go test ./internal/civisibility/utils -count=1go test ./internal/civisibility/integrations -count=1go test ./internal/civisibility/integrations/gotesting -count=1go test ./internal/civisibility/... -count=1go test -trimpath ./internal/civisibility/... -count=1go test -race ./internal/civisibility/... -count=1go test -race -trimpath ./internal/civisibility/... -count=1git diff --check