Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions src/components/validation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ pub struct RunnerMetrics {
pub sent_bytes_total: u64, // a reciprocal for received_bytes_total
pub sent_event_bytes_total: u64,
pub sent_events_total: u64,
pub discarded_events_total: u64,
}

#[cfg(all(test, feature = "component-validation-tests"))]
Expand Down
16 changes: 16 additions & 0 deletions src/components/validation/validators/component_spec/sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub enum SourceMetricType {
ReceivedBytesTotal,
SentEventsTotal,
SentEventBytesTotal,
EventsDropped,
Comment thread
neuronull marked this conversation as resolved.
Outdated
}

impl SourceMetricType {
Expand All @@ -24,6 +25,7 @@ impl SourceMetricType {
SourceMetricType::ReceivedBytesTotal => "component_received_bytes_total",
SourceMetricType::SentEventsTotal => "component_sent_events_total",
SourceMetricType::SentEventBytesTotal => "component_sent_event_bytes_total",
SourceMetricType::EventsDropped => "component_discarded_events_total",
}
}
}
Expand All @@ -47,6 +49,7 @@ pub fn validate_sources(
validate_component_received_bytes_total,
validate_component_sent_events_total,
validate_component_sent_event_bytes_total,
validate_component_discarded_events_total,
];

for v in validations.iter() {
Expand Down Expand Up @@ -226,3 +229,16 @@ fn validate_component_sent_event_bytes_total(
expected_bytes,
)
}

fn validate_component_discarded_events_total(
telemetry_events: &[Event],
runner_metrics: &RunnerMetrics,
) -> Result<Vec<String>, Vec<String>> {
let expected_dropped = runner_metrics.discarded_events_total;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note- the expected value is not currently being set.

This is a rather tricky one to validate since it requires forcing the stream to close, after we sent the events to the source and before it sent them to the downstream.


validate_bytes_total(
Comment thread
neuronull marked this conversation as resolved.
Outdated
telemetry_events,
&SourceMetricType::EventsDropped,
expected_dropped,
)
}