-
Notifications
You must be signed in to change notification settings - Fork 48
[Feat] UCM supports metrics display online via Grafana and Promethues #414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8e12d7c
[Feat] Build metrics frame
flesher0813 bb62c9c
[Feat]add metrics(ucm_obser.py + metrics_configs.yaml)
bca21f3
[Feat] Implementation of metrics logger on the C++ side for storing a…
sumingZero 469267b
[Fix] Provide simple grafana and fix bugs
flesher0813 c6f5c50
[feat] change the log position of UCM metrics
sumingZero e35a185
[fix]modify grafana.json
37d447a
[Feat] UCM supports metrics display online via Grafana and Promethues
sumingZero 6dff182
[Fix] Remove configs to examples and add liscense
flesher0813 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Prometheus Metrics Configuration | ||
| # This file defines which metrics should be enabled and their configurations | ||
| log_interval: 5 # Interval in seconds for logging metrics | ||
|
|
||
| prometheus: | ||
| multiproc_dir: "/vllm-workspace" # Directory for Prometheus multiprocess mode | ||
|
|
||
| metric_prefix: "ucm:" | ||
|
|
||
| # Enable/disable metrics by category | ||
| enabled_metrics: | ||
| counters: true | ||
| gauges: true | ||
| histograms: true | ||
|
|
||
| # Counter metrics configuration | ||
| # counters: | ||
| # - name: "received_requests" | ||
| # documentation: "Total number of requests sent to ucm" | ||
|
|
||
| # Gauge metrics configuration | ||
| # gauges: | ||
| # - name: "lookup_hit_rate" | ||
| # documentation: "Hit rate of ucm lookup requests since last log" | ||
| # multiprocess_mode: "livemostrecent" | ||
|
|
||
| # Histogram metrics configuration | ||
| histograms: | ||
| - name: "load_requests_num" | ||
| documentation: "Number of requests loaded from ucm" | ||
| buckets: [1, 5, 10, 20, 50, 100, 200, 500, 1000] | ||
| - name: "load_blocks_num" | ||
| documentation: "Number of blocks loaded from ucm" | ||
| buckets: [0, 50, 100, 150, 200, 250, 300, 350, 400, 550, 600, 750, 800, 850, 900, 950, 1000] | ||
| - name: "load_duration" | ||
| documentation: "Time to load from ucm (ms)" | ||
| buckets: [0, 50, 100, 150, 200, 250, 300, 350, 400, 550, 600, 750, 800, 850, 900, 950, 1000] | ||
| - name: "load_speed" | ||
| documentation: "Speed of loading from ucm (GB/s)" | ||
| buckets: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 50, 60, 70, 80, 90, 100] | ||
| - name: "save_requests_num" | ||
| documentation: "Number of requests saved to ucm" | ||
| buckets: [1, 5, 10, 20, 50, 100, 200, 500, 1000] | ||
| - name: "save_blocks_num" | ||
| documentation: "Number of blocks saved to ucm" | ||
| buckets: [0, 50, 100, 150, 200, 250, 300, 350, 400, 550, 600, 750, 800, 850, 900, 950, 1000] | ||
| - name: "save_duration" | ||
| documentation: "Time to save to ucm (ms)" | ||
| buckets: [0, 50, 100, 150, 200, 250, 300, 350, 400, 550, 600, 750, 800, 850, 900, 950, 1000] | ||
| - name: "save_speed" | ||
| documentation: "Speed of saving to ucm (GB/s)" | ||
| buckets: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 50, 60, 70, 80, 90, 100] | ||
| - name: "interval_lookup_hit_rates" | ||
| documentation: "Hit rates of ucm lookup requests" | ||
| buckets: [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0] | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| add_subdirectory(vendor) | ||
| add_subdirectory(trans) | ||
| add_subdirectory(metrics) | ||
| add_subdirectory(test) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| file(GLOB_RECURSE CORE_SRCS CONFIGURE_DEPENDS | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/cc/stats/*.cc" | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/cc/*.cc") | ||
| add_library(monitor_static STATIC ${CORE_SRCS}) | ||
| set_property(TARGET monitor_static PROPERTY POSITION_INDEPENDENT_CODE ON) | ||
| target_include_directories(monitor_static PUBLIC | ||
| $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cc> | ||
| $<INSTALL_INTERFACE:include>) | ||
| set_target_properties(monitor_static PROPERTIES OUTPUT_NAME monitor) | ||
|
|
||
| file(GLOB_RECURSE BINDINGS_SRCS CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/cpy/*.cc") | ||
| pybind11_add_module(ucmmonitor ${BINDINGS_SRCS}) | ||
| target_link_libraries(ucmmonitor PRIVATE -Wl,--whole-archive monitor_static -Wl,--no-whole-archive) | ||
| target_include_directories(ucmmonitor PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/cc) | ||
| set_target_properties(ucmmonitor PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| /** | ||
| * MIT License | ||
| * | ||
| * Copyright (c) 2025 Huawei Technologies Co., Ltd. All rights reserved. | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be included in all | ||
| * copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| * SOFTWARE. | ||
| * */ | ||
| #include "conn_stats.h" | ||
flesher0813 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| namespace UC::Metrics { | ||
|
|
||
| ConnStats::ConnStats() = default; | ||
|
|
||
| std::string ConnStats::Name() const { | ||
| return "ConnStats"; | ||
| } | ||
|
|
||
| void ConnStats::Reset() { | ||
| for (auto& v : data_) v.clear(); | ||
| } | ||
|
|
||
| void ConnStats::Update(const std::unordered_map<std::string, double>& params) { | ||
| for (const auto& [k, v] : params) { | ||
| Key id = KeyFromString(k); | ||
| if (id == Key::COUNT) continue; | ||
| EmplaceBack(id, v); | ||
| } | ||
| } | ||
|
|
||
| std::unordered_map<std::string, std::vector<double>> ConnStats::Data() { | ||
| std::unordered_map<std::string, std::vector<double>> result; | ||
| result["save_requests_num"] = data_[static_cast<std::size_t>(Key::save_requests_num)]; | ||
| result["save_blocks_num"] = data_[static_cast<std::size_t>(Key::save_blocks_num)]; | ||
| result["save_duration"] = data_[static_cast<std::size_t>(Key::save_duration)]; | ||
| result["save_speed"] = data_[static_cast<std::size_t>(Key::save_speed)]; | ||
| result["load_requests_num"] = data_[static_cast<std::size_t>(Key::load_requests_num)]; | ||
| result["load_blocks_num"] = data_[static_cast<std::size_t>(Key::load_blocks_num)]; | ||
| result["load_duration"] = data_[static_cast<std::size_t>(Key::load_duration)]; | ||
| result["load_speed"] = data_[static_cast<std::size_t>(Key::load_speed)]; | ||
| result["interval_lookup_hit_rates"] = data_[static_cast<std::size_t>(Key::interval_lookup_hit_rates)]; | ||
| return result; | ||
| } | ||
|
|
||
| Key ConnStats::KeyFromString(const std::string& k) { | ||
| if (k == "save_requests_num") return Key::save_requests_num; | ||
| if (k == "save_blocks_num") return Key::save_blocks_num; | ||
| if (k == "save_duration") return Key::save_duration; | ||
| if (k == "save_speed") return Key::save_speed; | ||
| if (k == "load_requests_num") return Key::load_requests_num; | ||
| if (k == "load_blocks_num") return Key::load_blocks_num; | ||
| if (k == "load_duration") return Key::load_duration; | ||
| if (k == "load_speed") return Key::load_speed; | ||
| if (k == "interval_lookup_hit_rates")return Key::interval_lookup_hit_rates; | ||
| return Key::COUNT; | ||
| } | ||
|
|
||
| void ConnStats::EmplaceBack(Key id, double value) { | ||
| data_[static_cast<std::size_t>(id)].push_back(value); | ||
| } | ||
|
|
||
| static Registrar registrar; | ||
|
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.