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

blockscopy: log min and max time when skipping a block because of min duration filter #257

Merged
merged 1 commit into from
Aug 10, 2022

Conversation

pracucci
Copy link
Contributor

I plan to use the blockscopy tool shortly, and I would like to log the min and max time when skipping a block because of the min duration filter.

… duration filter

Signed-off-by: Marco Pracucci <marco@pracucci.com>
@pracucci pracucci requested a review from a team as a code owner August 10, 2022 07:06
@@ -226,7 +226,10 @@ func copyBlocks(ctx context.Context, cfg config, logger log.Logger, m *metrics)

blockDuration := time.Millisecond * time.Duration(meta.MaxTime-meta.MinTime)
if blockDuration < cfg.minBlockDuration {
level.Debug(logger).Log("msg", "skipping block, block duration is smaller than minimum duration", "blockDuration", blockDuration, "minimumDuration", cfg.minBlockDuration)
minTime := time.Unix(0, meta.MinTime*int64(time.Millisecond)).UTC()
Copy link
Member

Choose a reason for hiding this comment

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

In newer Go version (I believe 1.17 and later) there is time.UnixMilli() that can be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, but this project requirement is go 1.16. I would keep the upgrade separated.

@pracucci
Copy link
Contributor Author

Lint failure is unrelated. Will look into it separately.

@pracucci pracucci merged commit 57cffa0 into main Aug 10, 2022
@pracucci pracucci deleted the add-more-logs-to-blockscopy branch August 10, 2022 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants