mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
cleanup: we don't need this yet
This commit is contained in:
parent
ae9c82946f
commit
7ecd729b37
|
@ -33,7 +33,6 @@ import (
|
|||
"github.com/go-kit/log/level"
|
||||
"github.com/oklog/ulid"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/common/model"
|
||||
"go.uber.org/atomic"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
|
@ -208,8 +207,6 @@ type Options struct {
|
|||
|
||||
// BlockChunkQuerierFunc is a function to return storage.ChunkQuerier from a BlockReader.
|
||||
BlockChunkQuerierFunc BlockChunkQuerierFunc
|
||||
|
||||
UTF8MigrationEscapingScheme model.EscapingScheme
|
||||
}
|
||||
|
||||
type NewCompactorFunc func(ctx context.Context, r prometheus.Registerer, l log.Logger, ranges []int64, pool chunkenc.Pool, opts *Options) (Compactor, error)
|
||||
|
|
|
@ -36,7 +36,6 @@ import (
|
|||
"github.com/oklog/ulid"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
prom_testutil "github.com/prometheus/client_golang/prometheus/testutil"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/atomic"
|
||||
"go.uber.org/goleak"
|
||||
|
@ -7634,100 +7633,3 @@ func TestGenerateCompactionDelay(t *testing.T) {
|
|||
assertDelay(db.generateCompactionDelay())
|
||||
}
|
||||
}
|
||||
|
||||
func TestUTF8(t *testing.T) {
|
||||
tsdbCfg := DefaultOptions()
|
||||
tsdbCfg.UTF8MigrationEscapingScheme = model.UnderscoreEscaping
|
||||
db, err := Open(t.TempDir(), nil, nil, tsdbCfg, nil)
|
||||
|
||||
require.NoError(t, err)
|
||||
t.Cleanup(func() {
|
||||
require.NoError(t, db.Close())
|
||||
})
|
||||
|
||||
app := db.Appender(context.Background())
|
||||
|
||||
l := labels.FromStrings("__name__", "with.dots")
|
||||
_, err = app.Append(0, l, 100, 1.0)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, app.Commit())
|
||||
|
||||
require.NoError(t, db.CompactHead(NewRangeHead(db.Head(), 0, 100)))
|
||||
|
||||
q, err := db.Querier(math.MinInt, math.MaxInt64)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, map[string][]chunks.Sample{
|
||||
l.String(): {sample{t: 100, f: 1.0}},
|
||||
}, query(t, q, labels.MustNewMatcher(labels.MatchEqual, "__name__", "with.dots")))
|
||||
|
||||
q, err = db.Querier(math.MinInt, math.MaxInt64)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, map[string][]chunks.Sample{}, query(t, q, labels.MustNewMatcher(labels.MatchEqual, "__name__", "with_dots")))
|
||||
|
||||
app = db.Appender(context.Background())
|
||||
l = labels.FromStrings("__name__", "with_dots")
|
||||
_, err = app.Append(0, l, 200, 2.0)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, app.Commit())
|
||||
|
||||
q, err = db.Querier(math.MinInt, math.MaxInt64)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, map[string][]chunks.Sample{
|
||||
labels.FromStrings("__name__", "with.dots").String(): {sample{t: 100, f: 1.0}, sample{t: 200, f: 2.0}},
|
||||
}, query(t, q, labels.MustNewMatcher(labels.MatchEqual, "__name__", "with.dots")))
|
||||
|
||||
q, err = db.Querier(math.MinInt, math.MaxInt64)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, map[string][]chunks.Sample{
|
||||
labels.FromStrings("__name__", "with_dots").String(): {sample{t: 200, f: 2.0}},
|
||||
}, query(t, q, labels.MustNewMatcher(labels.MatchEqual, "__name__", "with_dots")))
|
||||
|
||||
app = db.Appender(context.Background())
|
||||
_, err = app.Append(0, labels.FromStrings("__name__", "foob_r"), 300, 3.0)
|
||||
require.NoError(t, err)
|
||||
_, err = app.Append(0, labels.FromStrings("__name__", "foobár"), 400, 4.0)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, app.Commit())
|
||||
|
||||
q, err = db.Querier(math.MinInt, math.MaxInt64)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, map[string][]chunks.Sample{
|
||||
labels.FromStrings("__name__", "foobár").String(): {sample{t: 300, f: 3.0}, sample{t: 400, f: 4.0}},
|
||||
}, query(t, q, labels.MustNewMatcher(labels.MatchEqual, "__name__", "foobár")))
|
||||
|
||||
app = db.Appender(context.Background())
|
||||
_, err = app.Append(0, labels.FromStrings("__name__", "@bazbár", "job", "aaz"), 300, 4.0)
|
||||
require.NoError(t, err)
|
||||
_, err = app.Append(0, labels.FromStrings("__name__", "_bazb_r", "job", "baz"), 300, 3.0)
|
||||
require.NoError(t, err)
|
||||
_, err = app.Append(0, labels.FromStrings("__name__", "_bazb_r", "job", "aaz"), 300, 3.0)
|
||||
require.NoError(t, err)
|
||||
_, err = app.Append(0, labels.FromStrings("__name__", "_bazb_r", "job", "caz"), 300, 3.0)
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, app.Commit())
|
||||
|
||||
require.NoError(t, db.CompactHead(NewRangeHead(db.Head(), 0, 1000)))
|
||||
|
||||
for _ = range 10000 {
|
||||
q, err = db.Querier(math.MinInt, math.MaxInt64)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, map[string][]chunks.Sample{
|
||||
labels.FromStrings("__name__", "@bazbár", "job", "aaz").String(): {sample{t: 300, f: 3.0}},
|
||||
labels.FromStrings("__name__", "@bazbár", "job", "baz").String(): {sample{t: 300, f: 3.0}},
|
||||
labels.FromStrings("__name__", "@bazbár", "job", "caz").String(): {sample{t: 300, f: 3.0}},
|
||||
}, query(t, q, labels.MustNewMatcher(labels.MatchEqual, "__name__", "@bazbár")))
|
||||
}
|
||||
|
||||
// Test cases and notes:
|
||||
// - "OOO or repeated timestamps" with different labels that are the same after escaing. not sure if that can be a problem, maybe non-determinism?
|
||||
// - should we make it so compaction makes it so blocks don't have mixed?
|
||||
// - some labels are escaped but some not, then series are not the same
|
||||
// - what if labels are not explicitly mentioned in the query, but still queried? e.g.
|
||||
// foo.bar{"a.b"="c"}
|
||||
// foo_bar{"a_b"="b"}
|
||||
// and i query for __name__="a.b"
|
||||
// maybe only do it for metric name?
|
||||
|
||||
// Implementation questions:
|
||||
// - could the order of metrics mess things up? should i sort something?
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue