Repository navigation
Conversation
Read value, key and the delivery callback from kwargs/args with membership and length checks instead of get_argument_value/set_argument_value, which raised and caught up to ~8 exceptions per produced message. Behavior is unchanged, including leaving positional callbacks unwrapped. A unit test pins argument lookup and callback wrapping. DSM2-903
Add exact str/bytes fast paths to _calculate_byte_size (ASCII strings are measured without encoding). On consume, compute the header size and collect the pathway headers in a single loop instead of also building dict(headers). Repeated keys keep last-wins semantics. Tests pin byte sizes and the consume hook's payload size and parent pathway. DSM2-901
Import data_streams_processor at module level instead of on every hook call; it is now defined before the integration imports in ddtrace.internal.datastreams so the kafka module can import it without a cycle. Drop the hasattr(message, "len") check: confluent_kafka.Message has no len() method, so the value was always measured. DSM2-902
- Cache str(hash) next to the pathway hash so tagging a span does not format it on every checkpoint. - Compute the produce pathway header length arithmetically instead of encoding the context to measure it. - Read the thread-local context once. - Look up the stats bucket once in on_checkpoint_creation and join the edge tags outside the lock. The hash cache stays keyed on tuple(tags) and base_hash_bytes: keying it on the comma-joined tags could collide for tags containing commas. on_checkpoint_creation remains the single aggregation path rather than being inlined into DataStreamsCtx.set_checkpoint. Tests pin the header size, span tag, and serialized stats. DSM2-904
Dependency direction analysis
|
Codeowners resolved asResolved from the full PR diff against |
BenchmarksBenchmark execution time: 2026-11-26 13:47:40 Comparing candidate commit 7d5fc46 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 585 metrics, 10 unstable metrics, 1 flaky benchmarks without significant changes.
|
Stacked on #21963. Python-only, behavior-preserving changes to the Kafka DSM hooks (DSM2-794):
set_checkpoint: cachedstr(hash), arithmetic header length, one thread-local read, one bucket lookup.Stats are unchanged (hashes, parents, payload sizes, counts), pinned by new tests. One difference: malformed consumed headers now record size 0 instead of raising
ValueError.Speedlab numbers to follow (DSM share = (apm+dsm − apm-only)/(apm-only − baseline)).