Skip to content

Port TraceMapperV0_4/V0_5 payload tests from Spock to JUnit 5#11871

Draft
dougqh wants to merge 1 commit into
masterfrom
dougqh/port-tracemapper-tests
Draft

Port TraceMapperV0_4/V0_5 payload tests from Spock to JUnit 5#11871
dougqh wants to merge 1 commit into
masterfrom
dougqh/port-tracemapper-tests

Conversation

@dougqh

@dougqh dougqh commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What

Migrates TraceMapperV04PayloadTest and TraceMapperV05PayloadTest from Groovy/Spock to JUnit 5 Java. TraceMapperV1PayloadTest and TraceMapperTest are left untouched (V1 is newer and not yet in production — deferred).

Details

  • Both where: tables → @MethodSource providers, preserving the 10<<10/100<<10 shift intent (not flattened to decimals).
  • V0.4's metaStruct verifier closure → a @FunctionalInterface MetaStructVerifier<E>.
  • The format-agnostic decode helpers — assertEqualsWithNullAsEmpty, the metrics unpackNumber switch, and the growable capturing WritableByteChannel — are extracted to a shared PayloadVerifiers helper reused by both tests. The two PayloadVerifiers themselves stay per-test because V0.4 (inline strings) and V0.5 (dictionary-compressed string indices) decode different wire formats.

Two behaviors that DDSpecification / Groovy provided implicitly are now explicit:

  1. Numeric metrics are compared via longValue(). Groovy's dynamic dispatch routed assertEquals(Long, Integer) to the primitive assertEquals(long, long) overload (numeric equality); Java's static overload resolution would pick the Object overload and compare by reference type, which fails once msgpack's minimal encoding narrows a Long thread id back to an Integer.
  2. ProcessTags lifecycle: the ProcessTags static is re-synced to the per-test Config via @ExtendWith(WithConfigExtension.class) + a @BeforeEach, and the body-overflow test disables process tags with @WithConfig (so the dictionary-size calculation stays stable).

Testing

Test count is unchanged: V0.4 = 23, V0.5 = 30 (53 total), all green. Verified the original Groovy suite passes in the same environment before porting.

🤖 Generated with Claude Code

Migrate TraceMapperV04PayloadTest and TraceMapperV05PayloadTest from
Groovy/Spock to JUnit 5 Java (V0.1/V1 deferred). The two `where:` tables
become @MethodSource providers (preserving the `10<<10` shift intent),
the V0.4 metaStruct closure becomes a @FunctionalInterface, and the
format-agnostic decode helpers (assertEqualsWithNullAsEmpty, the metrics
unpackNumber switch, and the growable capturing channel) are extracted to
a shared PayloadVerifiers helper reused by both. The two format-specific
PayloadVerifiers stay per-test since V0.4 (inline strings) and V0.5
(dictionary-compressed indices) decode different wire formats.

Two behaviors DDSpecification/Groovy provided implicitly are made
explicit: (1) numeric metrics are compared via longValue() — Groovy's
dynamic dispatch routed assertEquals(Long,Integer) to the primitive
long overload, whereas Java's static resolution would compare by
reference type after msgpack's minimal encoding narrows a Long to an
Integer; (2) the ProcessTags static is re-synced to the per-test Config
via @ExtendWith(WithConfigExtension) + a @beforeeach, with the overflow
test disabling process tags via @WithConfig.

Test count is unchanged (V0.4=23, V0.5=30).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dougqh dougqh added comp: core Tracer core tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes type: refactoring labels Jul 6, 2026
@datadog-prod-us1-5

This comment has been minimized.

@dd-octo-sts

dd-octo-sts Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🟡 Java Benchmark SLOs — Performance SLO warning (near threshold)

Suite Status
Startup 🟡 warning

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.96 s 13.93 s [-0.5%; +1.0%] (no difference)
startup:insecure-bank:tracing:Agent 12.87 s 12.95 s [-1.5%; +0.2%] (no difference)
startup:petclinic:appsec:Agent 17.03 s 16.87 s [-5.2%; +7.0%] (unstable)
startup:petclinic:iast:Agent 16.86 s 17.02 s [-7.0%; +5.1%] (unstable)
startup:petclinic:profiling:Agent 17.34 s 17.39 s [-2.3%; +1.6%] (no difference)
startup:petclinic:sca:Agent 17.44 s 17.03 s [-2.1%; +6.9%] (no difference)
startup:petclinic:tracing:Agent 16.45 s 16.29 s [-3.3%; +5.3%] (no difference)

Commit: 4e2187f8 · 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.

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

Labels

comp: core Tracer core tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant