grafana / loki

Like Prometheus, but for logs.
https://grafana.com/loki
GNU Affero General Public License v3.0
23.48k stars 3.4k forks source link

Loki Label filter improve performance #6082

Open cyriltovena opened 2 years ago

cyriltovena commented 2 years ago

In Loki when doing {app="foo"} | json | duration > 2 we actually first extract all labels, then filter. It would be faster that as we extract labels we apply filtering before pushing extracted data as label.

This isn't going to be easy because:

This could allow to avoid allocations, as we can test on []byte instead of string.

jeschkies commented 2 years ago

Does this relate to ParserLabelHints().RequiredLabels()?

cyriltovena commented 2 years ago

Does this relate to ParserLabelHints().RequiredLabels()?

In some ways. but that's not the whole story.