Skip to content

[kv_cache] Expose kv_cache_pull duration as a metric - #678

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_965213481
Open

[kv_cache] Expose kv_cache_pull duration as a metric#678
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_965213481

Conversation

@copybara-service

Copy link
Copy Markdown

[kv_cache] Expose kv_cache_pull duration as a metric

Changes include:

  • Define the kTransferDurationMs metric in metrics_api.h.
  • Instrument KVCacheManagerWithTransfer to track start_time for
    receive entries and recording the total duration in milliseconds
    upon transfer completion.
  • Introduce mock_metrics_backend.h with MockMetricsBackend and
    ScopedMetricsBackendReset to facilitate the testing of telemetry metrics.
  • Add unit tests in kv_cache_manager_with_transfer_test and
    kv_cache_manager_with_transfer_pool_reshard_test to verify that the
    duration metric is properly recorded on success and omitted on failure.

Changes include:

*   Define the `kTransferDurationMs` metric in `metrics_api.h`.
*   Instrument `KVCacheManagerWithTransfer` to track `start_time` for
    receive entries and recording the total duration in milliseconds
    upon transfer completion.
*   Introduce `mock_metrics_backend.h` with `MockMetricsBackend` and
    `ScopedMetricsBackendReset` to facilitate the testing of telemetry metrics.
*   Add unit tests in `kv_cache_manager_with_transfer_test` and
    `kv_cache_manager_with_transfer_pool_reshard_test` to verify that the
    duration metric is properly recorded on success and omitted on failure.

PiperOrigin-RevId: 965213481
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.

1 participant