Metrics generator regex policy filter compiles on each attribute value match #3015
Labels
good first issue
Good for newcomers
help wanted
Extra attention is needed
keepalive
Label to exempt Issues / PRs from stale workflow
type/bug
Something isn't working
type/performance
Is your feature request related to a problem? Please describe.
Metrics generator has a filter policy with match type
regex
. Generator is iterating over attributes and performs regex compilation every time it tries to match value. This results in high memory consumption.https://github.com/grafana/tempo/blob/main/pkg/spanfilter/spanfilter.go#L85
Describe the solution you'd like
Compile regex once and perform match with already compiled regex.
Describe alternatives you've considered
Used
strict
match type on the policy, which works well and memory consumption is stable. Although I have a use-case where I would like to useregex
, but can't afford the memory consumption.Additional context
Using
strict
type used to consume just over 1.2GB of memory. Changing to config presented below resulted in ~60GB of memory being used.The text was updated successfully, but these errors were encountered: