Repository navigation
fix(telemetry): records and metrics count PartiQL writes, throttles of failed calls, batch retries and rows - #131
Merged
kalaspuff merged 3 commits intoOct 31, 2026
Conversation
…f failed calls, batch retries and rows client.metrics() counted the capacity of PartiQL writes as reads, and capacity reported without a read/write split followed the operation only: PartiQL statements now count as writes unless they are SELECTs. Errors of a call now carry their throttles and requests, so failed calls record them. A single call is one request however many attempts it takes, so retries are the attempts beyond the first of each request and managed batches no longer report their chunks as retries. Managed batches that leave items unprocessed are recorded as failures, and returned_rows records the items of reads only. Fixes #90 Co-authored-by: Carl Oscar Aaro <[email protected]>
|
Partly addressed as of fctl reviewed The counting fixes hold up: the capacity split, the per-call On lines the diff doesn't show:
Reviewed by fctl · Review agent settings |
The rows metric now takes whether a call's items are rows from the request, so INSERT, UPDATE and DELETE statements record none; the errors reference lists .throttles and .requests. Co-authored-by: Carl Oscar Aaro <[email protected]>
Contributor
Author
|
Errors reference finding: fixed in ce09bd8. |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Carl Oscar Aaro <[email protected]>
This was referenced Oct 31, 2026
fix(models): numbers of union fields render as stored, and literals of plain enum members write
#126
Merged
Contributor
Author
|
Stack of 10 pull requests, merged in this order with "Squash and merge":
|
This was referenced Oct 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Five ways operation records and metrics miscounted (#90):
client.metrics(): the core attributed the units of every PartiQL output to reads, and tookcapacity_unitsover a reported read/write split. ThreeINSERTs showedread_capacity_units=3.0, write=0.0. The core andcollect()now keep a reported split as it is. Units reported only as a total count as the request's kind, and PartiQL statements say it: aSELECTreads, anything else writes, forExecuteStatement,BatchExecuteStatementandExecuteTransaction..attemptsand.durationon errors, so aGetItemthrottled on every attempt recorded 0 throttles incollect(), nodynamoxy.request.throttlespoint and nodynamoxy.throttlesspan attribute, whileclient.metrics()said 3. Errors of a call now also carry.throttlesand.requests(stub, docs and the service fields copied onto model-level errors included).summary()["retries"]counted batch chunks:retriessummedattempts - 1, andrequestsmeant attempts for single calls but rounds for managed batches, so a 60-itembatch_writewithout throttling reported 2 retries. A single call is now one request however many attempts it takes (OperationStats.requestsin the core), andretriesis the attempts beyond the first of each request. A batch's chunks and rounds of unprocessed items count as requests, not retries.UnprocessedItemsErrorwas recorded as a success (operation.succeeded, no error incollect(), unset span status), because the callers raise after the call was recorded. Managed batches that leave items unprocessed are now recorded as failed withUnprocessedItemsError: in collectors, metrics (error.type), the span (statusERROR) andoperation.failed. A batch write's record counts only the items it wrote.db.client.response.returned_rowscounted written items: it now records the items of reads only (GetItem,Query,Scan,BatchGetItem,TransactGetItems, and PartiQLSELECTstatements;INSERT,UPDATEandDELETErecord none, also withRETURNING).OperationRecord.itemsstill counts items returned or written, as documented.Verified with Rust tests of the capacity split, of PartiQL write capacity in the core's metrics and of single-request stats. Python tests (in-memory backend, with the OpenTelemetry SDK's in-memory exporters) cover PartiQL capacity in
metrics()andcollect(), the throttles, requests and retries of successful, throttled and failed calls, unprocessed batch writes and reads as failures, and the rows metric. Each test fails without the fix, andmake checkpasses.Fixes #90
Checklist
_core.pyi, changelog)make checkpasses locally (lint, types, clippy, consistency, tests)OperationRecord.requests,CallStats.requestsandsummary()["requests"]of a single call are now 1 instead of its attemptsWorth confirming
requestsof a single call changes from its attempts to 1, so thatretries = attempts - requestsholds for single calls and batches alike. Dashboards built onsummary()["requests"]see lower numbers for retried calls.UnprocessedItemsError) even though DynamoDB answered, keeping its capacity in the record. Low-levelbatch_write_itemcalls, which return unprocessed items without raising, stay successes.fctl session
Note
Low risk. It changes how operation records,
collect()summaries and OpenTelemetry metrics are counted, plus the stats attached to errors, but no read or write path.What it does. Fixes miscounted telemetry: PartiQL writes now count as write capacity, failed calls keep their throttle count, a single call counts as one request however many attempts it took, and a managed batch that leaves items unprocessed is recorded as a failure. Errors of a call now carry
.throttlesand.requestsnext to.attempts, anddb.client.response.returned_rowsis recorded only for reads and PartiQLSELECTstatements. The latest commit only adds a test that a client with a meter provider and no tracer records the same returned rows.Changed meaning of requests.
OperationRecord.requestsandsummary()["requests"]of a single call are now 1 instead of its attempts, so dashboards built on them see lower numbers for retried calls.fctl review's first look at
071f009· 16 files, +353 −65 · Review agent settings