Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[miniflare] feat: expose rows_read/rows_written in D1 meta #4686

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

mrbbot
Copy link
Contributor

@mrbbot mrbbot commented Jan 2, 2024

Fixes #4671.

What this PR solves / how to test:

This PR exposes rows_read/rows_written in the meta object of D1 responses. This matches production behaviour. rows_read/rows_written contain the number of rows read from/written to the database engine when executing a query respectively. These numbers may be greater than the number of rows returned from/inserted by a query. These numbers form billing metrics when your Worker is deployed. See https://developers.cloudflare.com/d1/platform/pricing/#billing-metrics and cloudflare/workerd#979 for more details. To test this, run wrangler dev on a Worker using D1 databases. Observe rows_read and rows_written are now included in meta.

Author has addressed the following:

  • Tests
    • Included
    • Not necessary because:
  • Changeset (Changeset guidelines)
    • Included
    • Not necessary because:
  • Associated docs
    • Issue(s)/PR(s):
    • Not necessary because: matching existing production behaviour

Note for PR author:

We want to celebrate and highlight awesome PR review! If you think this PR received a particularly high-caliber review, please assign it the label highlight pr review so future reviewers can take inspiration and learn from it.

@mrbbot mrbbot requested a review from a team as a code owner January 2, 2024 18:10
Copy link

changeset-bot bot commented Jan 2, 2024

🦋 Changeset detected

Latest commit: 09984af

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

This PR includes changesets to release 3 packages
Name Type
miniflare Minor
@cloudflare/pages-shared Patch
wrangler Patch

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

Copy link
Contributor

github-actions bot commented Jan 2, 2024

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7389057797/npm-package-wrangler-4686

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7389057797/npm-package-wrangler-4686

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7389057797/npm-package-wrangler-4686 dev path/to/script.js
Additional artifacts:
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7389057797/npm-package-miniflare-4686
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7389057797/npm-package-cloudflare-pages-shared-4686
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/7389057797/npm-package-create-cloudflare-4686 --no-auto-update

Note that these links will no longer work once the GitHub Actions artifact expires.


wrangler@3.22.1 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20231030.4
workerd 1.20231218.0 1.20231218.0
workerd --version 1.20231218.0 2023-12-18

|

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

Copy link

codecov bot commented Jan 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c410ea1) 75.58% compared to head (09984af) 75.66%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4686      +/-   ##
==========================================
+ Coverage   75.58%   75.66%   +0.07%     
==========================================
  Files         243      243              
  Lines       13084    13084              
  Branches     3368     3368              
==========================================
+ Hits         9890     9900      +10     
+ Misses       3194     3184      -10     

see 7 files with indirect coverage changes

@mrbbot mrbbot merged commit 4f6999e into main Jan 10, 2024
17 checks passed
@mrbbot mrbbot deleted the bcoll/d1-rows-read-written-meta branch January 10, 2024 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🚀 Feature Request: Miniflare's D1 implementation doesn't expose rows_read and rows_written
2 participants