Skip to content

fix(rabbitmq): scope receive tracing to consumer queues - #707

Merged
thomhurst merged 2 commits into
mainfrom
issue-643-rabbitmq-tracing
Nov 14, 2026
Merged

thomhurst merged 2 commits into
mainfrom
issue-643-rabbitmq-tracing

Conversation

@thomhurst

@thomhurst thomhurst commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Wildcard RabbitMQ routing keys currently compose and evict tracing state per delivery. Compose one queue-scoped process/ack/nack operation set per consumer instead, and reuse the existing binding to add routing key and delivery tag only after sampling.

Receive destinations and sampler inputs now use the consumed queue; routing keys remain recorded-span attributes. The site and decision D80 explicitly document this contract change. Native RabbitMQ.Client delivery, tracing configuration and settlement remain unchanged.

Builds on RabbitMQ.Client 7.2.2's native delivery dispatch and consumer callback, Relayer's existing RabbitMqMessageBinding.EnrichActivity, shared MessageOperationTracing, and native ack/nack wrappers. No native capability is duplicated. D80 records the receive telemetry contract change.

Per-message cost: replaces a dictionary lookup (plus cold lock/composition/eviction) with one existing endpoint reference; no new allocation, copy, await or lock. No throughput/latency/CPU/allocation tradeoff is introduced.

Validation:

  • Broker-backed queue sampler/ack and native nack tests passed on net10.0 and net11.0; 512 distinct topic routing keys passed with recording enabled and the provider's tracing source disabled. The disabled test disposes only its own source because TUnit has a global listener.
  • RabbitMQ conformance class: 24/24 passed across both frameworks.
  • npm ci and npm run build in website/ passed.
  • RabbitMqReceiveBenchmarks now compares fixed and 512 distinct routing keys against equivalent native JSON receive/ack, with MemoryDiagnoser. Both paths use a durable queue, also fixing the old benchmark setup rejected by RabbitMQ 4.3's transient-nonexclusive-queue policy.
  • Affected-class ShortRun completed all four cases. High-cardinality native/Relayer means were 19.89/19.42 us and inclusive managed allocations 1.19/1.22 KB per operation; fixed-key means were 19.94/19.15 us. These local numbers are diagnostic only: iterations were short, confidence intervals wide, and whole-process allocation totals do not isolate Relayer-owned allocations. They do not establish the 5% budget or zero-owned-allocation acceptance. No performance tradeoff is approved or claimed from them; advisory CI provides further regression evidence.

Validation logs/reports, benchmark outputs, fixture inputs and loaded test/benchmark binaries are retained outside removable worktrees at /Users/tom/git/Relayer-evidence/pr-707/f12dbd4bcff656222b288557ae93f00a5dc17cc3/; 702 archived files were SHA-256 verified against originals, with inventory in sha256.json. Retention is local until the item closes.

Closes #643

Rebased onto main a122cee after #698 moved transport-authoring types. The cache remains deleted; its queue-scoped replacement imports Relayer.Transports. The range-diff preserves the RabbitMQ change. Fresh focused receive/conformance/configuration tests pass on both net10/net11 (94 total). No new steady-state cost, 0 B. Website and benchmark code are unchanged by the rebase, so their prior validation was not repeated. New test logs, reports, loaded binaries and source inputs are retained at /Users/tom/git/Relayer-evidence/pr-707/0c5a98e46c6ccddd90e6152f38b41e1232f4bc55/; all 489 inventory hashes verify. Earlier validation above remains evidence of its named prior head.

Rebased onto main a362f6c after #348 resolved the practical exact-counter CI blocker (#687 is closed). Resolved the decision-number collision by assigning this receive contract D80 and adding its index row, addressing Claude’s prior navigation finding. Range-diff confirms only that documentation adjustment to the RabbitMQ patch. Fresh RabbitMqReceiveTests, RabbitMqConformanceTests, RabbitMqConfigurationTests and ConcurrentReceiveAllocationTests passed on both frameworks (98/98); npm ci and npm run build passed. Benchmark code and steady-state implementation are unchanged by this rebase, so prior affected-class benchmarks were not repeated. Current-head logs, reports, source inputs and loaded test binaries are archived at /Users/tom/git/Relayer-evidence/pr-707/5265fcdcd316ccb3923b86fcb06d535ad149f1ae; all 501 files were SHA-256 verified against originals. Earlier archives (702 and 489 files) were reverified intact; their claims remain tied to their named heads. Fresh review and protected ready CI remain required.

@thomhurst thomhurst added the performance Run the advisory benchmark regression gate on this PR label Nov 13, 2026
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 282aac76-07e5-4da6-9f4a-10421aa9fd0f
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

Copy link
Copy Markdown

Review of PR 707: no blocking findings.

  • The per-delivery endpoint cache is replaced by one queue-scoped process/ack/nack set per consumer. That removes the dictionary lookup, lock, FIFO eviction and route-dependent allocation. The fixed state is cheaper than before and fits the zero-allocation budget.
  • It reuses the existing RabbitMqMessageBinding.EnrichActivity. ConsumeTracing and RabbitMqSettlement call it only when IsAllDataRequested is true, so the routing key and delivery tag are added only to recorded spans. I checked this in the code. Native RabbitMQ.Client dispatch and settlement are unchanged.
  • The destination change is a breaking contract change for samplers and span names. It is recorded as D76 and in design.md, and the website page is updated. The docs state that send telemetry keeps its exchange/routing-key destination.
  • Test coverage is good. The new wildcard test publishes 512 distinct routing keys, with recording on and off. It checks sampler inputs, that the routing key is a span tag rather than a sampler input, and that process and ack keys match. Existing assertions are updated. The old cache test is removed along with the cache.
  • The benchmark gains a high-cardinality parameter and a topic exchange, which is appropriate here because the change touches per-message cost.

Minor, non-blocking: Records went from 128 to 512 in the benchmark, which changes the baseline for historical comparison, and the PR label performance should be applied.

@thomhurst

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T11:13:31.808161Z 4982cfc Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: f12dbd4bcf

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@thomhurst

Copy link
Copy Markdown
Owner Author

Disposition of Claude review #707 (comment): the performance label is already applied. Keeping Records=512 is appropriate for the new 512-key workload; historical local results are not treated as comparable acceptance evidence, as the PR validation notes explain. This is non-blocking and needs no code change.

Both required reviewers cleared f12dbd4, with no inline threads or outstanding review findings. Rechecked the retained archive against sha256.json: all 702 files match. The original-to-archive verification was recorded when the archive was created; the original worktree has since been released. Evidence remains at the path in the PR body until this item closes.

@thomhurst
thomhurst marked this pull request as ready for review November 13, 2026 15:49
@thomhurst
thomhurst enabled auto-merge (squash) November 13, 2026 15:49
@thomhurst

thomhurst commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner Author

Assigned #707 Resolve recheck (2026-11-13): the earlier [locked] blocker is obsolete. Released pr-707, acquired issue-687/pr-705/pr-348, and reacquired pr-707 for this update. All actions were under their own Redis locks.

Checked #707 independently rather than inferring a dependency from other PRs: its required CI run 43456441261 at f12dbd4 failed net11 ConcurrentReceiveAllocationTests.Pending_cross_thread_receives_allocate_only_native_scopes_after_warmup: Scoped/Consumer/Receive = 1,024,000 / 1,025,032 / 1,024,000 B. The current rebased head 0c5a98e has skipped draft CI, not a passing correction. Fresh origin/main remains 367d4c3; history of the affected fixture/test since that failed head contains no correction. No unchanged CI retry or rebase merely to obtain a different random outcome is justified. The Linux counter-only reproduction does not retrospectively attribute this historical +1,032 B window.

Blocker-first: #687 and #705 now record the package-free Linux .NET10/.NET11 callback-backed empty-window reproduction, reported at dotnet/runtime#134724 (comment) . Refreshed the full upstream issue and every comment: it remains open with no maintainer explanation, supported measurement correction or runtime fix after that report. All known diagnostic captures are terminal. #705 remains useful unmerged executable tooling at a416eb8, not a superseded evidence-only PR. Repeating a capture without a new discriminating question cannot recover historical scheduling.

