vector/internal_events/
tag_cardinality_limit.rs

1use metrics::counter;
2use vector_lib::internal_event::{ComponentEventsDropped, INTENTIONAL, InternalEvent};
3
4pub struct TagCardinalityLimitRejectingEvent<'a> {
5    pub metric_name: &'a str,
6    pub tag_key: &'a str,
7    pub tag_value: &'a str,
8}
9
10impl InternalEvent for TagCardinalityLimitRejectingEvent<'_> {
11    fn emit(self) {
12        debug!(
13            message = "Event containing tag with new value after hitting configured 'value_limit'; discarding event.",
14            metric_name = self.metric_name,
15            tag_key = self.tag_key,
16            tag_value = self.tag_value,
17        );
18        counter!("tag_value_limit_exceeded_total").increment(1);
19
20        emit!(ComponentEventsDropped::<INTENTIONAL> {
21            count: 1,
22            reason: "Tag value limit exceeded."
23        })
24    }
25}
26
27pub struct TagCardinalityLimitRejectingTag<'a> {
28    pub metric_name: &'a str,
29    pub tag_key: &'a str,
30    pub tag_value: &'a str,
31}
32
33impl InternalEvent for TagCardinalityLimitRejectingTag<'_> {
34    fn emit(self) {
35        debug!(
36            message = "Rejecting tag after hitting configured 'value_limit'.",
37            metric_name = self.metric_name,
38            tag_key = self.tag_key,
39            tag_value = self.tag_value,
40        );
41        counter!("tag_value_limit_exceeded_total").increment(1);
42    }
43}
44
45pub struct TagCardinalityValueLimitReached<'a> {
46    pub key: &'a str,
47}
48
49impl InternalEvent for TagCardinalityValueLimitReached<'_> {
50    fn emit(self) {
51        debug!(
52            message = "Value_limit reached for key. New values for this key will be rejected.",
53            key = %self.key,
54        );
55        counter!("value_limit_reached_total").increment(1);
56    }
57}