Use routing key as DSM topic for RabbitMQ default-exchange publishes#11805
Use routing key as DSM topic for RabbitMQ default-exchange publishes#11805ericfirth wants to merge 1 commit into
Conversation
BenchmarksStartupParameters
See matching parameters
SummaryFound 6 performance improvements and 18 performance regressions! Performance is the same for 35 metrics, 12 unstable metrics.
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.60.0-SNAPSHOT~afe8664b0a, baseline=1.64.0-SNAPSHOT~b0cb50ff6e
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.068 s) : 0, 1067512
Total [baseline] (8.899 s) : 0, 8899018
Agent [candidate] (1.061 s) : 0, 1061115
Total [candidate] (8.76 s) : 0, 8759767
section iast
Agent [baseline] (1.251 s) : 0, 1250593
Total [baseline] (9.6 s) : 0, 9600325
Agent [candidate] (1.247 s) : 0, 1246545
Total [candidate] (9.452 s) : 0, 9451846
gantt
title insecure-bank - break down per module: candidate=1.60.0-SNAPSHOT~afe8664b0a, baseline=1.64.0-SNAPSHOT~b0cb50ff6e
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.21 ms) : 0, 1210
crashtracking [candidate] (1.196 ms) : 0, 1196
BytebuddyAgent [baseline] (639.053 ms) : 0, 639053
BytebuddyAgent [candidate] (628.404 ms) : 0, 628404
AgentMeter [baseline] (30.043 ms) : 0, 30043
AgentMeter [candidate] (29.178 ms) : 0, 29178
GlobalTracer [baseline] (248.22 ms) : 0, 248220
GlobalTracer [candidate] (252.698 ms) : 0, 252698
AppSec [baseline] (32.329 ms) : 0, 32329
AppSec [candidate] (33.359 ms) : 0, 33359
Debugger [baseline] (59.395 ms) : 0, 59395
Debugger [candidate] (63.312 ms) : 0, 63312
Remote Config [baseline] (602.601 µs) : 0, 603
Remote Config [candidate] (627.572 µs) : 0, 628
Telemetry [baseline] (8.41 ms) : 0, 8410
Telemetry [candidate] (9.943 ms) : 0, 9943
Flare Poller [baseline] (11.532 ms) : 0, 11532
Flare Poller [candidate] (6.273 ms) : 0, 6273
section iast
crashtracking [baseline] (1.212 ms) : 0, 1212
crashtracking [candidate] (1.221 ms) : 0, 1221
BytebuddyAgent [baseline] (830.348 ms) : 0, 830348
BytebuddyAgent [candidate] (809.776 ms) : 0, 809776
AgentMeter [baseline] (11.479 ms) : 0, 11479
AgentMeter [candidate] (11.817 ms) : 0, 11817
GlobalTracer [baseline] (236.467 ms) : 0, 236467
GlobalTracer [candidate] (245.761 ms) : 0, 245761
AppSec [baseline] (28.781 ms) : 0, 28781
AppSec [candidate] (30.382 ms) : 0, 30382
Debugger [baseline] (63.483 ms) : 0, 63483
Debugger [candidate] (70.626 ms) : 0, 70626
Remote Config [baseline] (531.73 µs) : 0, 532
Remote Config [candidate] (565.843 µs) : 0, 566
Telemetry [baseline] (7.904 ms) : 0, 7904
Telemetry [candidate] (8.646 ms) : 0, 8646
Flare Poller [baseline] (3.279 ms) : 0, 3279
Flare Poller [candidate] (3.56 ms) : 0, 3560
IAST [baseline] (30.296 ms) : 0, 30296
IAST [candidate] (27.753 ms) : 0, 27753
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.60.0-SNAPSHOT~afe8664b0a, baseline=1.64.0-SNAPSHOT~b0cb50ff6e
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.07 s) : 0, 1069988
Total [baseline] (10.971 s) : 0, 10970517
Agent [candidate] (1.068 s) : 0, 1068317
Total [candidate] (10.965 s) : 0, 10965492
section appsec
Agent [baseline] (1.278 s) : 0, 1278354
Total [baseline] (11.06 s) : 0, 11059810
Agent [candidate] (1.241 s) : 0, 1241091
Total [candidate] (11.002 s) : 0, 11002402
section iast
Agent [baseline] (1.255 s) : 0, 1254773
Total [baseline] (11.129 s) : 0, 11129139
Agent [candidate] (1.231 s) : 0, 1231114
Total [candidate] (11.183 s) : 0, 11183209
section profiling
Agent [baseline] (1.321 s) : 0, 1321464
Total [baseline] (11.144 s) : 0, 11144075
Agent [candidate] (1.197 s) : 0, 1197270
Total [candidate] (11.121 s) : 0, 11120665
gantt
title petclinic - break down per module: candidate=1.60.0-SNAPSHOT~afe8664b0a, baseline=1.64.0-SNAPSHOT~b0cb50ff6e
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.202 ms) : 0, 1202
crashtracking [candidate] (1.207 ms) : 0, 1207
BytebuddyAgent [baseline] (640.094 ms) : 0, 640094
BytebuddyAgent [candidate] (631.102 ms) : 0, 631102
AgentMeter [baseline] (30.05 ms) : 0, 30050
AgentMeter [candidate] (29.435 ms) : 0, 29435
GlobalTracer [baseline] (248.819 ms) : 0, 248819
GlobalTracer [candidate] (254.854 ms) : 0, 254854
AppSec [baseline] (32.382 ms) : 0, 32382
AppSec [candidate] (33.501 ms) : 0, 33501
Debugger [baseline] (60.267 ms) : 0, 60267
Debugger [candidate] (65.06 ms) : 0, 65060
Remote Config [baseline] (599.291 µs) : 0, 599
Remote Config [candidate] (634.499 µs) : 0, 634
Telemetry [baseline] (8.398 ms) : 0, 8398
Telemetry [candidate] (11.681 ms) : 0, 11681
Flare Poller [baseline] (11.439 ms) : 0, 11439
Flare Poller [candidate] (4.644 ms) : 0, 4644
section appsec
crashtracking [baseline] (1.23 ms) : 0, 1230
crashtracking [candidate] (1.208 ms) : 0, 1208
BytebuddyAgent [baseline] (681.629 ms) : 0, 681629
BytebuddyAgent [candidate] (663.109 ms) : 0, 663109
AgentMeter [baseline] (12.267 ms) : 0, 12267
AgentMeter [candidate] (12.077 ms) : 0, 12077
GlobalTracer [baseline] (248.445 ms) : 0, 248445
GlobalTracer [candidate] (253.435 ms) : 0, 253435
AppSec [baseline] (188.903 ms) : 0, 188903
AppSec [candidate] (168.828 ms) : 0, 168828
Debugger [baseline] (66.386 ms) : 0, 66386
Debugger [candidate] (66.843 ms) : 0, 66843
Remote Config [baseline] (598.278 µs) : 0, 598
Remote Config [candidate] (648.263 µs) : 0, 648
Telemetry [baseline] (8.169 ms) : 0, 8169
Telemetry [candidate] (9.47 ms) : 0, 9470
Flare Poller [baseline] (9.392 ms) : 0, 9392
Flare Poller [candidate] (3.797 ms) : 0, 3797
IAST [baseline] (24.406 ms) : 0, 24406
IAST [candidate] (25.492 ms) : 0, 25492
section iast
crashtracking [baseline] (1.208 ms) : 0, 1208
crashtracking [candidate] (1.21 ms) : 0, 1210
BytebuddyAgent [baseline] (831.652 ms) : 0, 831652
BytebuddyAgent [candidate] (798.655 ms) : 0, 798655
AgentMeter [baseline] (11.584 ms) : 0, 11584
AgentMeter [candidate] (11.317 ms) : 0, 11317
GlobalTracer [baseline] (240.517 ms) : 0, 240517
GlobalTracer [candidate] (243.464 ms) : 0, 243464
AppSec [baseline] (29.135 ms) : 0, 29135
AppSec [candidate] (33.215 ms) : 0, 33215
Debugger [baseline] (64.27 ms) : 0, 64270
Debugger [candidate] (67.179 ms) : 0, 67179
Remote Config [baseline] (534.417 µs) : 0, 534
Remote Config [candidate] (537.88 µs) : 0, 538
Telemetry [baseline] (7.896 ms) : 0, 7896
Telemetry [candidate] (8.739 ms) : 0, 8739
Flare Poller [baseline] (3.33 ms) : 0, 3330
Flare Poller [candidate] (3.574 ms) : 0, 3574
IAST [baseline] (27.938 ms) : 0, 27938
IAST [candidate] (27.174 ms) : 0, 27174
section profiling
crashtracking [baseline] (534.925 µs) : 0, 535
crashtracking [candidate] (1.195 ms) : 0, 1195
BytebuddyAgent [baseline] (692.35 ms) : 0, 692350
BytebuddyAgent [candidate] (689.44 ms) : 0, 689440
AgentMeter [baseline] (9.82 ms) : 0, 9820
AgentMeter [candidate] (8.591 ms) : 0, 8591
GlobalTracer [baseline] (211.169 ms) : 0, 211169
GlobalTracer [candidate] (212.659 ms) : 0, 212659
AppSec [baseline] (32.368 ms) : 0, 32368
AppSec [candidate] (33.096 ms) : 0, 33096
Debugger [baseline] (66.345 ms) : 0, 66345
Debugger [candidate] (68.033 ms) : 0, 68033
Remote Config [baseline] (630.694 µs) : 0, 631
Remote Config [candidate] (646.803 µs) : 0, 647
Telemetry [baseline] (8.008 ms) : 0, 8008
Telemetry [candidate] (8.976 ms) : 0, 8976
Flare Poller [baseline] (3.48 ms) : 0, 3480
Flare Poller [candidate] (3.805 ms) : 0, 3805
ProfilingAgent [baseline] (95.656 ms) : 0, 95656
ProfilingAgent [candidate] (99.85 ms) : 0, 99850
Profiling [baseline] (96.216 ms) : 0, 96216
Profiling [candidate] (100.414 ms) : 0, 100414
LoadParameters
See matching parameters
SummaryFound 2 performance improvements and 2 performance regressions! Performance is the same for 16 metrics, 16 unstable metrics.
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.60.0-SNAPSHOT~afe8664b0a, baseline=1.64.0-SNAPSHOT~b0cb50ff6e
dateFormat X
axisFormat %s
section baseline
no_agent (18.214 ms) : 18027, 18402
. : milestone, 18214,
appsec (19.751 ms) : 19549, 19953
. : milestone, 19751,
code_origins (17.976 ms) : 17800, 18151
. : milestone, 17976,
iast (17.813 ms) : 17636, 17989
. : milestone, 17813,
profiling (19.529 ms) : 19331, 19727
. : milestone, 19529,
tracing (18.697 ms) : 18509, 18885
. : milestone, 18697,
section candidate
no_agent (19.09 ms) : 18895, 19286
. : milestone, 19090,
appsec (18.948 ms) : 18755, 19141
. : milestone, 18948,
code_origins (18.117 ms) : 17938, 18295
. : milestone, 18117,
iast (17.796 ms) : 17620, 17973
. : milestone, 17796,
profiling (18.956 ms) : 18767, 19145
. : milestone, 18956,
tracing (17.771 ms) : 17595, 17947
. : milestone, 17771,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.60.0-SNAPSHOT~afe8664b0a, baseline=1.64.0-SNAPSHOT~b0cb50ff6e
dateFormat X
axisFormat %s
section baseline
no_agent (1.275 ms) : 1263, 1286
. : milestone, 1275,
iast (3.355 ms) : 3311, 3399
. : milestone, 3355,
iast_FULL (6.276 ms) : 6211, 6340
. : milestone, 6276,
iast_GLOBAL (3.629 ms) : 3568, 3690
. : milestone, 3629,
profiling (2.299 ms) : 2276, 2322
. : milestone, 2299,
tracing (2.022 ms) : 2004, 2039
. : milestone, 2022,
section candidate
no_agent (1.274 ms) : 1262, 1286
. : milestone, 1274,
iast (3.275 ms) : 3230, 3320
. : milestone, 3275,
iast_FULL (6.145 ms) : 6081, 6208
. : milestone, 6145,
iast_GLOBAL (3.806 ms) : 3737, 3874
. : milestone, 3806,
profiling (2.403 ms) : 2380, 2426
. : milestone, 2403,
tracing (1.938 ms) : 1921, 1955
. : milestone, 1938,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 1 unstable metrics. Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.60.0-SNAPSHOT~afe8664b0a, baseline=1.64.0-SNAPSHOT~b0cb50ff6e
dateFormat X
axisFormat %s
section baseline
no_agent (15.366 s) : 15366000, 15366000
. : milestone, 15366000,
appsec (14.811 s) : 14811000, 14811000
. : milestone, 14811000,
iast (19.051 s) : 19051000, 19051000
. : milestone, 19051000,
iast_GLOBAL (17.94 s) : 17940000, 17940000
. : milestone, 17940000,
profiling (14.943 s) : 14943000, 14943000
. : milestone, 14943000,
tracing (14.878 s) : 14878000, 14878000
. : milestone, 14878000,
section candidate
no_agent (14.97 s) : 14970000, 14970000
. : milestone, 14970000,
appsec (14.91 s) : 14910000, 14910000
. : milestone, 14910000,
iast (18.456 s) : 18456000, 18456000
. : milestone, 18456000,
iast_GLOBAL (17.822 s) : 17822000, 17822000
. : milestone, 17822000,
profiling (14.826 s) : 14826000, 14826000
. : milestone, 14826000,
tracing (14.793 s) : 14793000, 14793000
. : milestone, 14793000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.60.0-SNAPSHOT~afe8664b0a, baseline=1.64.0-SNAPSHOT~b0cb50ff6e
dateFormat X
axisFormat %s
section baseline
no_agent (1.492 ms) : 1481, 1504
. : milestone, 1492,
appsec (3.794 ms) : 3574, 4014
. : milestone, 3794,
iast (2.307 ms) : 2236, 2378
. : milestone, 2307,
iast_GLOBAL (2.346 ms) : 2275, 2418
. : milestone, 2346,
profiling (2.144 ms) : 2087, 2201
. : milestone, 2144,
tracing (2.122 ms) : 2067, 2178
. : milestone, 2122,
section candidate
no_agent (1.489 ms) : 1477, 1500
. : milestone, 1489,
appsec (3.798 ms) : 3577, 4020
. : milestone, 3798,
iast (2.272 ms) : 2203, 2341
. : milestone, 2272,
iast_GLOBAL (2.319 ms) : 2250, 2389
. : milestone, 2319,
profiling (2.097 ms) : 2042, 2152
. : milestone, 2097,
tracing (2.089 ms) : 2035, 2143
. : milestone, 2089,
|
When a producer publishes to the default exchange (exchange == ""), the routing key is the destination queue name. The DSM checkpoint previously recorded an empty exchange and no topic, so the producer had no destination and showed up disconnected in the Data Streams Monitoring map. Record the routing key as the topic in that case (matching the consumer checkpoint and the JS/.NET tracers). Named-exchange publishes are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
afe8664 to
336b1b0
Compare
There was a problem hiding this comment.
Pull request overview
Updates RabbitMQ AMQP 2.7 instrumentation so that Data Streams Monitoring (DSM) producer checkpoints for default-exchange publishes (exchange == "") use the routing key as the DSM topic (since it represents the destination queue), enabling producer → queue → consumer connectivity in DSM maps.
Changes:
- In
RabbitChannelInstrumentation.ChannelPublishContextPropagationAdvice, when publishing to the default exchange and a routing key is present, build DSM tags withcreate("rabbitmq", OUTBOUND, routingKey)(topic-based) instead ofcreateWithExchange(...)(exchange-based). - Update DSM assertions in
RabbitMQTest.groovyto expecttopic:<queue>on producer checkpoints for default-exchange publishes (instead ofexchange:+has_routing_key:true).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| dd-java-agent/instrumentation/rabbitmq-amqp-2.7/src/main/java/datadog/trace/instrumentation/rabbitmq/amqp/RabbitChannelInstrumentation.java | Records routing key as DSM topic for default-exchange publishes; keeps named-exchange behavior unchanged. |
| dd-java-agent/instrumentation/rabbitmq-amqp-2.7/src/test/groovy/RabbitMQTest.groovy | Updates DSM expectations for producer checkpoints on default-exchange publishes to validate the new topic behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
🟡 Java Benchmark SLOs — Performance SLO warning (near threshold)
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. |
| if ((exchange == null || exchange.isEmpty()) && hasRoutingKey) { | ||
| // Publishing to the default exchange: the routing key is the destination queue | ||
| // name, so record it as the topic (matching the consumer checkpoint). Without | ||
| // this the producer has neither a topic nor an exchange and shows up disconnected |
There was a problem hiding this comment.
I think we can remove the comment, it doesn't add much imo
What
When a RabbitMQ producer publishes to the default exchange (
exchange == ""), record the routing key as the DSMtopicinstead of an emptyexchangetag. Named-exchange publishes are unchanged.Why
On the default exchange the routing key is the destination queue name. The producer's Data Streams Monitoring checkpoint previously recorded an empty exchange and no topic (
createWithExchange("rabbitmq", OUTBOUND, "", hasRoutingKey)), so the producer had no destination. In the DSM map this leaves the producer with neither a topic nor an exchange to attach to — it gets pruned as a disconnected node, and the map shows queues feeding consumers with the producer missing entirely.This matches what the JS (
datadog-plugin-amqplib) and .NET (RabbitMQIntegration) tracers already do: fall back to the routing key as the topic when the exchange is empty. The producedtopicnow lines up with the consumer checkpoint (which already usescreate("rabbitmq", INBOUND, queue)), so producer → queue → consumer connects end to end.Change
RabbitChannelInstrumentation.ChannelPublishAdvice: whenexchangeis null/empty and a routing key is present, build the checkpoint withcreate("rabbitmq", OUTBOUND, routingKey)(setstopic); otherwise keepcreateWithExchange(...). Thehas_routing_keytag is dropped on this branch (it is non-hashable metadata and not consumed by the map; the consumer side doesn't set it either) — consistent with .NET.Tests
Updated the two default-exchange DSM assertions in
RabbitMQTest.groovy(plain client + Spring AMQP) to expecttopic:<queue>on the producer instead ofexchange:+has_routing_key:true. Module tests pass:Context
This is the tracer-side root-cause fix. A backend stop-gap that reconnects already-emitted data from the trace chain shipped separately in dd-source. A matching fix is planned for dd-trace-py (
kombu), which has the same gap (and omitstopiceven for named exchanges).