-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Cluster output circuit breaker #140
Changes from 7 commits
7fe0d9e
1ff26ef
253cda0
e492297
72d050d
4b3da39
2a6d509
4cf813e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,9 +100,29 @@ bool AdminImpl::changeLogLevel(const Http::Utility::QueryParams& params) { | |
return true; | ||
} | ||
|
||
void AdminImpl::addCircuitSettings(const std::string& cluster_name, const std::string& priority_str, | ||
Upstream::ResourceManager& resource_manager, | ||
Buffer::Instance& response) { | ||
response.add(fmt::format("{}::{}_priority::max_connections::{}\n", cluster_name, priority_str, | ||
resource_manager.connections().max())); | ||
response.add(fmt::format("{}::{}_priority::max_pending_requests::{}\n", cluster_name, | ||
priority_str, resource_manager.pendingRequests().max())); | ||
response.add(fmt::format("{}::{}_priority::max_requests::{}\n", cluster_name, priority_str, | ||
resource_manager.requests().max())); | ||
response.add(fmt::format("{}::{}_priority::max_retries::{}\n", cluster_name, priority_str, | ||
resource_manager.retries().max())); | ||
} | ||
|
||
Http::Code AdminImpl::handlerClusters(const std::string&, Buffer::Instance& response) { | ||
for (auto& cluster : server_.clusterManager().clusters()) { | ||
response.add(fmt::format("=== {} ===\n", cluster.second->name())); | ||
|
||
addCircuitSettings(cluster.second->name(), "default", | ||
cluster.second->resourceManager(Upstream::ResourcePriority::Default), | ||
response); | ||
addCircuitSettings(cluster.second->name(), "high", | ||
cluster.second->resourceManager(Upstream::ResourcePriority::High), response); | ||
|
||
for (auto& host : cluster.second->hosts()) { | ||
std::map<std::string, uint64_t> all_stats; | ||
for (Stats::Counter& counter : host->counters()) { | ||
|
@@ -128,6 +148,9 @@ Http::Code AdminImpl::handlerClusters(const std::string&, Buffer::Instance& resp | |
fmt::format("{}::{}::canary::{}\n", cluster.second->name(), host->url(), host->canary())); | ||
response.add("\n"); | ||
} | ||
if (cluster.second->hosts().empty()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would just remove this new code as well as the newline in the hosts case, as well as the === === thing above. The reality is that this is always used with grep so it's all pointless. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed all of it. |
||
response.add("\n"); | ||
} | ||
} | ||
|
||
return Http::Code::OK; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline before this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added