Skip to content

Add lazy-transformer to KeyClassifier for deferred header decoding#11466

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
masterfrom
andrea.marziali/propagators-transform
Jun 1, 2026
Merged

Add lazy-transformer to KeyClassifier for deferred header decoding#11466
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
masterfrom
andrea.marziali/propagators-transform

Conversation

@amarziali
Copy link
Copy Markdown
Contributor

What does this do

Adds a default generic method to AgentPropagation.KeyClassifier:

default <T> boolean accept(String key, T value, Function<T, String> transformer)

The default applies the transformer eagerly and delegates to accept(String, String), so existing classifiers need no changes.

Motivation

Some carriers store header values in raw form (e.g. byte[]) and have to convert them to strings before calling accept. Right now that conversion happens for every header, including the ones the classifier immediately ignores.

An example is kafka that's decoding into base64 all the headers without knowing if it's needed.

This overload lets callers pass the raw value and a conversion function. A classifier that rejects unknown keys early never pays for the conversion at all.

The concrete follow-up is the Kafka TextMapExtractAdapter, where Base64-decoding all message headers is wasteful and currently throws IllegalArgumentException on non-Base64 input. That fix comes in a separate PR.

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]

@amarziali amarziali requested review from a team as code owners May 27, 2026 09:52
@amarziali amarziali requested review from mcculls and mtoffl01 and removed request for a team May 27, 2026 09:52
@amarziali amarziali added type: enhancement Enhancements and improvements comp: context propagation Trace context propagation labels May 27, 2026
Copy link
Copy Markdown
Contributor

@sarahchen6 sarahchen6 left a comment

Choose a reason for hiding this comment

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

Cool!

@amarziali
Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351
Copy link
Copy Markdown

gh-worker-devflow-routing-ef8351 Bot commented Jun 1, 2026

View all feedbacks in Devflow UI.

2026-06-01 08:12:49 UTC ℹ️ Start processing command /merge


2026-06-01 08:12:59 UTC ℹ️ MergeQueue: waiting for PR to be ready

This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
It will be added to the queue as soon as checks pass and/or get approvals. View in MergeQueue UI.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2026-06-01 10:58:14 UTC ℹ️ MergeQueue: merge request added to the queue

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


2026-06-01 12:03:47 UTC ℹ️ MergeQueue: This merge request was merged

@amarziali amarziali added type: enhancement Enhancements and improvements and removed type: enhancement Enhancements and improvements labels Jun 1, 2026
@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented Jun 1, 2026

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.

@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented Jun 1, 2026

🟢 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 14.02 s 14.07 s [-1.7%; +1.0%] (no difference)
startup:insecure-bank:tracing:Agent 12.86 s 12.96 s [-1.8%; +0.3%] (no difference)
startup:petclinic:appsec:Agent 16.64 s 16.59 s [-1.1%; +1.7%] (no difference)
startup:petclinic:iast:Agent 16.67 s 16.70 s [-1.5%; +1.1%] (no difference)
startup:petclinic:profiling:Agent 16.70 s 16.62 s [-1.1%; +2.1%] (no difference)
startup:petclinic:tracing:Agent 15.74 s 16.08 s [-3.5%; -0.8%] (maybe better)

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

@amarziali amarziali enabled auto-merge June 1, 2026 10:50
@amarziali amarziali added this pull request to the merge queue Jun 1, 2026
@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented Jun 1, 2026

/merge

@gh-worker-devflow-routing-ef8351
Copy link
Copy Markdown

gh-worker-devflow-routing-ef8351 Bot commented Jun 1, 2026

View all feedbacks in Devflow UI.

2026-06-01 10:57:56 UTC ℹ️ Start processing command /merge


2026-06-01 10:57:58 UTC ❌ MergeQueue

PR already in the queue with status waiting

@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 1, 2026
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot merged commit d0c5732 into master Jun 1, 2026
572 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot deleted the andrea.marziali/propagators-transform branch June 1, 2026 12:03
@github-actions github-actions Bot added this to the 1.63.0 milestone Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: context propagation Trace context propagation type: enhancement Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants