Skip to content

docs(analytics): document transaction queue depth metrics - #573

Open
kriszyp wants to merge 7 commits into
mainfrom
kris/txn-queue-depth-metrics-592
Open

docs(analytics): document transaction queue depth metrics#573
kriszyp wants to merge 7 commits into
mainfrom
kris/txn-queue-depth-metrics-592

Conversation

@kriszyp

@kriszyp kriszyp commented Jul 7, 2026

Copy link
Copy Markdown
Member

Summary

Adds write-transaction-queue-depth and read-transaction-queue-depth to the Resource Usage metrics reference, with a section explaining the depth/maxDepth fields, the aggregation caveat (summed per-thread peaks can exceed the true simultaneous global peak), and alerting guidance (alert on the per-period maxDepth).

Purpose

Companion docs for HarperFast/harper#1689 (harper#592, secondary/optional metric — see that PR for the open question on whether it ships).

Generated by Claude Opus 4.8.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the analytics documentation to include two new metrics: read-transaction-queue-depth and write-transaction-queue-depth, along with a detailed explanation of transaction queue depth metrics. Feedback is provided to remove the hyphen from 'write-transaction' in the table description for consistency with other entries.

Comment thread reference/analytics/overview.md Outdated
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-573

This preview will update automatically when you push new commits.

@github-actions
github-actions Bot temporarily deployed to pr-573 July 7, 2026 15:50 Inactive
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-573

This preview will update automatically when you push new commits.

@github-actions
github-actions Bot temporarily deployed to pr-573 July 7, 2026 16:32 Inactive
@kriszyp
kriszyp marked this pull request as ready for review July 31, 2026 23:46
@kriszyp
kriszyp requested a review from a team as a code owner July 31, 2026 23:46
Comment thread reference/analytics/overview.md Outdated
Comment thread reference/analytics/overview.md Outdated
kriszyp added a commit that referenced this pull request Aug 1, 2026
Address review feedback on PR #573: fix hyphenation inconsistency,
remove the overclaim that write-transaction-queue-depth predicts the
write-queue 503 rejection (that check is duration-based on a single
outstanding commit, not a function of concurrent commit count), and
add the missing caveat that both queue-depth metrics are RocksDB-only
and always read zero on LMDB-backed databases.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions
github-actions Bot temporarily deployed to pr-573 August 1, 2026 01:00 Inactive
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-573

This preview will update automatically when you push new commits.

kriszyp and others added 7 commits July 31, 2026 19:11
Add write-transaction-queue-depth and read-transaction-queue-depth to the
Resource Usage metrics reference, with a section explaining the depth/maxDepth
fields and alerting guidance (alert on the per-period maxDepth peak).

Companion to harper#592.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Address review feedback on PR #573: fix hyphenation inconsistency,
remove the overclaim that write-transaction-queue-depth predicts the
write-queue 503 rejection (that check is duration-based on a single
outstanding commit, not a function of concurrent commit count), and
add the missing caveat that both queue-depth metrics are RocksDB-only
and always read zero on LMDB-backed databases.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Independent pre-push review (codex + harper-domain) verified against
resources/analytics/write.ts:897-956 that the aggregate hdb_analytics
maxDepth is a sum of per-thread period averages, not per-thread peaks
as previously documented — the doc's spike-detection advice pointed at
the wrong table. Also: add the required v5.2.0 version badge and
release-notes entry, soften the write/read depth semantics (settled
commit promise != durable under storage.writeAsync; open snapshot
count can't distinguish long-lived from many short-lived), and link
storage.maxTransactionQueueTime to its documented section instead of a
generic options list.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ndicator

Independent review (codex + grok + harper-domain, unanimous across
three lenses) flagged that the doc named the 503 rejection four times
while omitting the metric that actually predicts it. Verified against
resources/analytics/metadata.ts and DatabaseTransaction.ts: enterWriteQueue/
leaveWriteQueue and the outstandingCommit arm/clear share the same
commitResolution promise, so a wedged commit pins write-transaction-queue-depth
at >=1 for its whole duration — the opposite of what the prior wording
claimed. Add the transaction-commit-time metric row and point to it as
the direct duration signal; correct the depth/duration relationship;
soften the read-depth "(snapshot)" wording (disableSnapshot reads are
counted too); and fix storage-tuning.md's maxTransactionQueueTime
description, which read as a queue-length threshold rather than the
per-commit duration check it is.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…t rising

Domain review caught an inversion in the prior commit: recordCommitLatency
only fires on commitResolution.then(record, record), so a commit that
never settles produces zero samples for transaction-commit-time — the
opposite of "rising p99/p999 predicts the 503" for that failure mode.
Reframe: commit-time is the leading indicator for gradual slowdowns
toward the storage.maxTransactionQueueTime bound; write-transaction-queue-depth's
depth staying elevated (plus Harper's own stuck-commit log line) is the
signal for a genuine wedge. Also fix the transaction-commit-time table
row (percentiles are aggregate-only per resources/analytics/write.ts,
not present on hdb_raw_analytics) and note that per-thread analytics
rows are activity-gated, so a quiet thread emits no row at all rather
than an implicit zero.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…duplicate wording

Verified against resources/Table.ts:2218,4407 (checkOverloaded guarded
by !context?.source) and the 503 log text in DatabaseTransaction.ts:403:
deletes and canonical-source writes (replication, caching sources)
bypass the queue-time check entirely. Note that in storage-tuning.md,
and sync configuration/options.md's duplicate one-line description
(previously "Max write queue time before 503", which re-introduced the
queue-length framing this branch corrects elsewhere) to point at the
same section instead of drifting. Also tighten the maxDepth field
description: the high-water mark resets on emit, which is activity-gated,
not a fixed sampling interval.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-573

This preview will update automatically when you push new commits.

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.

2 participants