Tried the existing alternative mitigation under pr-348 ownership: original Windows run 42309147287 has zero artifacts; all 1,223 current hosted artifacts contain no exact cited head/archive; registered self-hosted runners zero; no Windows evidence volume mounted; local pr-348 holds metadata only; refreshed comments provide no new access link. #299 explicitly requires historical originals verification. No evidence loss is asserted. A new execution or duplicate GC setting cannot verify those originals; #348 is an independent candidate, not a proven correction/dependency for #707.

Resolve routes: origin/main still has RabbitMqEndpointCache, so it does not deliver #643; #707 already has Closes #643 and remains its implementation. Main also lacks the demonstrated allocation correction. #687 has no native children or blocked_by prerequisites, so no finished-parent closure applies. No replacement/superseded PR, stale completed scope, already-shipped implementation or reasonable reversible choice supplies the missing correction. The standalone reporting work is delivered, but closing #687 would claim attribution/correction it does not have. No assertion relaxation, warmup/parallelism/GC change, production performance tradeoff, competing diagnostic or speculative fix.

Read every #707 conversation/review/inline/thread surface. Current-head Codex is completed without findings; REST reviews/inline comments and GraphQL threads are empty. Claude's sole current-head finding remains the dispositioned non-blocking D76 index navigation nit (see prior disposition); its BLOCKING receipt is not a CLEAR verdict and does not authorize promotion. Existing validation/evidence statements remain tied to their named heads; no new validation claim is made.

External on-hold condition: dotnet/runtime#134724 supplies a supported explanation/correction that can be demonstrated against the exact-counter excess without weakening equality, or the separately held #348 becomes verifiable and demonstrates a correction through its protected lifecycle. Re-evaluate and remove the hold when that condition changes. This is not a pending workflow/review hold: #707 has a genuine unresolved required-CI failure. PRs cannot be native blocked_by sources (GitHub requires an issue), so no artificial dependency was added. No code changed, local tests rerun or owned services started. Releasing all four owned locks after recording this replacement for the obsolete lock deferral.

@thomhurst
thomhurst marked this pull request as draft November 13, 2026 16:08
auto-merge was automatically disabled November 13, 2026 16:08

Pull request was converted to draft

@thomhurst
thomhurst force-pushed the issue-643-rabbitmq-tracing branch from f12dbd4 to 0c5a98e Compare November 13, 2026 16:09
@thomhurst

Copy link
Copy Markdown
Owner Author

@codex review

@github-actions

Copy link
Copy Markdown

Review

The change is sound. It replaces the per-delivery exchange/routing-key cache, which did a dictionary lookup plus cold lock, composition and FIFO eviction, with one queue-scoped RabbitMqReceiveEndpoint per consumer. I checked the following against the head:

  • RabbitMqMessageBinding.EnrichActivity already adds the routing key and delivery tag, and RabbitMqSettlement calls it only when IsAllDataRequested is true. Routing keys therefore stay on recorded spans and out of sampler inputs, as D76 describes.
  • The per-message path now reads a field, so the per-message cost is lower and no benchmark is required.
  • The behavior change is documented in the site page, design.md and D76. The tests were updated, and there is a new 512-key wildcard test that covers the recorded and disabled cases.
  • It wraps native behavior and does not emulate any native feature.

