mirror of
https://github.com/kvcache-ai/Mooncake.git
synced 2026-11-05 01:17:55 +00:00
[PR #1355] [MERGED] [TENT] Add Metrics System with HTTP Server and Prometheus Integration #2188
Labels
No labels
ascend
auto-closed
bug
bug
CI/Build
Common
documentation
enhancement
feature request
good first issue
help wanted
high priority
MetaX
nightly-failure
pull-request
PyTorch Backend
question
RFC
Roadmap
stale
Store
Tests
Transfer Engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/Mooncake#2188
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/Mooncake/pull/1355
Author: @staryxchen
Created: 1/11/2026
Status: ✅ Merged
Merged: 1/12/2026
Merged by: @alogfans
Base:
main← Head:dev/metric-tent📝 Commits (10+)
7295832feat(metrics): add TENT metrics system with HTTP server and Prometheusbf57aa2Update docs/source/design/tent/metrics.mdaeac251refactor(metrics): simplify config loading with explicit priority58589f7refactor(transfer_engine): extract metrics recording logic into dedicated methodb2c6f6cbuild(metrics): improve yalantinglibs dependency handlingacb368erefactor(metrics): replace manual JSON construction with nlohmann/json library7f8a5c6style: reformat code with clang-format48a5a0drefactor(config): centralize parsing utilities in ConfigHelper3d9a540test: add unit tests for metrics config loader and reorganize test structurec01191dstyle: reformat code lines for better readability📊 Changes
17 files changed (+2319 additions, -2 deletions)
View changed files
➕
docs/source/design/tent/metrics.md(+388 -0)📝
mooncake-transfer-engine/tent/CMakeLists.txt(+2 -1)📝
mooncake-transfer-engine/tent/config/transfer-engine.json(+18 -0)📝
mooncake-transfer-engine/tent/include/tent/common/config.h(+9 -0)➕
mooncake-transfer-engine/tent/include/tent/metrics/config_loader.h(+100 -0)➕
mooncake-transfer-engine/tent/include/tent/metrics/tent_metrics.h(+276 -0)📝
mooncake-transfer-engine/tent/include/tent/runtime/transfer_engine_impl.h(+6 -0)📝
mooncake-transfer-engine/tent/src/CMakeLists.txt(+1 -0)📝
mooncake-transfer-engine/tent/src/common/config.cpp(+80 -0)➕
mooncake-transfer-engine/tent/src/metrics/CMakeLists.txt(+29 -0)➕
mooncake-transfer-engine/tent/src/metrics/config_loader.cpp(+239 -0)➕
mooncake-transfer-engine/tent/src/metrics/tent_metrics.cpp(+391 -0)📝
mooncake-transfer-engine/tent/src/runtime/CMakeLists.txt(+1 -1)📝
mooncake-transfer-engine/tent/src/runtime/transfer_engine_impl.cpp(+74 -0)➕
mooncake-transfer-engine/tent/tests/CMakeLists.txt(+12 -0)➕
mooncake-transfer-engine/tent/tests/metrics_config_loader_test.cpp(+433 -0)➕
mooncake-transfer-engine/tent/tests/tent_metrics_example.cpp(+260 -0)📄 Description
Summary
This PR introduces a comprehensive metrics system for TENT, providing Prometheus-compatible metrics collection and HTTP server endpoints for monitoring data transfer performance.
Key Changes
New Features
Metrics Collection System: Implemented counter and histogram metrics for monitoring read/write operations, including:
HTTP Server with Multiple Endpoints:
/metrics- Prometheus format for scraping/metrics/json- JSON format for programmatic access/metrics/summary- Human-readable summary/health- Health check endpointConfiguration System: Flexible configuration via:
transfer-engine.json)Performance Optimizations:
-DTENT_METRICS_ENABLED=OFF) for zero runtime overheadTentMetrics::setEnabled(false)for minimal overhead (~1ns atomic load)Integration with TransferEngine
Metrics are automatically integrated into TransferEngine with RAII-style latency tracking:
submitTransfergetTransferStatusdetects task completionImportant Design Decisions
Metrics Disabled by Default
This is a significant change that adds a new subsystem to the codebase. To ensure stability and avoid any unexpected performance impact on existing deployments, metrics are disabled by default at compile time (
TENT_METRICS_ENABLED=OFF).Users who want to enable metrics must explicitly build with:
This conservative approach allows teams to:
Current Metrics Scope
The current implementation provides metrics that are consistent with the classic Transfer Engine metrics, focusing on:
This implementation is designed to be extensible. Future PRs can easily add more metrics by following the documented pattern in the metrics documentation.
Documentation and Examples
This PR includes comprehensive documentation and examples:
Documentation (
docs/source/design/tent/metrics.md):Example Application (
mooncake-transfer-engine/tent/examples/tent_metrics_example.cpp):Files Changed
docs/source/design/tent/metrics.mdtent/include/tent/metrics/tent_metrics.htent/include/tent/metrics/config_loader.htent/src/metrics/tent_metrics.cpptent/src/metrics/config_loader.cpptent/src/runtime/transfer_engine_impl.cpptent/examples/tent_metrics_example.cpptent/config/transfer-engine.jsonTesting
curl:Future Work
This implementation lays the foundation for extended metrics support. Potential future additions include:
Type of Change
How Has This Been Tested?
Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.