vector/internal_events/
aws_kinesis.rs

1/// Used in both `aws_kinesis_streams` and `aws_kinesis_firehose` sinks
2use metrics::counter;
3use vector_lib::NamedInternalEvent;
4use vector_lib::internal_event::{
5    ComponentEventsDropped, InternalEvent, UNINTENTIONAL, error_stage, error_type,
6};
7
8#[derive(Debug, NamedInternalEvent)]
9pub struct AwsKinesisStreamNoPartitionKeyError<'a> {
10    pub partition_key_field: &'a str,
11}
12
13impl InternalEvent for AwsKinesisStreamNoPartitionKeyError<'_> {
14    fn emit(self) {
15        let reason = "Partition key does not exist.";
16
17        error!(
18            message = reason,
19            partition_key_field = %self.partition_key_field,
20            error_type = error_type::PARSER_FAILED,
21            stage = error_stage::PROCESSING,
22        );
23
24        counter!(
25            "component_errors_total",
26            "error_type" => error_type::PARSER_FAILED,
27            "stage" => error_stage::PROCESSING,
28        )
29        .increment(1);
30
31        emit!(ComponentEventsDropped::<UNINTENTIONAL> { count: 1, reason });
32    }
33}