Skip to content

Filter for topk metrics #22608

Discussion options

You must be logged in to vote

I ended up implementing an efficient version of this in Lua. Here's the code in case anyone else finds it useful. I think the same algorithm would be worth implementing natively in Vector; I'd be happy to have a swing at that if there's interest!

[transforms.requestlog_metrics]
type   = "log_to_metric"
inputs = ["haproxy_requestlogs"]

# Count the number of requests by client IP
[[transforms.requestlog_metrics.metrics]]
type  = "counter"
field = "client_ip"
name  = "haproxy:requests_from_top_clients"
tags.ip = "{{client_ip}}"

# Reduce Vector's overhead by aggregating summing all of the metric events once every few seconds so
# that it can just store the sum and not a full event per reque…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pront
Comment options

Answer selected by pront
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
domain: metrics Anything related to Vector's metrics events
2 participants