Skip to content

feat(contrib): add twmb/franz-go integration#4250

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 134 commits into
mainfrom
augusto/add-twmb-franz-go-integration
Apr 23, 2026
Merged

feat(contrib): add twmb/franz-go integration#4250
gh-worker-dd-mergequeue-cf854d[bot] merged 134 commits into
mainfrom
augusto/add-twmb-franz-go-integration

Conversation

@igoragoli

@igoragoli igoragoli commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

Motivation

#2735

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • New code is free of linting errors. You can check this by running ./scripts/lint.sh locally.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

@pr-commenter

pr-commenter Bot commented Dec 11, 2025

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-04-23 13:46:48

Comparing candidate commit e208912 in PR branch augusto/add-twmb-franz-go-integration with baseline commit 1e2f4d4 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 271 metrics, 7 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

@igoragoli
igoragoli force-pushed the augusto/add-twmb-franz-go-integration branch from 53976be to 1d2f77e Compare December 18, 2025 14:28
@datadog-official

datadog-official Bot commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 61.01% (+4.36%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: e208912 | Docs | Datadog PR Page | Give us feedback!

@codecov

codecov Bot commented Dec 24, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.20%. Comparing base (1e2f4d4) to head (97fc6d7).

Additional details and impacted files
Files with missing lines Coverage Δ
ddtrace/tracer/option.go 84.11% <ø> (ø)
instrumentation/packages.go 6.49% <ø> (ø)
internal/stacktrace/contribs_generated.go 100.00% <100.00%> (ø)

... and 437 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@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: 97fc6d7ed4

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread contrib/twmb/franz-go/carrier.go Outdated
for i, h := range c.record.Headers {
if h.Key == key {
c.record.Headers[i].Value = []byte(val)
return

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 Remove duplicate Kafka propagation headers

When a record already contains multiple headers for the same propagation key (franz-go stores headers as a slice, so this can happen when forwarding or reusing records), this return updates only the first value and leaves stale duplicates behind. ForeachKey later passes every duplicate to tracer.Extract; W3C extraction rejects duplicate traceparent, and Datadog extraction can let a later stale duplicate overwrite the value, so downstream consumers may lose or attach to the wrong parent context.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@igoragoli Does this make sense to you?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When a record already contains multiple headers for the same propagation key (franz-go stores headers as a slice, so this can happen when forwarding or reusing records)

Thank you, Dario! I have to check this assumption. I'll look into it later today :)

@darccio darccio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, although I'd address the Codex finding.

genesor and others added 7 commits April 23, 2026 10:23
…4629)

### What does this PR do?

Adds orchestrion support for the twmb/franz-go integration:

- Adds `orchestrion.yml` aspect that hooks into `kgo.NewClient()` and
appends `WithTracing()` to enable automatic distributed tracing
- Registers the aspect in `orchestrion/all`
- Adds an orchestrion integration test at
`internal/orchestrion/_integration/twmb_franz_go/`
- Adds the franz-go replace directive to the integration test module

### Motivation

Enable automatic instrumentation of franz-go Kafka clients via
orchestrion, matching the existing pattern used by other integrations
(gRPC, segmentio/kafka-go, etc.).

### Reviewer's Checklist

- [ ] Changed code has unit tests for its functionality at or near 100%
coverage.
- [ ] [System-Tests](https://github.com/DataDog/system-tests/) covering
this feature have been added and enabled with the va.b.c-dev version
tag.
- [ ] There is a benchmark for any new code, or changes to existing
code.
- [ ] If this interacts with the agent in a new way, a system test has
been added.
- [ ] New code is free of linting errors. You can check this by running
`make lint` locally.
- [ ] New code doesn't break existing tests. You can check this by
running `make test` locally.
- [ ] Add an appropriate team label so this PR gets put in the right
place for the release notes.
- [ ] All generated files are up to date. You can check this by running
`make generate` locally.
- [ ] Non-trivial go.mod changes, e.g. adding new modules, are reviewed
by @DataDog/dd-trace-go-guild. Make sure all nested modules are up to
date by running `make fix-modules` locally.
@genesor
genesor requested a review from a team as a code owner April 23, 2026 11:05

@genesor genesor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Great work 🚀

@Teko012

Teko012 commented Apr 24, 2026

Copy link
Copy Markdown

Do you know which version are you targeting this for?

darccio pushed a commit that referenced this pull request Apr 24, 2026
<!--
* New contributors are highly encouraged to read our
  [CONTRIBUTING](/CONTRIBUTING.md) documentation.
* Commit and PR titles should be prefixed with the general area of the pull request's change.

-->

- Adds a [twmb/franz-go](https://github.com/twmb/franz-go?tab=readme-ov-file) integration.

<!--
* A brief description of the change being made with this pull request.
* If the description here cannot be expressed in a succinct form, consider
  opening multiple pull requests instead of a single one.
-->

#2735

<!--
* What inspired you to submit this pull request?
* Link any related GitHub issues or PRs here.
* If this resolves a GitHub issue, include "Fixes #XXXX" to link the issue and auto-close it on merge.
-->

<!--
* Authors can use this list as a reference to ensure that there are no problems
  during the review but the signing off is to be done by the reviewer(s).
-->

- [x] Changed code has unit tests for its functionality at or near 100% coverage.
- [ ] [System-Tests](https://github.com/DataDog/system-tests/) covering this feature have been added and enabled with the va.b.c-dev version tag.
- [ ] There is a benchmark for any new code, or changes to existing code.
- [ ] If this interacts with the agent in a new way, a system test has been added.
- [ ] New code is free of linting errors. You can check this by running `./scripts/lint.sh` locally.
- [ ] Add an appropriate team label so this PR gets put in the right place for the release notes.
- [ ] Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

Co-authored-by: genesor <[email protected]>
Co-authored-by: rarguelloF <[email protected]>
Co-authored-by: augusto.deoliveira <[email protected]>
@genesor

genesor commented Apr 24, 2026

Copy link
Copy Markdown
Member

Hi @Teko012, we've included this PR in the ongoing v2.8.0 release, https://github.com/DataDog/dd-trace-go/tree/release-v2.8.x

It's currently being tested internally and should be released soon.

@jmsbtlr111

Copy link
Copy Markdown

Looking forward to this addition! Thank you all who contributed.

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

Labels

apm:ecosystem contrib/* related feature requests or bugs mergequeue-status: done

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants