Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: grafana/metrictank
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 54b7fb2ce2b5a0bb796b78de90132abf003625c9
Choose a base ref
..
head repository: grafana/metrictank
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fca78e1e655c0307102edd6eb67e505a567d4f2a
Choose a head ref
Showing with 11 additions and 19 deletions.
  1. +11 −19 mdata/aggmetric_test.go
30 changes: 11 additions & 19 deletions mdata/aggmetric_test.go
Original file line number Diff line number Diff line change
@@ -131,7 +131,7 @@ func testMetricPersistOptionalPrimary(t *testing.T, primary bool) {
mockCache.AddIfHotCb = func() { calledCb <- true }

chunkAddCount, chunkSpan := uint32(10), uint32(300)
rets := conf.MustParseRetentions("1s:1s:5min:5:0")
rets := conf.MustParseRetentions("1s:1s:5min:5:true")
agg := NewAggMetric(mockstore, &mockCache, test.GetAMKey(42), rets, 0, chunkSpan, nil, false, 0)

for ts := chunkSpan; ts <= chunkSpan*chunkAddCount; ts += chunkSpan {
@@ -245,7 +245,7 @@ func TestAggMetricWithReorderBuffer(t *testing.T) {
XFilesFactor: 0.5,
AggregationMethod: []conf.Method{conf.Avg},
}
ret := conf.MustParseRetentions("1s:1s:2min:5:0")
ret := conf.MustParseRetentions("1s:1s:2min:5:true")
c := NewChecker(t, NewAggMetric(mockstore, &cache.MockCache{}, test.GetAMKey(42), ret, 10, 1, &agg, false, 0))

// basic adds and verifies with test data
@@ -283,7 +283,7 @@ func TestAggMetricDropFirstChunk(t *testing.T) {
cluster.Init("default", "test", time.Now(), "http", 6060)
cluster.Manager.SetPrimary(true)
mockstore.Reset()
rets := conf.MustParseRetentions("1s:1s:10:5:0")
rets := conf.MustParseRetentions("1s:1s:10s:5:true")
m := NewAggMetric(mockstore, &cache.MockCache{}, test.GetAMKey(42), rets, 0, 1, nil, true, 0)
m.Add(10, 10)
m.Add(11, 11)
@@ -311,7 +311,7 @@ func TestAggMetricIngestFrom(t *testing.T) {
cluster.Manager.SetPrimary(true)
mockstore.Reset()
ingestFrom := int64(25)
ret := conf.MustParseRetentions("1s:1s:10s:5:0")
ret := conf.MustParseRetentions("1s:1s:10s:5:true")
m := NewAggMetric(mockstore, &cache.MockCache{}, test.GetAMKey(42), ret, 0, 1, nil, false, ingestFrom)
m.Add(10, 10)
m.Add(11, 11)
@@ -364,7 +364,8 @@ func TestGetAggregated(t *testing.T) {
cluster.Manager.SetPrimary(true)
mockstore.Reset()
aggSpan := uint32(5)
ret := conf.MustParseRetentions("1s:1s:10s:5:true,5s:1s:10s:5:0") // note second raw interval matches aggSpan
// note: TTL's are ignored
ret := conf.MustParseRetentions("1s:5s:10s:5,5s:10s:10s:5") // note second raw interval matches aggSpan
agg := conf.Aggregation{
Name: "Default",
Pattern: regexp.MustCompile(".*"),
@@ -409,7 +410,8 @@ func TestGetAggregatedIngestFrom(t *testing.T) {
mockstore.Reset()
aggSpan := uint32(5)
ingestFrom := int64(23)
ret := conf.MustParseRetentions("1s:1s:10s:5:true,5s:1s:10s:5:0") // note second raw interval matches aggSpan
// note: TTL's are ignored
ret := conf.MustParseRetentions("1s:5s:10s:5,5s:10s:10s:5") // note second raw interval matches aggSpan
agg := conf.Aggregation{
Name: "Default",
Pattern: regexp.MustCompile(".*"),
@@ -455,19 +457,9 @@ func BenchmarkAggMetricAdd(b *testing.B) {

cluster.Init("default", "test", time.Now(), "http", 6060)

retentions := conf.Retentions{
Orig: "10s:10000000000,30min:1:true",
Rets: []conf.Retention{{
SecondsPerPoint: 10,
NumberOfPoints: 10e9, // TTL
ChunkSpan: 1800, // 30 min. contains 180 points at 10s resolution
NumChunks: 1,
Ready: 0,
},
},
}

metric := NewAggMetric(mockstore, &cache.MockCache{}, test.GetAMKey(0), retentions, 0, 10, nil, false, 0)
// each chunk contains 180 points
rets := conf.MustParseRetentions("10s:1000000000s,30min:1")
metric := NewAggMetric(mockstore, &cache.MockCache{}, test.GetAMKey(0), rets, 0, 10, nil, false, 0)

max := uint32(b.N*10 + 1)
for t := uint32(1); t < max; t += 10 {