Skip to content

Add Datadog code coverage upload#799

Draft
ManuelPalenzuelaDD wants to merge 6 commits intomainfrom
add-datadog-coverage
Draft

Add Datadog code coverage upload#799
ManuelPalenzuelaDD wants to merge 6 commits intomainfrom
add-datadog-coverage

Conversation

@ManuelPalenzuelaDD
Copy link
Contributor

Summary

  • Adds Datadog coverage upload alongside existing Codecov upload in the validate.yml workflow
  • Uses DataDog/coverage-upload-github-action with the same per-flag matrix strategy as Codecov uploads
  • Adds code-coverage.datadog.yml with ignore paths matching codecov.yml (samples/, _tools/, auto-generated proxy)
  • Uses DD_CI_API_KEY secret (already available in this repo)

Test plan

  • CI passes — both Codecov and Datadog uploads succeed
  • Coverage data appears in Datadog Code Coverage UI
  • Compare Codecov vs Datadog total coverage percentages (should be within 1%)

🤖 Generated with Claude Code

Side-by-side coverage reporting: adds Datadog coverage upload
alongside existing Codecov upload using the coverage-upload-github-action.
Mirrors the per-flag matrix upload structure. Also adds
code-coverage.datadog.yml with ignore paths matching codecov.yml.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@datadog-prod-us1-6
Copy link

datadog-prod-us1-6 bot commented Mar 12, 2026

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 68.70%

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: e708754 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

ManuelPalenzuelaDD and others added 2 commits March 12, 2026 14:27
Go coverprofiles use the module import path (github.com/DataDog/orchestrion/_samples/...)
not the filesystem path (samples/...). When Datadog strips the module prefix, the resulting
path is _samples/ not samples/. Add _samples/ to the ignore list to match both the
filesystem and module path variants.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…paths

The ci-app-coverage-reducer's GoCoverprofilePathResolver fails to resolve
file paths when the Go module name differs from the filesystem directory
name (e.g., module "github.com/DataDog/orchestrion/_samples" lives in
"samples/" on disk). The suffix matching tries "_samples/..." against the
git repo index but finds no match because the directory is "samples/".

This causes paths to remain as full module import paths like
"github.com/DataDog/orchestrion/_samples/client/main.go", which don't
match PREFIX-type ignore patterns like "_samples/".

Fix: add glob patterns (**/_samples/**, **/_tools/**, **/dot_ast.proxies.go)
that match unresolved paths regardless of the module prefix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ManuelPalenzuelaDD and others added 3 commits March 12, 2026 17:43
The datadog-ci CLI discovers code-coverage.datadog.yml via
`git rev-parse HEAD:<path>`, but the upload job only downloaded
coverage artifacts without checking out the repo. The CLI logged
"Not syncing git metadata (not a git repo)" and skipped config
discovery, so ignore rules were never sent to the reducer.

Adding actions/checkout ensures the CLI can find and include
the config file metadata (path + SHA) in the upload event,
allowing the reducer to apply ignore rules for _samples/,
_tools/, and generated files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Datadog coverage reducer averages per-report coverage instead of
OR-merging line-level data. With 76 separate reports (integration ~47%,
unit ~52%), the average is ~50.6% while the union is ~69%.

Fix: merge all Go coverprofiles into a single file before uploading,
so the reducer computes coverage from the correct union of all lines.

Also removes per-flag matrix upload since the merged file already
contains all coverage data.
Exclude _samples/, _tools/, and dot_ast.proxies.go entries from the
merged Go coverprofile before uploading to Datadog. These paths are
already ignored by Codecov (codecov.yml) and listed in
code-coverage.datadog.yml, but the Datadog reducer may not resolve
Go module paths (e.g. github.com/DataDog/orchestrion/_samples/...)
to filesystem paths correctly due to the module/directory name mismatch.

Filtering at merge time ensures parity regardless of reducer behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.81%. Comparing base (e061d12) to head (e708754).
⚠️ Report is 64 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #799      +/-   ##
==========================================
+ Coverage   65.72%   70.81%   +5.09%     
==========================================
  Files         113      116       +3     
  Lines        7926     6900    -1026     
==========================================
- Hits         5209     4886     -323     
+ Misses       2192     1441     -751     
- Partials      525      573      +48     
Components Coverage Δ
Generators 83.23% <ø> (+2.98%) ⬆️
Instruments ∅ <ø> (∅)
Go Driver 75.58% <65.38%> (-0.23%) ⬇️
Toolexec Driver 74.78% <100.00%> (+7.25%) ⬆️
Aspects 76.97% <76.37%> (+5.06%) ⬆️
Injector 77.17% <77.04%> (+4.38%) ⬆️
Job Server 71.00% <55.55%> (+5.08%) ⬆️
Other 70.81% <65.01%> (+5.09%) ⬆️
see 108 files with indirect coverage changes
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

github-merge-queue bot pushed a commit that referenced this pull request Mar 13, 2026
## Summary

Adds `code-coverage.datadog.yml` to configure Datadog Code Coverage
ignore rules. This is a prerequisite for the coverage upload PR (#799) —
the Datadog coverage reducer discovers this config file from the default
branch via GitDB, so it must be merged to `main` before coverage uploads
will apply ignore rules correctly.

### Ignore rules

Excludes the following from coverage reporting (matching the existing
Codecov behavior):
- `samples/` and `_samples/` — test fixture directories
- `_tools/` — build tooling
- `dot_ast.proxies.go` — generated proxy file

Includes both repo-relative paths and glob patterns to handle the Go
module path resolver's suffix-matching limitation (where `_samples` Go
module maps to `samples/` directory on disk).

### Context

Part of the Codecov → Datadog Code Coverage migration. See #799 for the
full upload integration.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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