1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use metrics::counter;
use vector_lib::internal_event::InternalEvent;

pub struct AwsBytesSent {
    pub byte_size: usize,
    pub region: Option<aws_types::region::Region>,
}

impl InternalEvent for AwsBytesSent {
    fn emit(self) {
        let region = self
            .region
            .as_ref()
            .map_or(String::new(), |r| r.as_ref().to_string());
        trace!(
            message = "Bytes sent.",
            protocol = "https",
            byte_size = %self.byte_size,
            region = ?self.region,
        );
        counter!(
            "component_sent_bytes_total",
            "protocol" => "https",
            "region" => region,
        )
        .increment(self.byte_size as u64);
    }
}