Skip to content

[feat] add observability stack to MP mode#2638

Merged
royyhuang merged 10 commits intoLMCache:devfrom
royyhuang:dev
Feb 27, 2026
Merged

[feat] add observability stack to MP mode#2638
royyhuang merged 10 commits intoLMCache:devfrom
royyhuang:dev

Conversation

@royyhuang
Copy link
Copy Markdown
Contributor

@royyhuang royyhuang commented Feb 25, 2026

This PR introduces observability stack for our multiprocess mode via newly introduced EventListener class.

Special notes for your reviewers:

If applicable:

  • this PR contains user facing changes - docs added
  • this PR contains unit tests

Signed-off-by: royyhuang <roy.y.huang@gmail.com>
Signed-off-by: royyhuang <roy.y.huang@gmail.com>
@royyhuang royyhuang marked this pull request as draft February 25, 2026 01:03
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @royyhuang, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request integrates an observability stack into the multi-process (MP) mode, specifically targeting the distributed storage components. It establishes a clear listener pattern for various storage events, enabling the collection of metrics and insights into cache operations. The changes lay the groundwork for monitoring the performance and behavior of the L1 cache and overall storage manager interactions by providing granular event notifications and a dedicated Prometheus controller.

Highlights

  • New Listener Interface: Introduced a new StorageManagerListener abstract base class to standardize event notifications across storage layers, providing detailed success and failure key lists for each event.
  • L1 Manager Listener Refactoring: Refactored L1ManagerListener methods by adding an on_l1_ prefix to clearly distinguish L1-specific events and updated L1Manager to call these new prefixed methods.
  • Prometheus Controller Integration: Implemented PrometheusController to initiate and manage the collection of storage-related metrics, registering a StorageStatsListener to capture L1 manager events.
  • Storage Manager Observability: Updated StorageManager to register and notify StorageManagerListener instances for key lifecycle events, including reserve_write, finish_write, read_prefetched_results, and submit_prefetch_task.
  • New Observability Dataclasses: Added new dataclasses (MPServerStats, StorageManagerStats, VLLMIntegratorStats) to structure observability data for various components.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .gitignore
    • Added uv.lock to ignore uv lock files.
    • Added several .md files for coding agent instructions to be ignored.
  • lmcache/v1/distributed/eviction.py
    • Renamed L1 manager listener methods to include an on_l1_ prefix.
    • Added no-op implementations for new StorageManagerListener methods.
  • lmcache/v1/distributed/internal_api.py
    • Defined a new StorageManagerListener abstract base class with methods for read/write/prefetch events, including success/failure keys.
    • Modified L1ManagerListener to inherit from StorageManagerListener.
    • Renamed all L1ManagerListener abstract methods to include an on_l1_ prefix.
    • Added a placeholder L2ManagerListener class.
  • lmcache/v1/distributed/l1_manager.py
    • Updated all calls to L1ManagerListener methods to use the new on_l1_ prefixed names.
  • lmcache/v1/distributed/observability/logger/storage_stats_logger.py
    • Added StorageStatsListener class, inheriting from L1ManagerListener.
  • lmcache/v1/distributed/observability/prometheus_controller.py
    • Added PrometheusController class, which initializes and registers a StorageStatsListener with the L1 manager, and runs a periodic monitoring thread.
  • lmcache/v1/distributed/observability/stats/mp_server_stats.py
    • Added MPServerStats dataclass.
  • lmcache/v1/distributed/observability/stats/storage_manager_stats.py
    • Added StorageManagerStats dataclass.
  • lmcache/v1/distributed/observability/stats/vllm_integrator_stats.py
    • Added VLLMIntegratorStats dataclass.
  • lmcache/v1/distributed/storage_manager.py
    • Imported StorageManagerListener.
    • Added a list to store registered StorageManagerListener instances.
    • Implemented register_listener method to add new listeners.
    • Integrated calls to on_sm_reserved_write, on_sm_write_finished, on_sm_read_prefetched_finished, and on_sm_read_prefetched to notify registered listeners about storage events, distinguishing between successful and failed keys.
Activity
  • No human activity recorded for this pull request.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

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

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 an observability stack for the multi-process mode by adding a listener pattern to track storage events. The changes are well-structured, introducing StorageManagerListener and updating related components. However, there are a few critical issues in the implementation of the new listener interfaces. Specifically, StorageStatsListener is missing implementations for abstract methods, and EvictionPolicy has incorrect method signatures for the new listener methods, both of which will cause runtime errors. There are also some minor issues with a misleading comment and an incomplete loop in the new PrometheusController.

Comment thread lmcache/v1/distributed/eviction.py Outdated
Comment thread lmcache/v1/distributed/observability/logger/storage_stats_logger.py Outdated
Comment thread lmcache/v1/distributed/eviction.py Outdated
Comment thread lmcache/v1/distributed/observability/prometheus_controller.py Outdated
Signed-off-by: royyhuang <roy.y.huang@gmail.com>
@royyhuang royyhuang marked this pull request as ready for review February 25, 2026 23:15
Signed-off-by: royyhuang <roy.y.huang@gmail.com>
Signed-off-by: royyhuang <roy.y.huang@gmail.com>
Signed-off-by: royyhuang <roy.y.huang@gmail.com>
Copy link
Copy Markdown
Contributor

@ApostaC ApostaC left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

Comment thread lmcache/v1/distributed/observability/logger/prometheus_logger.py Outdated
Comment thread lmcache/v1/distributed/observability/prometheus_controller.py
Comment thread lmcache/v1/distributed/observability/logger/l1_stats_logger.py Outdated
Comment thread lmcache/v1/distributed/observability/logger/l1_stats_logger.py Outdated
Comment thread lmcache/v1/distributed/observability/prometheus_controller.py
Comment thread lmcache/v1/distributed/observability/logger/storage_manager_stats_logger.py Outdated
Comment thread lmcache/v1/distributed/observability/logger/storage_manager_stats_logger.py Outdated
Signed-off-by: royyhuang <roy.y.huang@gmail.com>
Signed-off-by: royyhuang <roy.y.huang@gmail.com>
Signed-off-by: royyhuang <roy.y.huang@gmail.com>
@ApostaC ApostaC added the full Run comprehensive tests on this PR label Feb 27, 2026
@royyhuang royyhuang enabled auto-merge (squash) February 27, 2026 08:53
Copy link
Copy Markdown
Contributor

@ApostaC ApostaC left a comment

Choose a reason for hiding this comment

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

LGTM. Some future tasks:

  1. Move the observability module to something like lmcache/v1/mp_observability (and the configuration).
  2. Update the Prometheus controller implementation to enable a more flexible way to initialize the loggers (see the detail below)
  3. More stats loggers for L2, mp servers, vLLM integrations

Comment on lines +31 to +48
def __init__(
self,
storage_manager: "StorageManager",
l1_manager: L1Manager,
log_interval: float,
):
super().__init__(storage_manager, l1_manager)

self._log_interval = log_interval
self.all_loggers: List[PrometheusLogger] = []

self.sm_stats_logger: StorageManagerStatsLogger = StorageManagerStatsLogger()
self.get_storage_manager().register_listener(self.sm_stats_logger)
self.all_loggers.append(self.sm_stats_logger)

self.l1_stats_logger: L1ManagerStatsLogger = L1ManagerStatsLogger()
self.get_l1_manager().register_listener(self.l1_stats_logger)
self.all_loggers.append(self.l1_stats_logger)
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.

In the future, we can let each module (L1Manager, L2Manager, etc) to intialize their own loggers, and register those loggers into the Prometheus controller.

The Prometheus controller should be a singleton, and can be accessed by other components for logger registration.

In this case, the Prometheus controller itself does not storage_manager and l1_manager during intialization

@royyhuang royyhuang merged commit 2ff6f2b into LMCache:dev Feb 27, 2026
25 checks passed
sammshen pushed a commit to sammshen/LMCache that referenced this pull request Mar 1, 2026
* [feat] adding storage manager listener and observability skeleton

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* remove local uv.lock and coding agent markdown

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* [feat] add prometheus logger interface and prometheus controller

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* remove misleading no ops in eviction policy

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* fix code quality check and prometheus naming conflicts

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* refactor storage manager stats logger into stats logger per storage tier

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* address comments

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* fix tests

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

---------

Signed-off-by: royyhuang <roy.y.huang@gmail.com>
hlin99 pushed a commit to hlin99/LMCache that referenced this pull request Mar 2, 2026
* [feat] adding storage manager listener and observability skeleton

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* remove local uv.lock and coding agent markdown

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* [feat] add prometheus logger interface and prometheus controller

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* remove misleading no ops in eviction policy

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* fix code quality check and prometheus naming conflicts

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* refactor storage manager stats logger into stats logger per storage tier

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* address comments

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* fix tests

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

---------

Signed-off-by: royyhuang <roy.y.huang@gmail.com>
oferki pushed a commit to oferki/LMCache that referenced this pull request Mar 3, 2026
* [feat] adding storage manager listener and observability skeleton

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* remove local uv.lock and coding agent markdown

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* [feat] add prometheus logger interface and prometheus controller

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* remove misleading no ops in eviction policy

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* fix code quality check and prometheus naming conflicts

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* refactor storage manager stats logger into stats logger per storage tier

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* address comments

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* fix tests

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

---------

Signed-off-by: royyhuang <roy.y.huang@gmail.com>
Signed-off-by: Ofer Kiselov Nahman <ofer.kiselovnahman@weka.io>
oferki pushed a commit to oferki/LMCache that referenced this pull request Mar 3, 2026
* [feat] adding storage manager listener and observability skeleton

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* remove local uv.lock and coding agent markdown

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* [feat] add prometheus logger interface and prometheus controller

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* remove misleading no ops in eviction policy

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* fix code quality check and prometheus naming conflicts

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* refactor storage manager stats logger into stats logger per storage tier

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* address comments

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* fix tests

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

---------

Signed-off-by: royyhuang <roy.y.huang@gmail.com>
mauryaavinash95 pushed a commit to mauryaavinash95/LMCache that referenced this pull request Mar 7, 2026
* [feat] adding storage manager listener and observability skeleton

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* remove local uv.lock and coding agent markdown

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* [feat] add prometheus logger interface and prometheus controller

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* remove misleading no ops in eviction policy

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* fix code quality check and prometheus naming conflicts

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* refactor storage manager stats logger into stats logger per storage tier

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* address comments

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* fix tests

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

---------

Signed-off-by: royyhuang <roy.y.huang@gmail.com>
shaoxiawjc pushed a commit to shaoxiawjc/LMCache that referenced this pull request Mar 11, 2026
* [feat] adding storage manager listener and observability skeleton

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* remove local uv.lock and coding agent markdown

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* [feat] add prometheus logger interface and prometheus controller

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* remove misleading no ops in eviction policy

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* fix code quality check and prometheus naming conflicts

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* refactor storage manager stats logger into stats logger per storage tier

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* address comments

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* fix tests

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

---------

Signed-off-by: royyhuang <roy.y.huang@gmail.com>
Signed-off-by: shaoxiawjc <wjc2800@163.com>
realAaronWu pushed a commit to realAaronWu/LMCache that referenced this pull request Mar 20, 2026
* [feat] adding storage manager listener and observability skeleton

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* remove local uv.lock and coding agent markdown

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* [feat] add prometheus logger interface and prometheus controller

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* remove misleading no ops in eviction policy

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* fix code quality check and prometheus naming conflicts

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* refactor storage manager stats logger into stats logger per storage tier

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* address comments

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* fix tests

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

---------

Signed-off-by: royyhuang <roy.y.huang@gmail.com>
Signed-off-by: Aaron Wu <aaron.wu@dell.com>
jooho-XCENA pushed a commit to xcena-dev/LMCache that referenced this pull request Apr 2, 2026
* [feat] adding storage manager listener and observability skeleton

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* remove local uv.lock and coding agent markdown

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* [feat] add prometheus logger interface and prometheus controller

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* remove misleading no ops in eviction policy

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* fix code quality check and prometheus naming conflicts

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* refactor storage manager stats logger into stats logger per storage tier

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* address comments

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* fix tests

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

---------

Signed-off-by: royyhuang <roy.y.huang@gmail.com>
jooho-XCENA pushed a commit to xcena-dev/LMCache that referenced this pull request Apr 2, 2026
* [feat] adding storage manager listener and observability skeleton

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* remove local uv.lock and coding agent markdown

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* [feat] add prometheus logger interface and prometheus controller

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* remove misleading no ops in eviction policy

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* fix code quality check and prometheus naming conflicts

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* refactor storage manager stats logger into stats logger per storage tier

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* address comments

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

* fix tests

Signed-off-by: royyhuang <roy.y.huang@gmail.com>

---------

Signed-off-by: royyhuang <roy.y.huang@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full Run comprehensive tests on this PR mp_mode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants