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

LogContext: Fix a bug where multiple logs with similar nanosecond timestamps were loaded too often #71319

Merged
merged 1 commit into from Jul 11, 2023

Conversation

svennergr
Copy link
Contributor

What is this feature?
In some occasions and due to the fact that requests in Grafana are based on miliseconds, Loki will return the same log liens as already present in the LogContext component. For such cases it is not enough to only compare the ref-logline but we would need to filter out all logs that are already present.

Special notes for your reviewer:

  1. I will remove the data.js change after review, but that should help you create the edge case.
  2. Query logs with {place="moon",time="ns"} | line_format "{{__timestamp__}}"

Without the fix:

Screen.Recording.2023-07-11.at.07.41.29.mov

With the fix:

Screen.Recording.2023-07-11.at.07.42.38.mov

Copy link
Contributor

@gabor gabor left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@svennergr svennergr merged commit 212239a into main Jul 11, 2023
30 checks passed
@svennergr svennergr deleted the svennergr/fix-log-context-ns branch July 11, 2023 08:00
@grafana-delivery-bot
Copy link
Contributor

The backport to v10.0.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-71319-to-v10.0.x origin/v10.0.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 212239aedbabacdca2309feedbda2dc72d88ddb5
# When the conflicts are resolved, stage and commit the changes
git add . && git cherry-pick --continue

If you have the GitHub CLI installed:

# Create the PR body template
gh pr view 71319 --json body --template 'Backport 212239aedbabacdca2309feedbda2dc72d88ddb5 from #71319{{ "\n\n---\n\n" }}{{ index . "body" }}' > .pr-body.txt
# Push the branch to GitHub and a PR
gh pr create --title "[v10.0.x] LogContext: Fix a bug where multiple logs with similar nanosecond timestamps were loaded too often" --body-file .pr-body.txt --label "type/bug" --label "area/frontend" --label "add to changelog" --label "area/logs" --label "backport" --base v10.0.x --milestone 10.0.x --web

Or, if you don't have the GitHub CLI installed (we recommend you install it!):

# If you don't have the GitHub CLI installed: Push the branch to GitHub and manually create a PR:
git push --set-upstream origin backport-71319-to-v10.0.x
# Remove the local backport branch
git switch main
git branch -D backport-71319-to-v10.0.x

Unless you've used the GitHub CLI above, now create a pull request where the base branch is v10.0.x and the compare/head branch is backport-71319-to-v10.0.x.

@grafana-delivery-bot grafana-delivery-bot bot added the backport-failed Failed to generate backport PR. Please resolve conflicts and create one manually. label Jul 11, 2023
@svennergr svennergr added no-backport Skip backport of PR and removed backport-failed Failed to generate backport PR. Please resolve conflicts and create one manually. backport v10.0.x labels Jul 11, 2023
svennergr added a commit that referenced this pull request Jul 12, 2023
…estamps were loaded too often (#71319)

fix bug with multiple ns logs
polibb pushed a commit that referenced this pull request Jul 14, 2023
…estamps were loaded too often (#71319)

fix bug with multiple ns logs
@zerok zerok modified the milestones: 10.0.x, 10.0.3, 10.1.x Jul 18, 2023
@ricky-undeadcoders ricky-undeadcoders modified the milestones: 10.1.x, 10.1.0 Aug 1, 2023
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

5 participants