mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Addressed comments.
Signed-off-by: bwplotka <bwplotka@gmail.com>
This commit is contained in:
parent
fb0ced511c
commit
1f0cca5ba3
|
@ -783,7 +783,8 @@ func TestManagerCTZeroIngestion(t *testing.T) {
|
|||
// Disable regular scrapes.
|
||||
ScrapeInterval: model.Duration(9999 * time.Minute),
|
||||
ScrapeTimeout: model.Duration(5 * time.Second),
|
||||
// Ensure proto is chosen.
|
||||
// Ensure the proto is chosen. We need proto as it's the only protocol
|
||||
// with the CT parsing support.
|
||||
ScrapeProtocols: []config.ScrapeProtocol{config.PrometheusProto},
|
||||
},
|
||||
ScrapeConfigs: []*config.ScrapeConfig{{JobName: "test"}},
|
||||
|
|
|
@ -1574,7 +1574,7 @@ loop:
|
|||
if err != nil && !errors.Is(err, storage.ErrOutOfOrderCT) { // OOO is a common case, ignoring completely for now.
|
||||
// CT is an experimental feature. For now, we don't need to fail the
|
||||
// scrape on errors updating the created timestamp, log debug.
|
||||
level.Debug(sl.l).Log("msg", "Error when updating metadata in scrape loop", "series", string(met), "ct", *ctMs, "t", t, "err", err)
|
||||
level.Debug(sl.l).Log("msg", "Error when appending CT in scrape loop", "series", string(met), "ct", *ctMs, "t", t, "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6954,71 +6954,3 @@ Outer:
|
|||
|
||||
require.NoError(t, writerErr)
|
||||
}
|
||||
|
||||
func TestHeadAppender_AppendCTZeroSample(t *testing.T) {
|
||||
t.Fatalf("TODO")
|
||||
|
||||
// NOTE(bwplotka): We could reuse metadata test part as copied below:
|
||||
updateMetadata := func(t *testing.T, app storage.Appender, s labels.Labels, m metadata.Metadata) {
|
||||
_, err := app.UpdateMetadata(0, s, m)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
db := newTestDB(t)
|
||||
ctx := context.Background()
|
||||
|
||||
// Add some series so we can append metadata to them.
|
||||
app := db.Appender(ctx)
|
||||
s1 := labels.FromStrings("a", "b")
|
||||
s2 := labels.FromStrings("c", "d")
|
||||
s3 := labels.FromStrings("e", "f")
|
||||
s4 := labels.FromStrings("g", "h")
|
||||
|
||||
for _, s := range []labels.Labels{s1, s2, s3, s4} {
|
||||
_, err := app.Append(0, s, 0, 0)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
require.NoError(t, app.Commit())
|
||||
|
||||
// Add a first round of metadata to the first three series.
|
||||
// Re-take the Appender, as the previous Commit will have it closed.
|
||||
m1 := metadata.Metadata{Type: "gauge", Unit: "unit_1", Help: "help_1"}
|
||||
m2 := metadata.Metadata{Type: "gauge", Unit: "unit_2", Help: "help_2"}
|
||||
m3 := metadata.Metadata{Type: "gauge", Unit: "unit_3", Help: "help_3"}
|
||||
app = db.Appender(ctx)
|
||||
updateMetadata(t, app, s1, m1)
|
||||
updateMetadata(t, app, s2, m2)
|
||||
updateMetadata(t, app, s3, m3)
|
||||
require.NoError(t, app.Commit())
|
||||
|
||||
// Add a replicated metadata entry to the first series,
|
||||
// a completely new metadata entry for the fourth series,
|
||||
// and a changed metadata entry to the second series.
|
||||
m4 := metadata.Metadata{Type: "counter", Unit: "unit_4", Help: "help_4"}
|
||||
m5 := metadata.Metadata{Type: "counter", Unit: "unit_5", Help: "help_5"}
|
||||
app = db.Appender(ctx)
|
||||
updateMetadata(t, app, s1, m1)
|
||||
updateMetadata(t, app, s4, m4)
|
||||
updateMetadata(t, app, s2, m5)
|
||||
require.NoError(t, app.Commit())
|
||||
|
||||
// Read the WAL to see if the disk storage format is correct.
|
||||
recs := readTestWAL(t, path.Join(db.Dir(), "wal"))
|
||||
var gotMetadataBlocks [][]record.RefMetadata
|
||||
for _, rec := range recs {
|
||||
if mr, ok := rec.([]record.RefMetadata); ok {
|
||||
gotMetadataBlocks = append(gotMetadataBlocks, mr)
|
||||
}
|
||||
}
|
||||
|
||||
expectedMetadata := []record.RefMetadata{
|
||||
{Ref: 1, Type: record.GetMetricType(m1.Type), Unit: m1.Unit, Help: m1.Help},
|
||||
{Ref: 2, Type: record.GetMetricType(m2.Type), Unit: m2.Unit, Help: m2.Help},
|
||||
{Ref: 3, Type: record.GetMetricType(m3.Type), Unit: m3.Unit, Help: m3.Help},
|
||||
{Ref: 4, Type: record.GetMetricType(m4.Type), Unit: m4.Unit, Help: m4.Help},
|
||||
{Ref: 2, Type: record.GetMetricType(m5.Type), Unit: m5.Unit, Help: m5.Help},
|
||||
}
|
||||
require.Len(t, gotMetadataBlocks, 2)
|
||||
require.Equal(t, expectedMetadata[:3], gotMetadataBlocks[0])
|
||||
require.Equal(t, expectedMetadata[3:], gotMetadataBlocks[1])
|
||||
}
|
||||
|
|
|
@ -5642,8 +5642,8 @@ func TestPostingsCardinalityStats(t *testing.T) {
|
|||
require.Equal(t, statsForSomeLabel1, head.PostingsCardinalityStats("n", 1))
|
||||
}
|
||||
|
||||
func TestAppendCreatedTimestamps(t *testing.T) {
|
||||
testCases := []struct {
|
||||
func TestHeadAppender_AppendCTZeroSample(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
appendFunc func(*testing.T, storage.Appender)
|
||||
assertFunc func(*testing.T, storage.Querier)
|
||||
|
@ -5810,9 +5810,7 @@ func TestAppendCreatedTimestamps(t *testing.T) {
|
|||
require.Equal(t, chunkenc.ValNone, it.Next())
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
} {
|
||||
h, _ := newTestHead(t, DefaultBlockDuration, wlog.CompressionNone, false)
|
||||
defer func() {
|
||||
require.NoError(t, h.Close())
|
||||
|
|
Loading…
Reference in a new issue