Skip to content

Migrate dd-trace-core groovy files to java part 9 - #11488

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 5 commits into
masterfrom
jpbempel/g2j-core-pt9
May 29, 2026
Merged

Migrate dd-trace-core groovy files to java part 9#11488
gh-worker-dd-mergequeue-cf854d[bot] merged 5 commits into
masterfrom
jpbempel/g2j-core-pt9

Conversation

@jpbempel

Copy link
Copy Markdown
Member

What Does This Do

we migrate 20 tests from the propagation package:

  • TagKeyTest
  • TagValueTest
  • B3HttpExtractorTest
  • B3HttpInjectorPaddedTest
  • B3HttpInjectorTest
  • DatadogHttpExtractorTest
  • DatadogHttpInjectorTest
  • DatadogPropagationTagsTest
  • HaystackHttpExtractorTest
  • HaystackHttpInjectorTest
  • HttpExtractorTest
  • HttpInjectorB3PaddingTest
  • HttpInjectorTest
  • NoneHttpExtractorTest
  • TracingPropagatorTest
  • W3CHttpExtractorTest
  • W3CHttpInjectorTest
  • W3CPropagationTagsTest
  • XRayHttpExtractorTest
  • XRayHttpInjectorTest

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

Additional Notes

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
    Use solves instead, and assign the PR milestone to the issue
  • Update the CODEOWNERS file on source file addition, migration, or deletion
  • Update public documentation with any new configuration flags or behaviors
  • Add your completed PR to the merge queue by commenting /merge. You can also:
    • Customize the commit message associated with the merge with /merge --commit-message "..."
    • Remove your PR from the merge queue with /merge -c
    • Skip all merge queue checks with /merge -f --reason "reason"; please use this judiciously, as some checks do not run at the PR-level
    • Get more information in this doc

Jira ticket: [PROJ-IDENT]

@jpbempel
jpbempel requested review from a team as code ownersMay 28, 2026 12:21
@jpbempel
jpbempel requested review from mcculls and mtoffl01 and removed request for a teamMay 28, 2026 12:21
@dd-octo-sts

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.

@datadog-official

This comment has been minimized.

@jpbempeljpbempel added comp: testing Testing tag: no release notes Changes to exclude from release notes labels May 28, 2026

@bric3bric3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Conversion-specific Mockito comments.

singletonMap("k", "v"));
Map<String, String> carrier = mock(Map.class);

mockedContext.beginEndToEnd();

@bric3bric3May 28, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The Groovy test verified both time-source calls before 0 * _, but this conversion only checks the carrier. Suggested fix: clear the stubbing/build noise before beginEndToEnd(), then verify the two time-source calls too.

clearInvocations(timeSource);
mockedContext.beginEndToEnd();
injector.inject(mockedContext, carrier, MapSetter.INSTANCE);
verify(timeSource).getCurrentTimeNanos();
verify(timeSource).getNanoTicks();
verify(carrier)
.put(
"X-Amzn-Trace-Id",
"Root=1-633c7675-000000000000000000000001;Parent=0000000000000002;_dd.origin=fakeOrigin;t0=1664906869195;k=v");
verifyNoMoreInteractions(timeSource, carrier);

That keeps the Mockito version as strict as the original Spock interaction block.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

done


propagator.inject(span, carrier, setter);

verify(injector).inject(any(DDSpanContext.class), same(carrier), any());

@bric3bric3May 28, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The Spock assertion matched span.context() specifically. Suggested fix: keep that exact-context check in the Mockito verify instead of accepting any DDSpanContext.

verify(injector).inject(same((DDSpanContext) span.context()), same(carrier), any());

same is already statically imported here, so this keeps the conversion tight without adding much noise.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

done


propagator.inject(span, carrier, setter);

verify(injector, times(injected)).inject(any(DDSpanContext.class), same(carrier), any());

@bric3bric3May 28, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same conversion concern here: the original interaction was tied to span.context(). Suggested fix: keep the times(injected) behavior, but match the same context instance.

verify(injector, times(injected))
.inject(same((DDSpanContext) span.context()), same(carrier), any());

That preserves the old assertion while keeping the converted table-test flow.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

done

@jpbempel
jpbempelforce-pushed the jpbempel/g2j-core-pt9 branch from 952a80e to 588ea9bCompareMay 28, 2026 17:09
@dd-octo-sts

dd-octo-stsBot commented May 28, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

SuiteStatus
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

Startup Time

ScenarioThis PRmasterChange
insecure-bank / iast13,887 ms14,023 ms-1.0%
insecure-bank / tracing12,985 ms13,009 ms-0.2%
petclinic / appsec16,569 ms15,330 ms+8.1%
petclinic / iast16,493 ms15,733 ms+4.8%
petclinic / profiling16,413 ms16,514 ms-0.6%
petclinic / tracing15,784 ms15,902 ms-0.7%

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

@amarzialiamarziali left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks good. left minor comments

verify(carrier).put(OT_BAGGAGE_PREFIX + "k1", "v1");
verify(carrier).put(OT_BAGGAGE_PREFIX + "k2", "v2");
verify(carrier).put("SOME_CUSTOM_HEADER", "some-value");
verify(carrier).put(DD_PARENT_ID_BAGGAGE_KEY, "0");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
verify(carrier).put(DD_PARENT_ID_BAGGAGE_KEY, "0");
verify(carrier).put(DD_PARENT_ID_BAGGAGE_KEY, "0");
verifyNoMoreInteractions(carrier);

verify(carrier).put(SPAN_ID_KEY, spanUuid);
verify(carrier).put(DD_SPAN_ID_BAGGAGE_KEY, spanId);
verify(carrier).put(OT_BAGGAGE_PREFIX + "k1", "v1");
verify(carrier).put(OT_BAGGAGE_PREFIX + "k2", "v2");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
verify(carrier).put(OT_BAGGAGE_PREFIX + "k2", "v2");
verify(carrier).put(OT_BAGGAGE_PREFIX + "k2", "v2");
verifyNoMoreInteractions(carrier);

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

this is not what is done in groovy, and does not work

private static final CarrierSetter<Map<String, String>> MAP_SETTER = Map::put;

private final HttpCodec.Injector injector =
HaystackHttpCodec.newInjector(singletonMap("some-baggage-key", "SOME_CUSTOM_HEADER"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor: the groovy test closed the injector on cleanup

@jpbempel
jpbempel enabled auto-merge May 29, 2026 07:54
we migrate 20 tests from the propagation package:
- TagKeyTest
- TagValueTest
- B3HttpExtractorTest
- B3HttpInjectorPaddedTest
- B3HttpInjectorTest
- DatadogHttpExtractorTest
- DatadogHttpInjectorTest
- DatadogPropagationTagsTest
- HaystackHttpExtractorTest
- HaystackHttpInjectorTest
- HttpExtractorTest
- HttpInjectorB3PaddingTest
- HttpInjectorTest
- NoneHttpExtractorTest
- TracingPropagatorTest
- W3CHttpExtractorTest
- W3CHttpInjectorTest
- W3CPropagationTagsTest
- XRayHttpExtractorTest
- XRayHttpInjectorTest
@jpbempel
jpbempelforce-pushed the jpbempel/g2j-core-pt9 branch from f8b5091 to be578afCompareMay 29, 2026 10:19
@jpbempel
jpbempel added this pull request to the merge queueMay 29, 2026
@dd-octo-sts

Copy link
Copy Markdown
Contributor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351Bot commented May 29, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-05-29 11:08:54 UTC ℹ️ Start processing command /merge


2026-05-29 11:08:58 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 1h (p90).


2026-05-29 12:16:47 UTC ℹ️ MergeQueue: This merge request was merged

@github-merge-queue
github-merge-queueBot removed this pull request from the merge queue due to failed status checks May 29, 2026
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854dBot merged commit 50466f1 into masterMay 29, 2026
572 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854dBot deleted the jpbempel/g2j-core-pt9 branch May 29, 2026 12:16
@github-actionsgithub-actionsBot added this to the 1.63.0 milestone May 29, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: testingTestingtag: no release notesChanges to exclude from release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@jpbempel@bric3@amarziali