Skip to content

compact: Add resolution information to compaction and downsample logs #8353

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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

Naman-B-Parlecha
Copy link
Contributor

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Checks #8350

Adding resolution level (raw, 5m, 1h) to compact and downsample log messages to have more context

Verification

Signed-off-by: Naman-B-Parlecha <[email protected]>
@Naman-B-Parlecha Naman-B-Parlecha force-pushed the NamanParlecha/ResolutionLogging branch from 7363dc6 to 64f49dd Compare July 1, 2025 14:59
@Naman-B-Parlecha
Copy link
Contributor Author

@MichaHoffmann @GiedriusS
Currently the ResolutionToString function is not following DRY, as i couldnt find the correct place to add it.

Any specific file that i m missing to add it?

@julienlau
Copy link

julienlau commented Jul 1, 2025

It will be very helpful, thanks.
It's not exaclty in the scope of this PR given the title, but I think it would have been nice to have both : resolution and compact level in order to have the same information as in the bucket web UI.
-> meta.Compaction.Level

In addition I think it would be nice to have a log at debug level in https://github.com/thanos-io/thanos/blob/main/pkg/compact/downsample/downsample.go
to says that "Downsampling at resolution {} on time window {} is on going" for example.

@Naman-B-Parlecha
Copy link
Contributor Author

@julienlau refactoring

@Naman-B-Parlecha
Copy link
Contributor Author

Naman-B-Parlecha commented Jul 1, 2025

@yeya24

Rather than having to add resolution on all logs, would it be good if

log.With(g.logger, "group", fmt.Sprintf("%s@%v", resolutionLabel, lbls.String()), "groupKey", groupKey),
is refactored to having resolution = raw resolution = 5m resolution = 1hr or having it seperated in each log needed??

@yeya24
Copy link
Contributor

yeya24 commented Jul 1, 2025

@Naman-B-Parlecha We can have it just in the logger. I would just use 0s, 5m and 1h as resolution value, which is the standard duration string in Go.

@Naman-B-Parlecha
Copy link
Contributor Author

Yes works

@pull-request-size pull-request-size bot added size/S and removed size/M labels Jul 1, 2025
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Thanks. Just small nits

resolutionLabel := m.Thanos.ResolutionString()
group, err = NewGroup(
log.With(g.logger, "group", fmt.Sprintf("%s@%v", resolutionLabel, lbls.String()), "groupKey", groupKey),
log.With(g.logger, "group", fmt.Sprintf("%s@%v", metadata.ResolutionToString(resolutionVal), lbls.String()), "groupKey", groupKey),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we change the existing group field? If we want to be explicit I would add another logger field for resolution

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 was thinking if '0' stands for the resolution anyways in logs, we can just have it logs in better way?

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 have added a new field called resolution
but ya having this setup would be better as it already exists

@Naman-B-Parlecha
Copy link
Contributor Author

@yeya24 PTAL added Compact Level on @julienlau 's request.
I m not sure if that is something that we want or not

@Naman-B-Parlecha
Copy link
Contributor Author

@yeya24 PTAL :D

@Naman-B-Parlecha Naman-B-Parlecha force-pushed the NamanParlecha/ResolutionLogging branch from ac51770 to bfd729c Compare July 31, 2025 13:07
@pull-request-size pull-request-size bot added size/S and removed size/L labels Jul 31, 2025
@Naman-B-Parlecha
Copy link
Contributor Author

weird ci

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.

4 participants