Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Lee Benson <lee@leebenson.com>
  • Loading branch information
ktff and leebenson authored Apr 20, 2021
1 parent 8d3c82f commit 7df19de
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
26 changes: 13 additions & 13 deletions lib/vector-api-client/src/gql/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub struct ComponentProcessedBytesTotalsSubscription;
pub struct ComponentEventsInThroughputsSubscription;

/// ComponentEventsInTotalsSubscription contains metrics on the number of events
/// that have been accepted for processing by a Vector instance, against specific components
/// that have been accepted for processing by a Vector instance, against specific components.
#[derive(GraphQLQuery, Debug, Copy, Clone)]
#[graphql(
schema_path = "graphql/schema.json",
Expand All @@ -144,7 +144,7 @@ pub struct ComponentEventsInThroughputsSubscription;
pub struct ComponentEventsInTotalsSubscription;

/// ComponentEventsOutThroughputsSubscription contains metrics on the number of events
/// that have been emitted between `interval` samples, against specific components
/// that have been emitted between `interval` samples, against specific components.
#[derive(GraphQLQuery, Debug, Copy, Clone)]
#[graphql(
schema_path = "graphql/schema.json",
Expand All @@ -154,7 +154,7 @@ pub struct ComponentEventsInTotalsSubscription;
pub struct ComponentEventsOutThroughputsSubscription;

/// ComponentEventsOutTotalsSubscription contains metrics on the number of events
/// that have been emitted by a Vector instance, against specific components
/// that have been emitted by a Vector instance, against specific components.
#[derive(GraphQLQuery, Debug, Copy, Clone)]
#[graphql(
schema_path = "graphql/schema.json",
Expand All @@ -165,7 +165,7 @@ pub struct ComponentEventsOutTotalsSubscription;

/// Extension methods for metrics subscriptions
pub trait MetricsSubscriptionExt {
/// Executes an uptime metrics subscription
/// Executes an uptime metrics subscription.
fn uptime_subscription(&self) -> crate::BoxedSubscription<UptimeSubscription>;

/// Executes an events processed metrics subscription
Expand All @@ -192,7 +192,7 @@ pub trait MetricsSubscriptionExt {
interval: i64,
) -> crate::BoxedSubscription<EventsInTotalSubscription>;

/// Executes an events in throughput subscription
/// Executes an events in throughput subscription.
fn events_in_throughput_subscription(
&self,
interval: i64,
Expand Down Expand Up @@ -316,7 +316,7 @@ impl MetricsSubscriptionExt for crate::SubscriptionClient {
self.start::<EventsInTotalSubscription>(&request_body)
}

/// Executes an events in throughput subscription
/// Executes an events in throughput subscription.
fn events_in_throughput_subscription(
&self,
interval: i64,
Expand All @@ -328,7 +328,7 @@ impl MetricsSubscriptionExt for crate::SubscriptionClient {
self.start::<EventsInThroughputSubscription>(&request_body)
}

/// Executes an events out metrics subscription
/// Executes an events out metrics subscription.
fn events_out_total_subscription(
&self,
interval: i64,
Expand All @@ -341,7 +341,7 @@ impl MetricsSubscriptionExt for crate::SubscriptionClient {
self.start::<EventsOutTotalSubscription>(&request_body)
}

/// Executes an events out throughput subscription
/// Executes an events out throughput subscription.
fn events_out_throughput_subscription(
&self,
interval: i64,
Expand All @@ -353,7 +353,7 @@ impl MetricsSubscriptionExt for crate::SubscriptionClient {
self.start::<EventsOutThroughputSubscription>(&request_body)
}

/// Executes an all component events processed totals subscription
/// Executes an all component events processed totals subscription.
fn component_processed_events_totals_subscription(
&self,
interval: i64,
Expand Down Expand Up @@ -401,7 +401,7 @@ impl MetricsSubscriptionExt for crate::SubscriptionClient {
self.start::<ComponentProcessedBytesThroughputsSubscription>(&request_body)
}

/// Executes an all component events in totals subscription
/// Executes an all component events in totals subscription.
fn component_events_in_totals_subscription(
&self,
interval: i64,
Expand All @@ -413,7 +413,7 @@ impl MetricsSubscriptionExt for crate::SubscriptionClient {
self.start::<ComponentEventsInTotalsSubscription>(&request_body)
}

/// Executes an all component events in throughputs subscription
/// Executes an all component events in throughputs subscription.
fn component_events_in_throughputs_subscription(
&self,
interval: i64,
Expand All @@ -425,7 +425,7 @@ impl MetricsSubscriptionExt for crate::SubscriptionClient {
self.start::<ComponentEventsInThroughputsSubscription>(&request_body)
}

/// Executes an all component events out totals subscription
/// Executes an all component events out totals subscription.
fn component_events_out_totals_subscription(
&self,
interval: i64,
Expand All @@ -437,7 +437,7 @@ impl MetricsSubscriptionExt for crate::SubscriptionClient {
self.start::<ComponentEventsOutTotalsSubscription>(&request_body)
}

/// Executes an all component events out throughputs subscription
/// Executes an all component events out throughputs subscription.
fn component_events_out_throughputs_subscription(
&self,
interval: i64,
Expand Down
8 changes: 4 additions & 4 deletions src/api/schema/metrics/events_in.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl EventsInTotal {
self.get_timestamp()
}

/// Total number of events inputted
/// Total incoming events
pub async fn events_in_total(&self) -> f64 {
self.get_events_in_total()
}
Expand All @@ -47,7 +47,7 @@ pub struct ComponentEventsInTotal {

impl ComponentEventsInTotal {
/// Returns a new `ComponentEventsInTotal` struct, which is a GraphQL type. The
/// component name is hoisted for clear field resolution in the resulting payload
/// component name is hoisted for clear field resolution in the resulting payload.
pub fn new(metric: Metric) -> Self {
let name = metric.tag_value("component_name").expect(
"Returned a metric without a `component_name`, which shouldn't happen. Please report.",
Expand All @@ -64,7 +64,7 @@ impl ComponentEventsInTotal {
&self.name
}

/// Events inputted total metric
/// Total incoming events metric
async fn metric(&self) -> EventsInTotal {
EventsInTotal::new(self.metric.clone())
}
Expand All @@ -76,7 +76,7 @@ pub struct ComponentEventsInThroughput {
}

impl ComponentEventsInThroughput {
/// Returns a new `ComponentEventsInThroughput`, set to the provided name/throughput values
/// Returns a new `ComponentEventsInThroughput`, set to the provided name/throughput values.
pub fn new(name: String, throughput: i64) -> Self {
Self { name, throughput }
}
Expand Down
6 changes: 3 additions & 3 deletions src/api/schema/metrics/events_out.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl EventsOutTotal {
self.get_timestamp()
}

/// Total number of events outputted
/// Total outgoing events
pub async fn events_out_total(&self) -> f64 {
self.get_events_out_total()
}
Expand All @@ -47,7 +47,7 @@ pub struct ComponentEventsOutTotal {

impl ComponentEventsOutTotal {
/// Returns a new `ComponentEventsOutTotal` struct, which is a GraphQL type. The
/// component name is hoisted for clear field resolution in the resulting payload
/// component name is hoisted for clear field resolution in the resulting payload.
pub fn new(metric: Metric) -> Self {
let name = metric.tag_value("component_name").expect(
"Returned a metric without a `component_name`, which shouldn't happen. Please report.",
Expand All @@ -64,7 +64,7 @@ impl ComponentEventsOutTotal {
&self.name
}

/// Events outputted total metric
/// Total outgoing events metric
async fn metric(&self) -> EventsOutTotal {
EventsOutTotal::new(self.metric.clone())
}
Expand Down
12 changes: 6 additions & 6 deletions src/api/schema/metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl MetricsSubscription {
})
}

/// Event inputting metrics.
/// Total incoming events metrics
async fn events_in_total(
&self,
#[graphql(default = 1000, validator(IntRange(min = "10", max = "60_000")))] interval: i32,
Expand All @@ -127,7 +127,7 @@ impl MetricsSubscription {
})
}

/// Event inputting throughput sampled over the provided millisecond `interval`.
/// Total incoming events throughput sampled over the provided millisecond `interval`
async fn events_in_throughput(
&self,
#[graphql(default = 1000, validator(IntRange(min = "10", max = "60_000")))] interval: i32,
Expand All @@ -136,7 +136,7 @@ impl MetricsSubscription {
.map(|(_, throughput)| throughput as i64)
}

/// Component event inputting throughput metrics over `interval`.
/// Total incoming component events throughput metrics over `interval`
async fn component_events_in_throughputs(
&self,
#[graphql(default = 1000, validator(IntRange(min = "10", max = "60_000")))] interval: i32,
Expand All @@ -153,7 +153,7 @@ impl MetricsSubscription {
})
}

/// Component event inputting metrics over `interval`.
/// Total incoming component event metrics over `interval`
async fn component_events_in_totals(
&self,
#[graphql(default = 1000, validator(IntRange(min = "10", max = "60_000")))] interval: i32,
Expand All @@ -162,7 +162,7 @@ impl MetricsSubscription {
.map(|m| m.into_iter().map(ComponentEventsInTotal::new).collect())
}

/// Event outputting metrics.
/// Total outgoing events metrics
async fn events_out_total(
&self,
#[graphql(default = 1000, validator(IntRange(min = "10", max = "60_000")))] interval: i32,
Expand All @@ -173,7 +173,7 @@ impl MetricsSubscription {
})
}

/// Event outputting throughput sampled over the provided millisecond `interval`.
/// Total outgoing events throughput sampled over the provided millisecond `interval`
async fn events_out_throughput(
&self,
#[graphql(default = 1000, validator(IntRange(min = "10", max = "60_000")))] interval: i32,
Expand Down

0 comments on commit 7df19de

Please sign in to comment.