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

Compact : parameter to control warnings for empty chunks #7405

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/compact/downsample/downsample.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func Downsample(

// Writes downsampled chunks right into the files, avoiding excess memory allocation.
// Flushes index and meta data after aggregations.
streamedBlockWriter, err := NewStreamedBlockWriter(blockDir, indexr, logger, newMeta)
streamedBlockWriter, err := NewStreamedBlockWriter(blockDir, indexr, logger, newMeta, true)
if err != nil {
return id, errors.Wrap(err, "get streamed block writer")
}
Expand Down
25 changes: 16 additions & 9 deletions pkg/compact/downsample/streamed_block_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ type streamedBlockWriter struct {
indexReader tsdb.IndexReader
closers []io.Closer

seriesRefs storage.SeriesRef // postings is a current posting position.
seriesRefs storage.SeriesRef // postings is a current posting position.
logEmptyChunks bool // New field to control logging of empty chunks
}

// NewStreamedBlockWriter returns streamedBlockWriter instance, it's not concurrency safe.
Expand All @@ -57,6 +58,7 @@ func NewStreamedBlockWriter(
indexReader tsdb.IndexReader,
logger log.Logger,
originMeta metadata.Meta,
logEmptyChunks bool,
) (w *streamedBlockWriter, err error) {
closers := make([]io.Closer, 0, 2)

Expand Down Expand Up @@ -95,13 +97,14 @@ func NewStreamedBlockWriter(
}

return &streamedBlockWriter{
logger: logger,
blockDir: blockDir,
indexReader: indexReader,
indexWriter: indexWriter,
chunkWriter: chunkWriter,
meta: originMeta,
closers: closers,
logger: logger,
blockDir: blockDir,
indexReader: indexReader,
indexWriter: indexWriter,
chunkWriter: chunkWriter,
meta: originMeta,
closers: closers,
logEmptyChunks: logEmptyChunks,
}, nil
}

Expand All @@ -113,7 +116,11 @@ func (w *streamedBlockWriter) WriteSeries(lset labels.Labels, chunks []chunks.Me
}

if len(chunks) == 0 {
level.Warn(w.logger).Log("msg", "empty chunks happened, skip series", "series", strings.ReplaceAll(lset.String(), "\"", "'"))
if w.logEmptyChunks {
level.Warn(w.logger).Log("msg", "empty chunks happened, skip series", "series", strings.ReplaceAll(lset.String(), "\"", "'"))
Copy link
Member

Choose a reason for hiding this comment

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

I don't get the purpose of this parameter if it is always true. Why not just convert this line to level.Debug?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is there any option to configure it through yaml ? or any config struct which can implement this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the only way i found was through the NewStreamedBlockWriter function which is called in downsample.go

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for jus tusing level.Debug

Copy link
Member

Choose a reason for hiding this comment

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

There's no way to control and it doesn't make sense to add a tunable parameter for this kind of minute thing. We already have way too many parameters and it is confusing for our users.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

or other options to fix this issue is by aggregating the warnings ? wdyt .. i think directly changing the level to debug is not an good option

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's no way to control and it doesn't make sense to add a tunable parameter for this kind of minute thing. We already have way too many parameters and it is confusing for our users.

yaa ! that's a point too .. so is there any need to change the level to debug?

} else {
level.Debug(w.logger).Log("msg", "empty chunks happened, skip series", "series", strings.ReplaceAll(lset.String(), "\"", "'"))
}
return nil
}

Expand Down
Loading