Skip to content

fix (internal/civisibility): use internal code coverage api to get the total percentage.#3540

Merged
tonyredondo merged 2 commits into
mainfrom
tony/civisibility-use-internal-coverage
May 23, 2025
Merged

fix (internal/civisibility): use internal code coverage api to get the total percentage.#3540
tonyredondo merged 2 commits into
mainfrom
tony/civisibility-use-internal-coverage

Conversation

@tonyredondo

@tonyredondo tonyredondo commented May 22, 2025

Copy link
Copy Markdown
Member

What does this PR do?

This PR enables the internal api used to get the global code coverage value on Test Impact Analysis scenario to a normal code coverage scenario.

Motivation

This Go testing.Coverage() api is returning a different percentage from the one reported in the stdout. This issue started when the new code coverage algorithm started to be the default algorithm.

See: golang/go#62212

Example:

--- PASS: TestValue (0.00s)
PASS
coverage: 100.0% of statements
testing.Coverage() 25
....
2025/05/22 15:23:38 Datadog Tracer v2.1.0-dev.2 DEBUG: civisibility: done.
ok      awesomeProject10/package1       1.092s  coverage: 100.0% of statements

By switching to our internal api (the internal api uses the same mechanism as the stdout format)

image

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • New code is free of linting errors. You can check this by running golangci-lint run locally.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

@tonyredondo tonyredondo self-assigned this May 22, 2025
@pr-commenter

pr-commenter Bot commented May 22, 2025

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2025-05-23 13:13:28

Comparing candidate commit 40a7676 in PR branch tony/civisibility-use-internal-coverage with baseline commit f7bcc7a in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 21 metrics, 0 unstable metrics.

@tonyredondo
tonyredondo marked this pull request as ready for review May 23, 2025 08:25
@tonyredondo
tonyredondo requested review from a team as code owners May 23, 2025 08:25
@tonyredondo
tonyredondo merged commit 1067122 into main May 23, 2025
@tonyredondo
tonyredondo deleted the tony/civisibility-use-internal-coverage branch May 23, 2025 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants