mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-10 07:34:04 -08:00
Merge pull request #8496 from codesome/fix-8476
Increase block writer size for backfilling
This commit is contained in:
commit
f1208bb7ea
|
@ -93,7 +93,13 @@ func createBlocks(input []byte, mint, maxt int64, maxSamplesInAppender int, outp
|
|||
nextSampleTs = math.MaxInt64
|
||||
|
||||
err := func() error {
|
||||
w, err := tsdb.NewBlockWriter(log.NewNopLogger(), outputDir, blockDuration)
|
||||
// To prevent races with compaction, a block writer only allows appending samples
|
||||
// that are at most half a block size older than the most recent sample appended so far.
|
||||
// However, in the way we use the block writer here, compaction doesn't happen, while we
|
||||
// also need to append samples throughout the whole block range. To allow that, we
|
||||
// pretend that the block is twice as large here, but only really add sample in the
|
||||
// original interval later.
|
||||
w, err := tsdb.NewBlockWriter(log.NewNopLogger(), outputDir, 2*blockDuration)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "block writer")
|
||||
}
|
||||
|
|
|
@ -365,6 +365,51 @@ http_requests_total{code="400"} 1 1565166113.989
|
|||
},
|
||||
},
|
||||
},
|
||||
{ // For https://github.com/prometheus/prometheus/issues/8476.
|
||||
ToParse: `# HELP http_requests_total The total number of HTTP requests.
|
||||
# TYPE http_requests_total counter
|
||||
http_requests_total{code="200"} 1021 0
|
||||
http_requests_total{code="200"} 1022 7199
|
||||
http_requests_total{code="400"} 1023 0
|
||||
http_requests_total{code="400"} 1024 7199
|
||||
# EOF
|
||||
`,
|
||||
IsOk: true,
|
||||
Description: "One series spanning 2h in same block should not cause problems to other series.",
|
||||
MaxSamplesInAppender: 1,
|
||||
Expected: struct {
|
||||
MinTime int64
|
||||
MaxTime int64
|
||||
NumBlocks int
|
||||
Samples []backfillSample
|
||||
}{
|
||||
MinTime: 0,
|
||||
MaxTime: 7199000,
|
||||
NumBlocks: 1,
|
||||
Samples: []backfillSample{
|
||||
{
|
||||
Timestamp: 0,
|
||||
Value: 1021,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "200"),
|
||||
},
|
||||
{
|
||||
Timestamp: 7199000,
|
||||
Value: 1022,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "200"),
|
||||
},
|
||||
{
|
||||
Timestamp: 0,
|
||||
Value: 1023,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "400"),
|
||||
},
|
||||
{
|
||||
Timestamp: 7199000,
|
||||
Value: 1024,
|
||||
Labels: labels.FromStrings("__name__", "http_requests_total", "code", "400"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ToParse: `no_help_no_type{foo="bar"} 42 6900
|
||||
# EOF
|
||||
|
|
Loading…
Reference in a new issue