Open fpytloun opened 2 years ago
Responded in Discord as well - but we may be passing just the name of the key, rather than the contained value from that key (which is what should be bucketed).
Responded in Discord as well - but we may be passing just the name of the key, rather than the contained value from that key (which is what should be bucketed).
Yeah, that looks like the case. I'll open a separate bug for that since I think this feature request to be able to route dropped events is also a good one.
Actually @fpytloun, the key_field
is a template configuration option in Vector. I think you want need to use the template syntax so: key_field = "{{_throttle_key}}"
. This is a bit confusing because of the name of the configuration option. I'm struggling to come up with a good name for it at the moment though. thottle_key
is a bit better, but still not great.
@jszwedko checking related code: https://github.com/vectordotdev/vector/blob/master/src/transforms/throttle.rs#L153
and it indeed seems that key_field
should be template to work as expected, otherwise key would be static value and basically useless (it would just rate-limit everything) 🤯
So it's definately wrongly named and wrongly documented (key
or throttle_key
would make at least some sense but key_field
gives impression that it should be just field name).
This PR was opened to address the documentation: https://github.com/vectordotdev/vector/pull/13561
đź‘Ť I think I like throttle_key
as an improvement at least.
@fpytloun just a note that a workaround came up today that would involve using log_to_metric
both in-front of, and behind, the throttle transform to generate two metrics that could be subtracted to get the metrics about the throttled events.
A note for the community
Use Cases
I would like to create metric with extra labels from throttled events fields (eg.
tag
orservice
) to be able to see what was throttled.There might be more use-cases, eg. send throttled events to some other backend for further processing.
Attempted Solutions
Using
vector_events_discarded_total
metric cannot give any detailed info:There's a
key
label as documentation states that seemed to be used for this:But it has static value (I think it should be extracted, possibly a bug?):
key="_throttle_key"
Related config:
Proposal
Might be done by routing throttled events away and attach additional log_to_metric transform on that events. Basically same feature as dropped option for remap transform.
References
No response
Version
No response