Repository navigation
Conversation
Extracting from a record with no headers can't find a context, but it still built the carrier caches and ran every propagator, for every record consumed and every record sent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
🟢 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. |
Kafka / producer-benchmarkParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics. See unchanged results
|
Kafka / consumer-benchmarkParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics. See unchanged results
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Does This Do
Kafka consumers and producers (kafka-clients 0.11 and 3.8) now skip context extraction for a record with no headers. Such a record can't carry a context, but extraction still built its carrier caches and ran every propagator over nothing, for every record consumed and every record sent.
Behavior doesn't change: with no headers, extraction always returned no context, so a record without headers still gets no extracted context.
Motivation
Records without headers are common. A consumer sees them from untraced producers, and a producer sees them on most of what it sends, since its own headers are only added afterward.
KafkaConsumeScenariosBenchmarkgains atraceHeadersparameter;falsegives records with no headers. 500-record batches throughTracingIterator(JDK 17, 3 forks, per record):dataStreamstraceHeadersFor a record without headers that's about 390 B and 65 ns less, about a fifth of the tracer's allocation for that record. Records with trace headers are unchanged. The producer path makes the same extraction call on each send, so it should save about the same, though only the consumer is benchmarked here.
Additional Notes
Headershas nosize()orisEmpty().toArray()would copy every traced record's headers just to test for none, sohasHeaderschecksiterator().hasNext(). The benchmark shows the iterator doesn't allocate on traced records.🤖 Generated with Claude Code