Migrate dd-trace-core groovy files to java part 13 - #12253
Conversation
we migrate 17 tests: - ConflatingMetricAggregatorTest - FootprintForkedTest - MetricsAggregatorFactoryTest - MetricsReliabilityTest - OkHttpSinkTest - SerializingMetricWriterTest - AllSamplerTest - AsmStandaloneSamplerTest - DeterministicSpanSamplerTest - DeterministicTraceSamplerTest - ForcePrioritySamplerTest - RateByServiceTraceSamplerTest - RuleBasedSamplingTest - SamplerTest - SingleSpanSamplerTest - SpanSamplingRulesTest - TraceSamplingRulesTest
|
Hi! 👋 Thanks for your pull request! 🎉 To help us review it, please make sure to:
If you need help, please check our contributing guidelines. |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 37bcdd17fc
ℹ️ 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".
|
|
||
| // writer should be reset if reporting fails | ||
| assertTrue(latchTriggered); | ||
| verify(writer, atLeastOnce()).startBucket(anyInt(), anyLong(), anyLong()); |
There was a problem hiding this comment.
Preserve the exact serialization-failure call count
If the reporting loop invokes startBucket more than once after this serialization error, atLeastOnce() still passes, whereas the migrated Spock interaction required exactly one invocation. This weakens the test so repeated failing writes or retries can regress unnoticed; retain the original cardinality with times(1).
Useful? React with 👍 / 👎.
| Collections.singletonList( | ||
| new SimpleSpan("", "", "", "", false, false, false, 0, 0, HTTP_OK))); | ||
|
|
||
| clearInvocations(sink); |
There was a problem hiding this comment.
Clear sink invocations before publishing
With the 1 ms reporting interval, the scheduled reporter can process this trace after publish but before clearInvocations; the clear then erases the unexpected sink call, and the subsequent forced report is empty, so verifyNoInteractions passes even if an unmeasured trace was incorrectly reported. Move the clear before publish, as the following test already does.
Useful? React with 👍 / 👎.
| long after = footprint(aggregator, features); | ||
| assertTrue(after - baseline <= 10L * 1024 * 1024, "footprint growth exceeds 10MB"); | ||
|
|
||
| aggregator.close(); |
There was a problem hiding this comment.
Close the footprint aggregator on assertion failures
When the acknowledged-flaky footprint assertion or either preceding timeout fails, execution never reaches this close, whereas the original Spock cleanup block always ran. Because start() launches an aggregator thread and scheduled reporter and this table has six invocations in the same test JVM, the leaked instance can continue running and interfere with later footprint cases; put the lifecycle in a try/finally.
Useful? React with 👍 / 👎.
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
There was a problem hiding this comment.
The Java migration weakens one exact call-count check. A repeated startBucket call now passes in the serialization-error test, but the old Groovy test rejects it.
🤖 Datadog Autotest · Commit 37bcdd1 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
|
|
||
| // writer should be reset if reporting fails | ||
| assertTrue(latchTriggered); | ||
| verify(writer, atLeastOnce()).startBucket(anyInt(), anyLong(), anyLong()); |
There was a problem hiding this comment.
Keep the exact startBucket call count
A later retry defect can reach production because this test no longer rejects repeated failed bucket starts.
Assertion details
- Input: The periodic reporter calls
startBucketmore than once after a serialization failure. - Expected: The test must require exactly one
startBucketcall, as the original Groovy test does. - Actual: The migrated test uses
atLeastOnce(). It passes whenstartBucketruns two or more times.
| verify(writer, atLeastOnce()).startBucket(anyInt(), anyLong(), anyLong()); | |
| verify(writer, times(1)).startBucket(anyInt(), anyLong(), anyLong()); |
Was this helpful? React 👍 or 👎
🤖 Datadog Autotest · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
What Does This Do
we migrate 17 tests:
Motivation
this is part of the effort to migrate groovy tests to Java/JUnit
part1: #11053
part2: #11062
part3: #11085
part4: #11146
part5: #11217
part6: #11362
part7: #11374
part8: #11437
part9: #11488
part10: #11543
part11: #11566
part12: #11619
Additional Notes
Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]