Skip to content

Search the guides, deployment pages, and API reference.

D1StatementObserver

import type { D1StatementObserver } from "@pitlane/data-table-d1";
type D1StatementObserver = (report: D1StatementReport) => void;

Called after each statement the driver executes.

D1 bills on rows read and written, and its analytics report per database rather than per query, so these numbers are the only way to attribute cost to the query or the request that caused it. They ride along on responses the driver already reads, so observing them costs no extra statement and no extra billable operation.

It runs on the hot path, once per statement, so keep it cheap.

Parameters

report

D1StatementReport

Returns

void