Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(throttle transform)!: make events_discarded_total internal metric with key tag opt-in #19083

Merged
merged 10 commits into from
Nov 13, 2023
18 changes: 3 additions & 15 deletions src/internal_events/throttle.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use metrics::counter;
use vector_lib::internal_event::{ComponentEventsDropped, InternalEvent, INTENTIONAL};

#[derive(Debug)]
Expand All @@ -8,23 +7,12 @@ pub(crate) struct ThrottleEventDiscarded {

impl InternalEvent for ThrottleEventDiscarded {
fn emit(self) {
// TODO: Technically, the Component Specification states that the discarded events metric
// must _only_ have the `intentional` tag, in addition to the core tags like
Copy link
Member

@pront pront Nov 8, 2023

Choose a reason for hiding this comment

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

Deleting TODOs sparks joy.

// `component_kind`, etc, and nothing else.
//
// That doesn't give us the leeway to specify which throttle bucket the events are being
// discarded for... but including the key/bucket as a tag does seem useful and so I wonder
// if we should change the specification wording? Sort of a similar situation to the
// `error_code` tag for the component errors metric, where it's meant to be optional and
// only specified when relevant.
counter!(
"events_discarded_total", 1,
"key" => self.key,
); // Deprecated.
let message = "Rate limit exceeded.";
debug!(message, key = self.key, internal_log_rate_limit = true);

emit!(ComponentEventsDropped::<INTENTIONAL> {
count: 1,
reason: "Rate limit exceeded."
reason: message
})
}
}
Loading