One small point to fix:

  • D76 is missing from the decisions index table. docs/decisions.md lists D1 to D75 near the top, and the new D76 section has no row, so its anchor link is not discoverable. Add | [D76](#d76-rabbitmq-receive-tracing-is-scoped-to-the-consumed-queue) | RabbitMQ receive tracing is scoped to the consumed queue | Accepted | after the D75 row.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 0c5a98e46c

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@thomhurst thomhurst added the on-hold Waiting for an external dependency or gate label Nov 13, 2026
@thomhurst

Copy link
Copy Markdown
Owner Author

Maintainer decision: the hold is stale. The allocation-test failure this was parked on is fixed on main by #348, and #687 is closed. Rebase onto main, resolve the conflicts and validate the new head through the normal review cycle.

@thomhurst thomhurst removed the on-hold Waiting for an external dependency or gate label Nov 14, 2026
@thomhurst
thomhurst force-pushed the issue-643-rabbitmq-tracing branch from 0c5a98e to 5265fcd Compare November 14, 2026 11:01
@thomhurst

Copy link
Copy Markdown
Owner Author

The quoted deferral is obsolete: #348 merged the standard-SDK test-host control, #705 merged, #687 closed, and the maintainer explicitly directed this rebase. Historical runtime attribution remains separate; no historical Windows recovery or retrospective attribution is claimed.

Resolve routes: main still has RabbitMqEndpointCache, so #643 is not delivered; #643 has no native children/prerequisites. #707 remains its implementation with Closes #643. No replacement/superseding PR, finished parent or stale completed scope applies. The reversible correction is incorporating the demonstrated merged test-host control, rather than waiting for upstream or duplicating mitigation.

Pushed 5265fcd rebased onto a362f6c. Preserved both sides of the decisions conflict, renumbered RabbitMQ’s decision D80 and added its index entry, fixing Claude’s prior finding. Read all conversation, REST review/inline and GraphQL thread surfaces (no threads). The other non-blocking suggestions were already dispositioned. Two automated rounds/one prior force-push were below rework limits. Final diff and range-diff preserve product/test/benchmark behavior and native reuse.

98/98 focused RabbitMQ receive/conformance/configuration and exact allocation tests pass across net10/net11; npm ci/build pass. Evidence original-to-archive verified at /Users/tom/git/Relayer-evidence/pr-707/5265fcdcd316ccb3923b86fcb06d535ad149f1ae (501 files); both prior archives reverified intact. Benchmark/steady-state implementation unchanged by rebase, so no repeat benchmark warranted. Full required CI follows fresh head reviews through the protected lifecycle. No assertion relaxation, unchanged CI retry or performance tradeoff.

@codex review

@github-actions

Copy link
Copy Markdown

Reviewed head of #707 against AGENTS.md.

Correctness: The change is sound. One queue-scoped RabbitMqReceiveEndpoint is built per consumer, and RabbitMqBinding.EnrichActivity still adds the routing key and delivery tag after sampling (IsAllDataRequested). This removes the dictionary lookup, the cold lock and the FIFO eviction from the per-message path, which fits the zero-allocation rule. Native delivery and settlement are untouched (D1). Sampler inputs lose the routing key, which is a deliberate contract change.

Decisions and docs: D80 records the contract change. docs/design.md, the RabbitMQ site page and the conformance ProcessDestinationName are all updated to match.

Tests: The new 512-key wildcard test runs with recording on and off. It checks that sampler inputs carry only the queue, that routing-key and delivery-tag attributes appear on recorded spans, and that settle spans match. The existing sampler and nack tests are updated. The removal of the cache test is appropriate because the cache no longer exists.

Benchmarks: The benchmark now covers fixed and high-cardinality keys and uses a durable queue. The PR description is honest that the local numbers are diagnostic only.

No actionable issues found.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 5265fcdcd3

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@thomhurst

Copy link
Copy Markdown
Owner Author

Assigned-unit recheck: the old upstream/historical-evidence deferral no longer applies. #348 and #705 merged, #687 closed, and this PR already incorporated the maintainer-directed correction in 5265fcd. Both required reviewers approve that head; all conversation, REST review/inline and GraphQL thread surfaces have been checked, with no outstanding findings. The previous D76 index finding is fixed by the indexed D80 entry on this head.

No replacement or already-shipped RabbitMQ implementation supersedes this PR; Closes #643 remains correct. There is no remaining blocker to work under a linked lock. Reverified all retained archive hashes: 501 current-head files, 489 previous-head files and 702 original-head files at the evidence paths in the PR body. Original-to-archive verification was recorded at capture; released original worktrees are no longer present. These remain named-head evidence, with no new test run or retrospective attribution claimed. Promoting through the protected script now; full ready CI will validate this reviewed head.

@thomhurst
thomhurst marked this pull request as ready for review November 14, 2026 11:06
@thomhurst
thomhurst enabled auto-merge (squash) November 14, 2026 11:06

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5265fcdcd3

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread website/docs/transports/rabbitmq.md Resolved
@thomhurst
thomhurst disabled auto-merge November 14, 2026 11:09
@thomhurst
thomhurst marked this pull request as draft November 14, 2026 11:09
@thomhurst

Copy link
Copy Markdown
Owner Author

Disposition of Codex review #707 (review): valid documentation contract mismatch, fixed in 4982cfc. The conformance guide now states that RabbitMQ process/settlement destinations use the consumed queue and routing keys/delivery tags are recorded after sampling, matching the consumer, fixture, D80 and transport page.

The previous waiting blocker was checked immediately: run 43588417576 was still running, but did not prevent handling this feedback. Disabled auto-merge and restored draft before pushing. No linked prerequisite needs work: #348/#705 merged, #687 closed; #707 remains the implementation of #643 with Closes #643. Main has not shipped the queue-scoped receive tracing change; no replacement, finished parent, stale completed scope or alternative deferral applies.

Validation: npm ci and npm run build passed. Documentation-only correction; no per-message cost, 0 B, and no code-test or benchmark rerun warranted. Five source/input/log files were copied and SHA-256 verified against originals at /Users/tom/git/Relayer-evidence/pr-707/4982cfc4/ (sha256.json). Existing evidence remains tied to the prior named heads. Fresh head reviews are required before promotion; no CI wait or hold label is needed.

@codex review

@github-actions

Copy link
Copy Markdown

Review of PR #707 (RabbitMQ receive tracing scoped to the consumed queue)

I found no actionable issues.

  • Correctness: RabbitMqReceiveEndpoint is now built once per consumer, and RabbitMqConsumer assigns it to every delivery. Settlement still resolves through native.Message.Endpoint?.Settlement. The routing key and delivery tag are added only in EnrichActivity when IsAllDataRequested is true, so they appear on recorded spans and not in sampler inputs. This matches D80.
  • Dead code: no references to RabbitMqEndpointCache remain in the sources.
  • Performance: the per-message dictionary lookup, lock and FIFO eviction are replaced by one existing reference. The per-message path gets cheaper and allocates 0 B. The PR extends RabbitMqReceiveBenchmarks with a high-cardinality routing-key parameter, and the PR text states the per-message cost.
  • Tests: the broker-backed test publishes 512 distinct routing keys with recording enabled and disabled. It asserts that sampler inputs carry only the queue and no routing key, that every recorded span carries its routing key and delivery tag, and that each ack matches a process span. The existing destination-name assertions and the conformance fixture are updated to match. The removed cache unit test no longer has anything to test.
  • Docs: D80 is added to docs/decisions.md, with updates to design.md, the RabbitMQ transport page and the conformance page, as AGENTS.md requires. The PR notes the behaviour change (receive destination and span names are now the queue).
  • Native features: the PR relies on RabbitMQ.Client's own delivery dispatch and native ack/nack, and duplicates nothing.

Looks good.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 4982cfc423

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@thomhurst

Copy link
Copy Markdown
Owner Author

The earlier wait on run 43588417576 is obsolete: that CI run was cancelled when the documentation correction 4982cfc restored the draft. Both required reviewers now clear that current head (Claude run 43588710133/1 and the Codex current-head summary). Checked every conversation, REST review/inline and GraphQL thread surface, including resolved-thread replies; the sole finding is fixed and resolved, with no subsequent concern.

Resolve recheck: origin/main still contains RabbitMqEndpointCache, so #643 remains open and is delivered by this PR's existing Closes #643. It has no native children or dependencies. No replacement, superseded PR, completed parent, stale scope, upstream blocker or human decision remains; no linked lock is needed. The old allocation blocker was already removed by merged #348/#705 and closed #687. No unchanged CI retry is warranted.

Reverified all archived file hashes: 702 original-head, 489 first-rebase, 501 second-rebase, and 5 documentation-fix files. Current documentation-fix evidence remains at /Users/tom/git/Relayer-evidence/pr-707/4982cfc4/sha256.json; prior evidence remains at the named-head paths in the PR body. Original-to-archive verification was recorded at capture; original released worktrees are no longer available. No new test or benchmark run, performance claim, or retrospective attribution is made. Promoting this reviewed head through the protected script for fresh ready CI.

@thomhurst
thomhurst marked this pull request as ready for review November 14, 2026 11:12
@thomhurst
thomhurst enabled auto-merge (squash) November 14, 2026 11:12
@thomhurst
thomhurst merged commit 4990085 into main Nov 14, 2026
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Run the advisory benchmark regression gate on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RabbitMQ consumer endpoint cache is keyed by routing key and thrashes on high-cardinality keys

1 participant