Skip to content
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

[metric] refact summary with better algorithm #767

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 0 additions & 175 deletions include/ylt/metric/detail/ckms_quantiles.hpp

This file was deleted.

52 changes: 0 additions & 52 deletions include/ylt/metric/detail/time_window_quantiles.hpp

This file was deleted.

13 changes: 0 additions & 13 deletions include/ylt/metric/metric.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,6 @@ class metric_t {
virtual void serialize_to_json(std::string& str) {}
#endif

// only for summary
virtual async_simple::coro::Lazy<void> serialize_async(std::string& out) {
co_return;
}

#ifdef CINATRA_ENABLE_METRIC_JSON
// only for summary
virtual async_simple::coro::Lazy<void> serialize_to_json_async(
std::string& out) {
co_return;
}
#endif

template <typename T>
T* as() {
return dynamic_cast<T*>(this);
Expand Down
16 changes: 2 additions & 14 deletions include/ylt/metric/metric_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,8 @@ class manager_helper {
const std::vector<std::shared_ptr<metric_t>>& metrics) {
std::string str;
for (auto& m : metrics) {
if (m->metric_type() == MetricType::Summary) {
async_simple::coro::syncAwait(m->serialize_async(str));
}
else {
m->serialize(str);
}
m->serialize(str);
}

return str;
}

Expand All @@ -49,13 +43,7 @@ class manager_helper {
str.append("[");
for (auto& m : metrics) {
size_t start = str.size();
if (m->metric_type() == MetricType::Summary) {
async_simple::coro::syncAwait(m->serialize_to_json_async(str));
}
else {
m->serialize_to_json(str);
}

m->serialize_to_json(str);
if (str.size() > start)
str.append(",");
}
Expand Down
Loading
Loading