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

compaction: Separate metrics for tracking retention and compaction #11263

Merged
merged 5 commits into from
Nov 20, 2023

Conversation

sandeepsukhani
Copy link
Contributor

What this PR does / why we need it:
In PR #9884, we separated the retention loop from compaction to avoid blocking compaction for too long due to some intensive delete requests. Currently, we track retention and compaction using the same metrics. This PR adds separate metrics for monitoring retention operation. I have also updated the Retention dashboard to use the new metrics.

@sandeepsukhani sandeepsukhani requested a review from a team as a code owner November 20, 2023 10:47
Copy link
Contributor

Trivy scan found the following vulnerabilities:

@@ -614,6 +616,8 @@ func (c *Compactor) CompactTable(ctx context.Context, tableName string, applyRet
// wait for lock to be released since we can't mark delete requests as processed without checking all the tables
select {
case <-lockWaiterChan:
// refresh index list cache since the compaction would have changed the index files in the object store
sc.indexStorageClient.RefreshIndexTableNamesCache(ctx)
Copy link
Contributor

Choose a reason for hiding this comment

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

we refresh the table here, is this still required when compacting a table?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ahh, right, this one is not required. Will remove it.

@@ -126,6 +126,8 @@ func (cfg *Config) Validate() error {

if cfg.ApplyRetentionInterval == 0 {
cfg.ApplyRetentionInterval = cfg.CompactionInterval
// add some jitter to avoid running retention and compaction at same time
cfg.ApplyRetentionInterval += cfg.CompactionInterval / 2
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should we instead add a jitter to when the first retention kicks in?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to add jitter only if both retention and compaction have the same frequency. I will update the code a bit.

@sandeepsukhani sandeepsukhani merged commit 6a62b8c into main Nov 20, 2023
7 checks passed
@sandeepsukhani sandeepsukhani deleted the retention-metrics branch November 20, 2023 12:52
jeschkies pushed a commit that referenced this pull request Nov 21, 2023
…11263)

**What this PR does / why we need it**:
In PR #9884, we separated the retention loop from compaction to avoid
blocking compaction for too long due to some intensive delete requests.
Currently, we track retention and compaction using the same metrics.
This PR adds separate metrics for monitoring retention operation. I have
also updated the Retention dashboard to use the new metrics.
JoaoBraveCoding added a commit to JoaoBraveCoding/loki that referenced this pull request Nov 28, 2023
With this update we get:
- Reworked retention dashboards done in
  grafana#11263 as a follow-up to grafana#9884
- New write dashboards for structured metadata done in grafana#11087
rhnasc pushed a commit to inloco/loki that referenced this pull request Apr 12, 2024
…rafana#11263)

**What this PR does / why we need it**:
In PR grafana#9884, we separated the retention loop from compaction to avoid
blocking compaction for too long due to some intensive delete requests.
Currently, we track retention and compaction using the same metrics.
This PR adds separate metrics for monitoring retention operation. I have
also updated the Retention dashboard to use the new metrics.
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.

None yet

2 participants