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

Add filter parameter to rebound so lines can be deleted by the compactor #5879

Merged

Conversation

MichelHollands
Copy link
Contributor

@MichelHollands MichelHollands commented Apr 12, 2022

Add filter functionality to the delete functionality of the compactor. This is hidden behind the "filter-and-delete" value of the deletion_mode config setting.

A filter function is added to the intervals sent to the Rebound function. This removes lines that match the given DeleteRequest.

Checklist

  • Documentation added
  • Tests updated
  • Add an entry in the CHANGELOG.md about the changes.

Signed-off-by: Michel Hollands michel.hollands@grafana.com

@MichelHollands MichelHollands marked this pull request as ready for review April 12, 2022 11:38
@MichelHollands MichelHollands requested a review from a team as a code owner April 12, 2022 11:38
@MichelHollands MichelHollands marked this pull request as draft April 12, 2022 11:38
@MichelHollands MichelHollands marked this pull request as ready for review April 14, 2022 14:54
Copy link
Contributor

@MasslessParticle MasslessParticle left a comment

Choose a reason for hiding this comment

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

This looks awesome. I think there are just a couple of QOL and efficiency changes

@MichelHollands MichelHollands force-pushed the add_line_filtering_to_compactor branch from 89ce10e to 6fa08a4 Compare April 19, 2022 09:40
@MichelHollands MichelHollands changed the title Add filter parameter to rebound Add filter parameter to rebound so lines can be deleted by the compactor Apr 19, 2022
Copy link
Contributor

@MasslessParticle MasslessParticle left a comment

Choose a reason for hiding this comment

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

A nit about commented out code and a question about when to add the endpoints.

Otherwise LGTM

pkg/loki/modules.go Show resolved Hide resolved
Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
@MichelHollands MichelHollands force-pushed the add_line_filtering_to_compactor branch from 79636d6 to 48166fb Compare April 22, 2022 08:07
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.

Overall changes look good to me. Left a few minor suggestions.

Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
Signed-off-by: Michel Hollands <michel.hollands@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.

Sorry, I missed a case and found a small problem. Can you please take care of that as well? Please let me know if it is not clear or if I got something wrong.

Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
Signed-off-by: Michel Hollands <michel.hollands@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.

Just some very minor non-blocking nits.
Nice work, the changes look great!

tc.expectedResp.nonDeletedIntervals[idx].Interval.End,
nonDeletedIntervals[idx].Interval.End,
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Let us also add a nil vs non nil check when the delete request is with lblWithFilter?

@@ -0,0 +1,3 @@
package filter

type Func func(string) bool
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to either move this somewhere relevant like chunks or deletion package? It looks out of place to me.
The other option is to add more context to it if moving it is not possible due to circular dependency.

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