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: Fix bug duplicating parsed labels across multiple log lines #80292

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

svennergr
Copy link
Contributor

What is this feature?

With the addition of the categorization of labels we were mutating the "main" labels object and adding parsed labels per logline to that object. Instead we needed to copy the indexed labels for each log line. This PR adds a fix and test cases.

Special notes for your reviewer:

  1. Start Grafana and the Loki devenv

  2. Do a query like {place="luna"} |logfmt| line_format "label{{ .label }}={{ unixEpochMillis now }}" | logfmt

  3. Without the fix you should see log lines like this:
    image
    And when opening the details you will see duplicated labels, e.g. labelval1 and labelval3 eventhough the logline does only contain one of the labels.
    image

  4. With the fix you will only see the label from that one log line.

@svennergr svennergr merged commit e1aa8a9 into main Jan 11, 2024
30 checks passed
@svennergr svennergr deleted the svennergr/loki-backend-label-fix branch January 11, 2024 14:09
grafana-delivery-bot bot pushed a commit that referenced this pull request Jan 11, 2024
svennergr added a commit that referenced this pull request Jan 11, 2024
… lines (#80368)

Loki: Fix bug duplicating parsed labels across multiple log lines (#80292)

(cherry picked from commit e1aa8a9)

Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
@ifrost ifrost modified the milestones: 10.3.x, 10.4.x Jan 12, 2024
@svennergr svennergr added the backport v10.3.x Mark PR for automatic backport to v10.3.x label Jan 12, 2024
grafana-delivery-bot bot pushed a commit that referenced this pull request Jan 12, 2024
svennergr added a commit that referenced this pull request Jan 12, 2024
… lines (#80423)

Loki: Fix bug duplicating parsed labels across multiple log lines (#80292)

(cherry picked from commit e1aa8a9)

Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
s0lesurviv0r pushed a commit to s0lesurviv0r/grafana that referenced this pull request Feb 3, 2024
@aangelisc aangelisc modified the milestones: 10.4.x, 10.4.0 Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants