Skip to content

Commit

Permalink
write AvailableMetrics in protobuf
Browse files Browse the repository at this point in the history
  • Loading branch information
Keksoj committed Apr 5, 2023
1 parent 4472332 commit dbd1fad
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
6 changes: 3 additions & 3 deletions bin/src/command/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ use sozu_command_lib::{
logging,
parser::parse_several_commands,
proto::command::{
AggregatedMetrics, FrontendFilters, ListenersList, MetricsConfiguration, RunState,
WorkerInfo,
AggregatedMetrics, AvailableMetrics, FrontendFilters, ListenersList, MetricsConfiguration,
RunState, WorkerInfo,
},
request::{Request, WorkerRequest},
response::{AvailableMetrics, ListedFrontends, Response, ResponseContent, ResponseStatus},
response::{ListedFrontends, Response, ResponseContent, ResponseStatus},
scm_socket::Listeners,
state::get_cluster_ids_by_domain,
};
Expand Down
6 changes: 3 additions & 3 deletions bin/src/ctl/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use prettytable::{Row, Table};

use sozu_command_lib::{
proto::command::{
filtered_metrics, AggregatedMetrics, ClusterMetrics, FilteredMetrics, ListenersList,
WorkerInfo, WorkerMetrics,
filtered_metrics, AggregatedMetrics, AvailableMetrics, ClusterMetrics, FilteredMetrics,
ListenersList, WorkerInfo, WorkerMetrics,
},
response::{AvailableMetrics, ListedFrontends, ResponseContent},
response::{ListedFrontends, ResponseContent},
};

pub fn print_listeners(listeners_list: ListenersList) {
Expand Down
6 changes: 6 additions & 0 deletions command/src/command.proto
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,12 @@ enum RunState {
NOT_ANSWERING = 3;
}

// lists of available metrics in a worker, or in the main process (in which case there are no cluster metrics)
message AvailableMetrics {
repeated string proxy_metrics = 1;
repeated string cluster_metrics = 2;
}

// Aggregated metrics of main process & workers
message AggregatedMetrics {
map<string, FilteredMetrics> main = 1;
Expand Down
13 changes: 3 additions & 10 deletions command/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use std::{

use crate::{
proto::command::{
AddBackend, AggregatedMetrics, CertificateSummary, Cluster, FilteredTimeSerie,
ListenersList, LoadBalancingParams, PathRule, PathRuleKind, RequestHttpFrontend,
RequestTcpFrontend, RulePosition, RunState, WorkerInfo, WorkerMetrics,
AddBackend, AggregatedMetrics, AvailableMetrics, CertificateSummary, Cluster,
FilteredTimeSerie, ListenersList, LoadBalancingParams, PathRule, PathRuleKind,
RequestHttpFrontend, RequestTcpFrontend, RulePosition, RunState, WorkerInfo, WorkerMetrics,
},
request::PROTOCOL_VERSION,
state::{ClusterId, ConfigState},
Expand Down Expand Up @@ -101,13 +101,6 @@ pub struct ClusterInformation {
pub backends: Vec<Backend>,
}

/// lists of available metrics in a worker, or in the main process (in which case there are no cluster metrics)
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct AvailableMetrics {
pub proxy_metrics: Vec<String>,
pub cluster_metrics: Vec<String>,
}

#[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct HttpFrontend {
/// Send a 401, DENY, if cluster_id is None
Expand Down
4 changes: 2 additions & 2 deletions lib/src/metrics/local_drain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::{collections::BTreeMap, str, time::Instant};
use anyhow::Context;
use hdrhistogram::Histogram;
use sozu_command::{
proto::command::{filtered_metrics, BackendMetrics},
response::{AvailableMetrics, ResponseContent},
proto::command::{filtered_metrics, AvailableMetrics, BackendMetrics},
response::ResponseContent,
};

use crate::sozu_command::proto::command::{
Expand Down

0 comments on commit dbd1fad

Please sign in to comment.