Skip to content

MQ-1273: Add metadata with metrics to queue broker response in miniflare#13335

Merged
KennethRuan merged 5 commits intomainfrom
kruan/miniflare-queue-broker-metrics
Apr 10, 2026
Merged

MQ-1273: Add metadata with metrics to queue broker response in miniflare#13335
KennethRuan merged 5 commits intomainfrom
kruan/miniflare-queue-broker-metrics

Conversation

@KennethRuan
Copy link
Copy Markdown
Member

@KennethRuan KennethRuan commented Apr 8, 2026

Fixes https://jira.cfdata.org/browse/MQ-1273.

These changes keep the Miniflare Queues implementation up to date with its production counterpart.

There are currently changes in workerd that are gated behind an experimental flag (See PRs for MQ-1154, MQ-1200, MQ-1202). When those features are ungated,miniflare changes will need to be up to date so that local development with wrangler dev will match intended behaviour.

This PR adds an adapted implementation of metrics that simulates the production experience.


  • Tests
    • Tests included/updated
    • Manual testing has been completed as follows:
      • Built and ran code locally against the experimental and non-experimental versions of workers
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: New response types will be exposed through worker types when the experimental flag is removed on workerd

A picture of a cute animal (not mandatory, but encouraged)
pexels-andrey-yudkin-63325015-9179705


Open with Devin

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 8, 2026

🦋 Changeset detected

Latest commit: c22ddbf

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Apr 8, 2026
@workers-devprod workers-devprod requested review from a team and dario-piotrowicz and removed request for a team April 8, 2026 00:52
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Apr 8, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Changeset Review

Summary

✅ All changesets look good

Reviewed Changesets

File Package(s) Version Status
queue-broker-metrics-response.md miniflare patch ✅ Valid
fix-ai-search-remote-bindings.md wrangler patch ✅ Valid
eleven-wolves-cry.md @cloudflare/local-explorer-ui, miniflare minor ✅ Valid (experimental feature noted)
animated-cloudflare-logo.md @cloudflare/local-explorer-ui minor ✅ Valid
step-context-parameters.md @cloudflare/workflows-shared minor ✅ Valid
calm-beers-help.md @cloudflare/local-explorer-ui, miniflare minor ✅ Valid (experimental feature noted)
dependabot-update-13337.md miniflare, wrangler patch ⏭️ Skipped (Dependabot dependency update)
dependabot-update-13362.md miniflare, wrangler patch ⏭️ Skipped (Dependabot dependency update)
c3-frameworks-update-13358.md create-cloudflare patch ⏭️ Skipped (Dependabot dependency update for create-cloudflare)

Notes

  • All changesets have meaningful descriptions explaining the change
  • No h1/h2/h3 headers found in any changeset
  • Experimental features (local-explorer-ui changes) explicitly note their experimental status
  • Version types are appropriate for the changes described
  • Dependency update changesets for create-cloudflare were skipped per validation rule wrangler tail #5

ask-bonk[bot]

This comment was marked as resolved.

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Apr 8, 2026

Review posted successfully on PR #13335. Here's a summary of the two issues I flagged:

  1. backlogBytes inconsistency in #flush metadata (logic bug) — After this.#messages.splice(0, batchSize), the backlogCount in the metadata correctly reflects the post-splice message count, but this.#backlogBytes still includes the bytes of the batch that was just removed (it's not decremented until line 356). This means the MessageBatchMetadata sent to the consumer has inconsistent count vs bytes. I suggested subtracting the batch bytes before building the metadata object.

  2. Changeset h1 header — The changeset uses # Return metadata... which violates the rule that changeset descriptions must not use h1/h2/h3 headers. Suggested removing the # prefix.

github run

devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 8, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@13335

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@13335

miniflare

npm i https://pkg.pr.new/miniflare@13335

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@13335

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@13335

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@13335

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@13335

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@13335

wrangler

npm i https://pkg.pr.new/wrangler@13335

commit: c22ddbf

devin-ai-integration[bot]

This comment was marked as resolved.

@sdnts
Copy link
Copy Markdown
Contributor

sdnts commented Apr 8, 2026

LGTM from Queues' side

Copy link
Copy Markdown
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

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

LGTM, with some minor comments 🙂

Copy link
Copy Markdown
Contributor

@workers-devprod workers-devprod left a comment

Choose a reason for hiding this comment

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

Codeowners reviews satisfied

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Apr 9, 2026
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 6 additional findings in Devin Review.

Open in Devin Review

@KennethRuan KennethRuan merged commit 5eff8c1 into main Apr 10, 2026
62 of 63 checks passed
@KennethRuan KennethRuan deleted the kruan/miniflare-queue-broker-metrics branch April 10, 2026 14:58
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants