Skip to content

Fix metrics-api JaCoCo coverage gate - #12456

Open
dougqh wants to merge 1 commit into
masterfrom
dougqh/metrics-api-jacoco-coverage
Open

Fix metrics-api JaCoCo coverage gate#12456
dougqh wants to merge 1 commit into
masterfrom
dougqh/metrics-api-jacoco-coverage

Conversation

@dougqh

@dougqh dougqh commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

  • products/metrics/metrics-api never opted into the excludedClassesCoverage convention used by sibling modules, so the repo-wide 0.9 minimum instruction/branch coverage rule failed for every NoOp* class as soon as CI ran this module's full check task (module-scoped CI hadn't run a full check here in a while).
  • Excludes the true no-op classes (NoOpCounter, NoOpHistogram, NoOpHistogramsFactory, NoOpMonitoring, NoOpRecording, NoOpStatsDClient) and the pure-interface Monitoring.
  • Adds the module's first src/test tree with real unit tests for the classes that have actual untested logic: Histograms (registration + static factory dispatch), StatsDClientManager (default 5-arg overload delegating to the 6-arg one), Recording (close() delegates to stop()), and a small StatsDClient test to clear its default recordEvent method.

Motivation

Unrelated to any in-flight feature work — this is a pre-existing coverage gap surfaced while working on #12351, which switched metrics-api's build.gradle.kts to the dd-trace-java.module.internal-api plugin and newly exposed the module to this gate. Kept as its own PR rather than folded into #12351, since the two are independent and shouldn't be reviewed together.

Additional Notes

  • Test plan:
    • ./gradlew :products:metrics:metrics-api:test
    • ./gradlew :products:metrics:metrics-api:jacocoTestCoverageVerification
    • ./gradlew :products:metrics:metrics-api:check

Contributor Checklist

  • Format the title according to the contribution guidelines
  • Assign the type: and (comp: or inst:) labels in addition to any other useful labels
  • Avoid using close, fix, or any linking keywords when referencing an issue
  • Update the CODEOWNERS file on source file addition, migration, or deletion (n/a — no new top-level source areas)
  • Update public documentation with any new configuration flags or behaviors (n/a — no config/behavior change)
  • Once approved, use merge queue to merge the PR

Jira ticket: none — pre-existing gap found incidentally, not tracked separately

🤖 Generated with Claude Code

The module never opted into the excludedClassesCoverage convention
used by sibling modules, so the repo-wide 0.9 minimum instruction/
branch coverage rule failed for every NoOp* class as soon as CI ran
this module's full check task. Exclude the true no-op classes and
add real unit tests for the classes with actual logic (Histograms
registration/dispatch, StatsDClientManager's default overload,
Recording.close() delegating to stop()).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dougqh dougqh added type: bug fix Bug fix tag: no release notes Changes to exclude from release notes comp: metrics Metrics tag: ai generated Largely based on code generated by an AI or LLM labels Sep 11, 2026
@datadog-datadog-us1-prod

This comment has been minimized.

@dd-octo-sts

dd-octo-sts Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.79 s 14.68 s [-0.2%; +1.7%] (no difference)
startup:insecure-bank:tracing:Agent 13.62 s 13.70 s [-1.3%; +0.2%] (no difference)
startup:petclinic:appsec:Agent 17.60 s 17.34 s [+0.6%; +2.4%] (maybe worse)
startup:petclinic:iast:Agent 17.49 s 17.62 s [-1.6%; +0.1%] (no difference)
startup:petclinic:profiling:Agent 17.38 s 17.48 s [-1.6%; +0.4%] (no difference)
startup:petclinic:sca:Agent 16.88 s 17.49 s [-7.7%; +0.7%] (no difference)
startup:petclinic:tracing:Agent 16.56 s 16.64 s [-1.5%; +0.4%] (no difference)

Commit: be114a1c · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@dougqh
dougqh marked this pull request as ready for review September 11, 2026 11:30
@dougqh
dougqh requested review from a team as code owners September 11, 2026 11:30
@dougqh
dougqh requested review from amarziali and mhlidd and removed request for a team September 11, 2026 11:30

@datadog-datadog-us1-prod datadog-datadog-us1-prod Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Datadog Autotest: PASS

More details

The coverage exclusions match the no-op and interface classes. The new tests cover the remaining default and factory behavior.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Datadog Autotest · Commit be114a1 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: metrics Metrics tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant