Skip to content
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

Loki: When processing logs during tailing, don't reuse the query pipeline #6152

Merged
merged 2 commits into from
May 12, 2022

Conversation

slim-bean
Copy link
Collaborator

What this PR does / why we need it:

The query pipeline will build a label cache to improve performance when processing queries, the normal use of a pipeline for queries is ephemeral so the cache is cleared when the pipeline is discarded.

When tailing, however, the pipeline was long lived and reused which lead to an unbounded growth of cached labels for certain tail queries.

This PR creates a new pipeline for every processed push into Loki vs reusing.

There is probably future potential for a mechanism to clear the cache but not sure it's worth the additional effort vs creating and disposing of pipelines.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Checklist

  • Documentation added
  • Tests updated
  • Is this an important fix or new feature? Add an entry in the CHANGELOG.md.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/upgrading/_index.md

…ded label cache

Signed-off-by: Edward Welch <edward.welch@grafana.com>
@slim-bean slim-bean requested a review from a team as a code owner May 12, 2022 11:07
Signed-off-by: Edward Welch <edward.welch@grafana.com>
Copy link
Contributor

@sandeepsukhani sandeepsukhani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@slim-bean slim-bean merged commit 4bf1648 into main May 12, 2022
@slim-bean slim-bean deleted the newpipeline branch May 12, 2022 11:12
grafanabot pushed a commit that referenced this pull request May 12, 2022
…line (#6152)

* when tailing, don't reuse the query pipeline because it has an unbounded label cache

Signed-off-by: Edward Welch <edward.welch@grafana.com>

* update changelog

Signed-off-by: Edward Welch <edward.welch@grafana.com>
(cherry picked from commit 4bf1648)
slim-bean added a commit that referenced this pull request May 12, 2022
…line (#6152) (#6153)

* when tailing, don't reuse the query pipeline because it has an unbounded label cache

Signed-off-by: Edward Welch <edward.welch@grafana.com>

* update changelog

Signed-off-by: Edward Welch <edward.welch@grafana.com>
(cherry picked from commit 4bf1648)

Co-authored-by: Ed Welch <edward.welch@grafana.com>
@grafanabot
Copy link
Collaborator

./tools/diff_coverage.sh ../loki-main/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki

Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell.

+           ingester	0%
+        distributor	0%
+            querier	0%
+ querier/queryrange	0%
+               iter	0%
+            storage	0%
+           chunkenc	0%
+              logql	0%
+               loki	0%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants