Repository navigation
Conversation
…-612) DSM enabled via remote config (lib_config.data_streams_enabled) after startup with DD_DATA_STREAMS_ENABLED off never registered the DSM propagator, so no pathway context was injected. Register it when the live config first turns DSM on, check the live config first in inject, and use the live config for the payload ProductMask.
Replace startup-only Config.get().isDataStreamsEnabled() checks with the live trace config so DSM enabled by remote config takes effect for the _datadog attribute parser, SQS client builders and JMS producer/consumer.
…M2-612) Kafka clients are usually built before the first remote config poll, so always keep consumer metadata and pending client config at construction and gate cluster ID lookup and reporting on the live DSM config. With DSM off, spans and stored consumer info match previous behavior: no kafka.cluster_id on 0.11 and 3.8 async consume spans, while the 3.8 classic consumer keeps its existing tag.
The first metadata update consumed the pending config even with DSM off, so a later remote config enable never reported it. Also adds config-report coverage, a cluster-ID helper test, and closes a tracer in CoreTracerTest.
…startup (DSM2-612)
…le (DSM2-612) The worker re-reads the live config before dropping a data item, so one-shot items (Kafka config, group member) enqueued before the next report tick are kept.
…-612) Before the tracer is installed traceConfig() is the noop config, so construction time gates also check Config.get(); per-message paths keep using the live config.
…M2-612) Keep the ProducerConfig/ConsumerConfig reference instead of copying it at construction, so clients built with DSM off keep no extra map; raw map configs are still copied. Consumer construction gates also check the startup DSM config, since traceConfig() is the noop config before the tracer is installed. Adds KafkaConfigHelper.reportPendingConfig unit tests and comment nits.
…rebuild flag (DSM2-612) Clearing the flag first let a lock-free reader return the stale, possibly null, propagator. reset() now also clears the cached propagator, and the concurrency test races several readers against the first build.
🟢 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
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dfc6ec32eb
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
More details
DSM propagator registration is ordered against startup-time enablement, and the inbox rechecks live configuration before discarding queued items. Runtime behavior and overhead remain unverified.
🤖 Bits Code Review · Commit dfc6ec3
dougqh
left a comment
There was a problem hiding this comment.
The concurrency changes look right to me. Making Propagators rebuild under the map lock also fixes the race where a register() could get lost. /perf-review found nothing on the paths that run per message. One request before I approve: see the inline comment. With DSM off, the tracer shouldn't do extra work.
dougqh
left a comment
There was a problem hiding this comment.
One more gap, for SQS. It's more serious than a nit, but it doesn't need to block this PR: a follow-up PR works, as long as it's listed under "Known limits" until then.
dougqh
left a comment
There was a problem hiding this comment.
Thanks, both addressed. Reusing the ConsumerConfig Kafka already built, with the copy only on 2.7.x, is the right shape, and the test for changes made after construction covers the side issue. LGTM once it's rebased onto master. Looking forward to the SQS follow-up.
| return; | ||
| } | ||
| // Copied so later caller mutations aren't reported nor race with reporting threads | ||
| Map<String, Object> rawConfigCopy = new LinkedHashMap<>(rawConfig); |
There was a problem hiding this comment.
Nit: a plain HashMap would do here. Order doesn't matter anywhere this config goes: convertToStringMap copies it again, KafkaConfigReport equality uses Map.equals, and the payload writes it as a msgpack map. On 2.7.x with DSM off, this copy stays for the life of the consumer, so the extra links per entry in LinkedHashMap aren't needed.
joeyzhao2018
left a comment
There was a problem hiding this comment.
this pr LGTM but it's worth pointing out the feature itself can't work in any serverless runtime except Fargate. And I just found out that we didn't turn remote config off in lambda, which I will follow up with a separate PR.
lucaspimentel
left a comment
There was a problem hiding this comment.
AI-drafted review comments. 🤖
| int generationId, | ||
| String memberProtocol) { | ||
| if (memberId == null || memberId.isEmpty() || clusterId == null || clusterId.isEmpty()) { | ||
| if (memberId == null |
There was a problem hiding this comment.
Could we retain the membership observed while DSM is off and report it after enablement, as we do for pending client configs?
Returning here discards the membership, and the callers only retry on another group join. A consumer that joined before the RC toggle can therefore keep processing indefinitely without reporting its membership if the group remains stable. A regression test could join while DSM is disabled, enable it without triggering a rebalance, and verify that the membership is reported.
🤖
There was a problem hiding this comment.
Done in 99e2014 and ad067fa. A join seen while DSM is off, or before the cluster ID is known, is now kept on the consumer's metadata state. It's reported on the first metadata update after DSM is on, and a newer join replaces it. The join thread re-checks after storing, so a concurrent metadata update can't delay it. Covered by unit tests, and by subscribe()-based forked tests for 0.11 and 3.8 (b00f2c5) that enable DSM after the join with no rebalance.
| } | ||
|
|
||
| /** Re-reads the live config so items enqueued right after a remote enable are not dropped. */ | ||
| private boolean refreshDynamicConfig() { |
There was a problem hiding this comment.
Could we also initialize the configured transaction extractors when DSM becomes enabled?
updateExtractorsFromConfig() is only called at startup and returns immediately when DSM is disabled. A later RC enable updates supportsDataStreams but leaves extractorsByType null, so automatic trackTransaction(...) calls continue returning without recording anything. Please add coverage for starting with DSM off and an extractor configured, then enabling DSM and verifying transaction extraction.
🤖
There was a problem hiding this comment.
Done in 1dacd73. Extractors now load whenever DSM switches from off to on, through Remote Config or an agent feature change. They no longer load only at startup. dynamicEnableLoadsTransactionExtractors covers it.
| assertNotNull(onRecord.headers().lastHeader(PROPAGATION_KEY_BASE64)); | ||
| assertNotNull(consumeSpan().getTag(KAFKA_CLUSTER_ID)); | ||
| new PollingConditions(5) | ||
| .eventually(() -> { |
There was a problem hiding this comment.
Could we assert that the inbound group's parent hash matches the outbound group's hash after enablement? The same assertion would help in the Kafka 3.8 test.
The current checks establish that the producer injects a header and both sides emit checkpoints, but they would also pass if consumer extraction were broken and the inbound checkpoint started a separate pathway. Checking the parent/hash relationship would cover the end-to-end propagation this change restores.
🤖
There was a problem hiding this comment.
Done in 02436e0. Both forked tests now assert that the outbound hash is non-zero and that the inbound group's parent hash equals it.
…urrent metadata update (DSM2-612)
…ter remote config enable (DSM2-612)
What Does This Do
Lets Remote Config (
lib_config.data_streams_enabled) turn Data Streams Monitoring on at runtime for a service that started with DSM off:Mapreport Kafka's fullConsumerConfig, defaults included, like thePropertiesconstructor, rather than only the caller's keys (on 2.7.x, which builds no reachableConsumerConfig, the caller's map is kept and converted at report time).Propagators.register()calls. Concurrent callers never see a stale ornullpropagator.With DSM off, behaviour is unchanged apart from cheap live-config checks. Spans and stored consumer info stay the same as before.
Motivation
Since v1.47.0 (#8368), the DSM propagator was only registered when DSM was on at startup. Enabling DSM through Remote Config then produced no pathway context and no checkpoints, even though the setting showed as applied.
Additional Notes
Known limits:
group.idthat were built while DSM was off get nokafka_cluster_id.DD_TRACE_SQS_INJECT_DATADOG_ATTRIBUTE_ENABLED=false, SQS clients (AWS SDK v1 and v2) built while DSM was off get noSqsInterceptor, so a Remote Config enable has no effect on them. A follow-up PR will always add the interceptor and check the live settings per request.Tests run: unit tests, muzzle, spotless,
latestDepTest/latestDepForkedTestfor the touched modules, and new forked Remote Config toggle tests (DSM off at startup, enable, disable) for Kafka 0.11 and 3.8, SQS v1 and v2, and JMS. The JMS test checks stats only: JMS records DSM checkpoints for IBM MQ but never injects the pathway context (same as before this change). Verified end to end on a staging org: UI toggle on and off, no restart. JMH benchmarks were not run.Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: [DSM2-612]