Skip to content

Remove default methods from CoreSpan; implement them in test doubles#11782

Open
dougqh wants to merge 2 commits into
masterfrom
dougqh/corespan-coverage-exclude
Open

Remove default methods from CoreSpan; implement them in test doubles#11782
dougqh wants to merge 2 commits into
masterfrom
dougqh/corespan-coverage-exclude

Conversation

@dougqh

@dougqh dougqh commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

What This Does

Removes the default methods from CoreSpan

Motivation

The default methods on CoreSpan were effectively test-only methods, since they are overwritten by DDSpan

My preference is to not have test-only code in production classes. Given that these methods were causing coverage checks to fail, I thought it best to simply remove them.

Test plan

  • ./gradlew :dd-trace-core:jacocoTestCoverageVerification -PcheckCoverage no longer flags CoreSpan

🤖 Generated with Claude Code

dougqh and others added 2 commits June 29, 2026 10:46
…y DDSpan

The four defaults (getServiceNameSource, isKind, unsafeGetTag x2) are
unreachable in practice; DDSpan overrides each with a different implementation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The four defaults (getServiceNameSource, isKind, unsafeGetTag x2) were
unreachable in practice because DDSpan overrides each one. Making them
abstract forces test implementations to be explicit, and coverage is
satisfied by the concrete implementations rather than unreachable defaults.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dd-octo-sts

dd-octo-sts Bot commented Jun 29, 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 13.94 s 13.87 s [-0.2%; +1.3%] (no difference)
startup:insecure-bank:tracing:Agent 12.89 s 12.93 s [-1.1%; +0.6%] (no difference)
startup:petclinic:appsec:Agent 16.96 s 16.72 s [+0.4%; +2.5%] (maybe worse)
startup:petclinic:iast:Agent 16.88 s 16.92 s [-1.2%; +0.7%] (no difference)
startup:petclinic:profiling:Agent 16.77 s 16.43 s [-2.5%; +6.6%] (no difference)
startup:petclinic:sca:Agent 16.88 s 16.81 s [-0.6%; +1.5%] (no difference)
startup:petclinic:tracing:Agent 16.03 s 15.98 s [-0.7%; +1.4%] (no difference)

Commit: d1117c7b · 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 changed the title Exclude CoreSpan from coverage Remove default methods from CoreSpan; implement them in test doubles Jun 29, 2026
@dougqh dougqh marked this pull request as ready for review June 29, 2026 16:36
@dougqh dougqh requested a review from a team as a code owner June 29, 2026 16:36
@dougqh dougqh requested a review from ygree June 29, 2026 16:36
@dd-octo-sts dd-octo-sts Bot added the tag: ai generated Largely based on code generated by an AI or LLM label Jun 29, 2026
@dd-octo-sts

dd-octo-sts Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Hi! 👋 Thanks for your pull request! 🎉

To help us review it, please make sure to:

  • Add at least one type, and one component or instrumentation label to the pull request

If you need help, please check our contributing guidelines.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d1117c7b82

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

default CharSequence getServiceNameSource() {
return null;
}
CharSequence getServiceNameSource();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Implement the new CoreSpan methods in traceAgentTest

Making getServiceNameSource() abstract leaves another in-repo CoreSpan implementation unupdated: dd-trace-core/src/traceAgentTest/groovy/TraceGenerator.groovy:121 declares PojoSpan implements CoreSpan<PojoSpan> but does not implement getServiceNameSource (nor the newly abstract unsafeGetTag/isKind). That source set is registered by dd-trace-core/build.gradle via addTestSuite('traceAgentTest'), so any traceAgentTest compile/run now fails before exercising those tests.

Useful? React with 👍 / 👎.

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

Labels

tag: ai generated Largely based on code generated by an AI or LLM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant