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

chore: Fix regression in bloom gateway that caused nothing to be filtered #14807

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

chaudum
Copy link
Contributor

@chaudum chaudum commented Nov 7, 2024

What this PR does / why we need it:

Pull request #14661 added the series labels to the FilterChunkRefs request in order to be able to filter out full series that do not contain the filter key when using bloom filters.

However, this change incorrectly assumed that Chunk.Metric from the GetChunks() call contains the labels of the stream. This information is only populated once the chunk is fetched, though. Therefore the list of labels was empty, and no chunk refs were filtered.

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR

Copy link
Contributor

@salvacorts salvacorts left a comment

Choose a reason for hiding this comment

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

LGTM

result = &logproto.GetChunkRefResponse{
Refs: make([]*logproto.ChunkRef, 0, len(chunks)),
}
for _, cs := range chunks {
for i := range cs {
result.Refs = append(result.Refs, &cs[i].ChunkRef)
if _, ok := series[cs[i].Fingerprint]; !ok {
series[cs[i].Fingerprint] = cs[i].Metric
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: What about adding a comment in the chunk struct about fields not being populated until fetched?

Copy link
Member

Choose a reason for hiding this comment

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

^ I would also like this, it seems inevitable that someone is going to run into this again since it's not very obvious.

Pull request #14661 added the series labels to the FilterChunkRefs
request in order to be able to filter out full series that do not
contain the filter key when using bloom filters.

However, this chage incorrectly assumed that `Chunk.Metric` from the
`GetChunks()` call contains the labels of the stream. This information
is only populated once the chunk is fetched, though. Therefore the list
of labels was empty, and no chunk refs were filtered.

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
@chaudum chaudum force-pushed the chaudum/fix-get-series branch from 17a4ca5 to 5a0c481 Compare November 7, 2024 12:41
@chaudum chaudum marked this pull request as ready for review November 7, 2024 12:41
@chaudum chaudum requested a review from a team as a code owner November 7, 2024 12:41
@chaudum chaudum added type/bug Somehing is not working as expected backport k227 labels Nov 7, 2024
@loki-gh-app
Copy link
Contributor

loki-gh-app bot commented Nov 7, 2024

This PR must be merged before a backport PR will be created.

1 similar comment
@loki-gh-app
Copy link
Contributor

loki-gh-app bot commented Nov 7, 2024

This PR must be merged before a backport PR will be created.

@chaudum chaudum merged commit 3b20cb0 into main Nov 7, 2024
63 checks passed
@chaudum chaudum deleted the chaudum/fix-get-series branch November 7, 2024 12:52
loki-gh-app bot pushed a commit that referenced this pull request Nov 7, 2024
…ered (#14807)

Pull request #14661 added the series labels to the `FilterChunkRefs` request in order to be able to filter out full series that do not contain the filter key when using bloom filters.

However, this change incorrectly assumed that `Chunk.Metric` from the `GetChunks()` call contains the labels of the stream. This information is only populated once the chunk is fetched, though. Therefore the list of labels was empty, and no chunk refs were filtered.

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
(cherry picked from commit 3b20cb0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport k227 size/S type/bug Somehing is not working as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants