Skip to content

Commit

Permalink
rename AggregatedMetricsData to AggregatedMetrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Keksoj committed Mar 22, 2023
1 parent 0c94c2b commit ad7f58f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions bin/src/command/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use sozu_command_lib::{
parser::parse_several_commands,
request::{FrontendFilters, MetricsConfiguration, QueryClusterType, Request, WorkerRequest},
response::{
AggregatedMetricsData, ListedFrontends, ListenersList, Response, ResponseContent,
AggregatedMetrics, ListedFrontends, ListenersList, Response, ResponseContent,
ResponseStatus, RunState, WorkerInfo,
},
scm_socket::Listeners,
Expand Down Expand Up @@ -1047,7 +1047,8 @@ impl CommandServer {
let mut main_response_content = None;
match &request {
Request::QueryClustersHashes => {
main_response_content = Some(ResponseContent::ClustersHashes(self.state.hash_state()));
main_response_content =
Some(ResponseContent::ClustersHashes(self.state.hash_state()));
}
Request::QueryClusters(query_type) => {
main_response_content = Some(ResponseContent::Clusters(match query_type {
Expand Down Expand Up @@ -1130,7 +1131,7 @@ impl CommandServer {
if options.list {
Success::Query(ResponseContent::WorkerResponses(worker_responses))
} else {
Success::Query(ResponseContent::Metrics(AggregatedMetricsData {
Success::Query(ResponseContent::Metrics(AggregatedMetrics {
main: main_metrics,
workers: worker_responses,
}))
Expand Down
4 changes: 2 additions & 2 deletions bin/src/ctl/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use anyhow::{self, bail, Context};
use prettytable::{Row, Table};

use sozu_command_lib::response::{
AggregatedMetricsData, ClusterMetricsData, FilteredData, ListedFrontends, ListenersList,
AggregatedMetrics, ClusterMetricsData, FilteredData, ListedFrontends, ListenersList,
QueryAnswerCertificate, QueryAnswerMetrics, ResponseContent, Route, WorkerInfo, WorkerMetrics,
};

Expand Down Expand Up @@ -193,7 +193,7 @@ pub fn print_frontend_list(frontends: ListedFrontends) {

pub fn print_metrics(
// main & worker metrics
aggregated_metrics: AggregatedMetricsData,
aggregated_metrics: AggregatedMetrics,
json: bool,
) -> anyhow::Result<()> {
if json {
Expand Down
6 changes: 3 additions & 3 deletions command/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub enum ResponseContent {
/// a list of workers, with ids, pids, statuses
Workers(Vec<WorkerInfo>),
/// aggregated metrics of main process and workers
Metrics(AggregatedMetricsData),
Metrics(AggregatedMetrics),
/// worker responses to a same query: worker_id -> response_content
WorkerResponses(BTreeMap<String, ResponseContent>),
/// the state of Sōzu: frontends, backends, listeners, etc.
Expand Down Expand Up @@ -545,7 +545,7 @@ impl fmt::Display for WorkerResponse {

/// Aggregated metrics of main process & workers, for the CLI
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct AggregatedMetricsData {
pub struct AggregatedMetrics {
pub main: BTreeMap<String, FilteredData>,
pub workers: BTreeMap<String, ResponseContent>,
}
Expand Down Expand Up @@ -685,7 +685,7 @@ mod tests {
version: 0,
status: ResponseStatus::Ok,
message: String::from(""),
content: Some(ResponseContent::Metrics(AggregatedMetricsData {
content: Some(ResponseContent::Metrics(AggregatedMetrics {
main: [
(String::from("sozu.gauge"), FilteredData::Gauge(1)),
(String::from("sozu.count"), FilteredData::Count(-2)),
Expand Down

0 comments on commit ad7f58f

Please sign in to comment.