-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(tag_cardinality_limit transform): enable per metric limits for tag_cardinality_limit
#22077
base: master
Are you sure you want to change the base?
feat(tag_cardinality_limit transform): enable per metric limits for tag_cardinality_limit
#22077
Conversation
…tag_cardinality_limit` This adds the ability to add per metric limits in `tag_cardinality_limit` transform, besides the global configuration that applies to all metrics. It supports matching metrics by name and optionally by namespace too. Closes: vectordotdev#15743
I think this could also support #21112 with minor modifications, but I didn't go ahead with it right away, because I didn't want to introduce yet another level of nesting in the |
Sorry if I'm being a bit thick here, but I didn't see any user-visible documentation or discussion in the patch set - did I miss it? |
Ah, we need to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @esensar, thank you for this contribution. The new tests are much appreciated. Left a few comments but nothing major.
/// Tag cardinality limits configuration per metric name. | ||
#[configurable(derived)] | ||
#[serde(default)] | ||
pub per_metric_limits: Vec<PerMetricConfig>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: It's better to use a map type here from name
to PerMetricConfig
.
value: &TagValueSet, | ||
) -> bool { | ||
let config = self.get_config_for_metric(metric_key).clone(); | ||
info!("try_accept_tag using config: {:?}", config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove info!
s here and below. If you would like to keep them we can make them trace!
s.
fn tag_limit_exceeded(&self, key: &str, value: &TagValueSet) -> bool { | ||
fn tag_limit_exceeded( | ||
&self, | ||
metric_key: &Option<MetricId>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
metric_key: &Option<MetricId>, | |
metric_key: Option<&MetricId>, |
Summary
This adds the ability to add per metric limits in
tag_cardinality_limit
transform, besides the global configuration that applies to all metrics. It supports matching metrics by name and optionally by namespace too.Change Type
Is this a breaking change?
How did you test this PR?
Added new tests to
transforms::tag_cardinality_limits::tests
and also tested manually with the following configuration:Confirmed that behavior is different for metricA and metricB (metricA didn't get its tags removed due to higher limit).
Does this PR include user facing changes?
Checklist
Cargo.lock
), pleaserun
dd-rust-license-tool write
to regenerate the license inventory and commit the changes (if any). More details here.References
tag_cardinality_limit
transform #15743