Skip to content

feat: add bytesMissed cache counter and blob download driver metrics#1709

Merged
vadimpiven merged 3 commits into
mainfrom
feat/cache-missed-bytes-metric
Jun 22, 2026
Merged

feat: add bytesMissed cache counter and blob download driver metrics#1709
vadimpiven merged 3 commits into
mainfrom
feat/cache-missed-bytes-metric

Conversation

@vadimpiven

@vadimpiven vadimpiven commented Jun 22, 2026

Copy link
Copy Markdown
Member

What

Two related observability additions for blob caching/downloading:

1. bytesMissed on the serv cache counters (CacheCounters)

Bytes requested by clients that were not cached. Compared with bytesFetched (downloaded incl. read-ahead/behind), the ratio bytesFetched / bytesMissed is read-ahead amplification — the signal for tuning the read-ahead window. Optional for now so producers typed against the published model stay assignable; serv emits it later.

2. BlobDriverMetrics + DownloadDriver.getMetrics()

  • uncached volume — count + bytes streamed on the sparse-cache-bypass path
  • live in-flight gauges — active downloads, total/received bytes (progress-bar denominator/numerator), summed from a live set of per-download records
  • presigned-URL cache efficiency — hits, misses, stale hits (cached URL 400'd → refetch; flags a too-loose TTL margin), and summed fetch latency (mean cost a hit avoids)

Reported separately from the serv cache metrics — different owners and release cadences — so a monitoring panel composes both rather than one nesting the other. RemoteBlobProviderImpl untouched.

Notes

  • Patch changesets included for all three packages.
  • uncachedRequestBytes counts bytes actually streamed off the wire, not nominal request size.

@changeset-bot

changeset-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1d11fb7

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

This PR includes changesets to release 30 packages
Name Type
@milaboratories/pl-model-common Patch
@milaboratories/pl-drivers Patch
@milaboratories/pl-model-middle-layer Patch
@platforma-sdk/model Patch
@milaboratories/pf-driver Patch
@milaboratories/pf-spec-driver Patch
@milaboratories/pl-client Patch
@milaboratories/pl-middle-layer Patch
@milaboratories/pl-deployments Patch
@platforma-open/milaboratories.software-ptabler.schema Patch
@platforma-sdk/block-tools Patch
@platforma-sdk/ui-vue Patch
@milaboratories/uikit Patch
@platforma-sdk/test Patch
@milaboratories/milaboratories.monetization-test.model Patch
@milaboratories/milaboratories.monetization-test.ui Patch
@milaboratories/milaboratories.ui-examples.model Patch
@milaboratories/milaboratories.ui-examples.ui Patch
@milaboratories/milaboratories.ui-examples Patch
@milaboratories/milaboratories.pool-explorer.model Patch
@milaboratories/milaboratories.pool-explorer Patch
@milaboratories/pl-model-backend Patch
@milaboratories/pl-errors Patch
@milaboratories/pl-tree Patch
@platforma-sdk/pl-cli Patch
@platforma-sdk/bootstrap Patch
@milaboratories/ptabler-expression-js Patch
@milaboratories/milaboratories.monetization-test Patch
@milaboratories/milaboratories.pool-explorer.ui Patch
@platforma-sdk/tengo-builder 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

@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 introduces a new optional field missedBytes to the CacheCounters type in http_helpers.ts to track bytes requested by clients that were not cached, allowing for the measurement of read-ahead amplification against bytesFetched. A corresponding changeset file has also been added to document this change. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread .changeset/cache-missed-bytes.md
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.94737% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.30%. Comparing base (99e619b) to head (1d11fb7).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
lib/node/pl-drivers/src/clients/download.ts 75.00% 7 Missing ⚠️
...drivers/src/drivers/download_blob/download_blob.ts 88.88% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1709       +/-   ##
===========================================
+ Coverage   44.56%   55.30%   +10.73%     
===========================================
  Files          43      313      +270     
  Lines        2540    17610    +15070     
  Branches      663     3836     +3173     
===========================================
+ Hits         1132     9739     +8607     
- Misses       1225     6636     +5411     
- Partials      183     1235     +1052     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Tracks bytes requested by clients that were not cached, distinct from
bytesFetched (which includes read-ahead and read-behind). The ratio of
the two measures read-ahead amplification for tuning the cache.
Add BlobDriverMetrics and DownloadDriver.getMetrics() exposing:
- uncached (sparse-cache-bypass) request count and bytes streamed
- live in-flight download gauges (count, total/received bytes)
- presigned-URL cache efficiency (hits, misses, stale hits, fetch latency)

Reported separately from the serv cache metrics so the two evolve on
their own release cadences; a monitoring panel composes both.
@vadimpiven vadimpiven force-pushed the feat/cache-missed-bytes-metric branch from 2c2e6ae to 2760ae1 Compare June 22, 2026 12:08
@vadimpiven vadimpiven changed the title feat(pframe): add missedBytes to cache counters feat: add bytesMissed cache counter and blob download driver metrics Jun 22, 2026
CREATE_PLUGIN_MODEL used a unique Symbol(), so a PluginInstance created
against one copy of @platforma-sdk/model and a block consuming it against
another copy (separate-package plugins, bundled-vs-externalized model in
block-tools build-model, pnpm peer-hash duplicates) keyed the handshake
method under different symbols -> instance[CREATE_PLUGIN_MODEL] undefined.

Use Symbol.for() so every copy resolves the same global-registry symbol.
@vadimpiven vadimpiven enabled auto-merge June 22, 2026 12:24
@vadimpiven vadimpiven added this pull request to the merge queue Jun 22, 2026
Merged via the queue into main with commit 251ea9f Jun 22, 2026
14 checks passed
@vadimpiven vadimpiven deleted the feat/cache-missed-bytes-metric branch June 22, 2026 13:01
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