|
|
@ -14,9 +14,10 @@ |
|
|
|
package tsdb |
|
|
|
package tsdb |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
prom_testutil "github.com/prometheus/client_golang/prometheus/testutil" |
|
|
|
|
|
|
|
"testing" |
|
|
|
"testing" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
prom_testutil "github.com/prometheus/client_golang/prometheus/testutil" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/prometheus/prometheus/tsdb/chunkenc" |
|
|
|
"github.com/prometheus/prometheus/tsdb/chunkenc" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require" |
|
|
|
"github.com/stretchr/testify/require" |
|
|
@ -55,7 +56,7 @@ var sampleTypeScenarios = map[string]sampleTypeScenario{ |
|
|
|
return sample{t: ts, f: float64(value)} |
|
|
|
return sample{t: ts, f: float64(value)} |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
//intHistogram: {
|
|
|
|
// intHistogram: {
|
|
|
|
// sampleType: sampleMetricTypeHistogram,
|
|
|
|
// sampleType: sampleMetricTypeHistogram,
|
|
|
|
// appendFunc: func(appender storage.Appender, lbls labels.Labels, ts, value int64) (storage.SeriesRef, sample, error) {
|
|
|
|
// appendFunc: func(appender storage.Appender, lbls labels.Labels, ts, value int64) (storage.SeriesRef, sample, error) {
|
|
|
|
// s := sample{t: ts, h: tsdbutil.GenerateTestHistogram(int(value))}
|
|
|
|
// s := sample{t: ts, h: tsdbutil.GenerateTestHistogram(int(value))}
|
|
|
@ -65,8 +66,8 @@ var sampleTypeScenarios = map[string]sampleTypeScenario{ |
|
|
|
// sampleFunc: func(ts, value int64) sample {
|
|
|
|
// sampleFunc: func(ts, value int64) sample {
|
|
|
|
// return sample{t: ts, h: tsdbutil.GenerateTestHistogram(int(value))}
|
|
|
|
// return sample{t: ts, h: tsdbutil.GenerateTestHistogram(int(value))}
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
//},
|
|
|
|
// },
|
|
|
|
//floatHistogram: {
|
|
|
|
// floatHistogram: {
|
|
|
|
// sampleType: sampleMetricTypeHistogram,
|
|
|
|
// sampleType: sampleMetricTypeHistogram,
|
|
|
|
// appendFunc: func(appender storage.Appender, lbls labels.Labels, ts, value int64) (storage.SeriesRef, sample, error) {
|
|
|
|
// appendFunc: func(appender storage.Appender, lbls labels.Labels, ts, value int64) (storage.SeriesRef, sample, error) {
|
|
|
|
// s := sample{t: ts, fh: tsdbutil.GenerateTestFloatHistogram(int(value))}
|
|
|
|
// s := sample{t: ts, fh: tsdbutil.GenerateTestFloatHistogram(int(value))}
|
|
|
@ -76,8 +77,8 @@ var sampleTypeScenarios = map[string]sampleTypeScenario{ |
|
|
|
// sampleFunc: func(ts, value int64) sample {
|
|
|
|
// sampleFunc: func(ts, value int64) sample {
|
|
|
|
// return sample{t: ts, fh: tsdbutil.GenerateTestFloatHistogram(int(value))}
|
|
|
|
// return sample{t: ts, fh: tsdbutil.GenerateTestFloatHistogram(int(value))}
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
//},
|
|
|
|
// },
|
|
|
|
//gaugeIntHistogram: {
|
|
|
|
// gaugeIntHistogram: {
|
|
|
|
// sampleType: sampleMetricTypeHistogram,
|
|
|
|
// sampleType: sampleMetricTypeHistogram,
|
|
|
|
// appendFunc: func(appender storage.Appender, lbls labels.Labels, ts, value int64) (storage.SeriesRef, sample, error) {
|
|
|
|
// appendFunc: func(appender storage.Appender, lbls labels.Labels, ts, value int64) (storage.SeriesRef, sample, error) {
|
|
|
|
// s := sample{t: ts, h: tsdbutil.GenerateTestGaugeHistogram(int(value))}
|
|
|
|
// s := sample{t: ts, h: tsdbutil.GenerateTestGaugeHistogram(int(value))}
|
|
|
@ -87,8 +88,8 @@ var sampleTypeScenarios = map[string]sampleTypeScenario{ |
|
|
|
// sampleFunc: func(ts, value int64) sample {
|
|
|
|
// sampleFunc: func(ts, value int64) sample {
|
|
|
|
// return sample{t: ts, h: tsdbutil.GenerateTestGaugeHistogram(int(value))}
|
|
|
|
// return sample{t: ts, h: tsdbutil.GenerateTestGaugeHistogram(int(value))}
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
//},
|
|
|
|
// },
|
|
|
|
//gaugeFloatHistogram: {
|
|
|
|
// gaugeFloatHistogram: {
|
|
|
|
// sampleType: sampleMetricTypeHistogram,
|
|
|
|
// sampleType: sampleMetricTypeHistogram,
|
|
|
|
// appendFunc: func(appender storage.Appender, lbls labels.Labels, ts, value int64) (storage.SeriesRef, sample, error) {
|
|
|
|
// appendFunc: func(appender storage.Appender, lbls labels.Labels, ts, value int64) (storage.SeriesRef, sample, error) {
|
|
|
|
// s := sample{t: ts, fh: tsdbutil.GenerateTestGaugeFloatHistogram(int(value))}
|
|
|
|
// s := sample{t: ts, fh: tsdbutil.GenerateTestGaugeFloatHistogram(int(value))}
|
|
|
@ -98,7 +99,7 @@ var sampleTypeScenarios = map[string]sampleTypeScenario{ |
|
|
|
// sampleFunc: func(ts, value int64) sample {
|
|
|
|
// sampleFunc: func(ts, value int64) sample {
|
|
|
|
// return sample{t: ts, fh: tsdbutil.GenerateTestGaugeFloatHistogram(int(value))}
|
|
|
|
// return sample{t: ts, fh: tsdbutil.GenerateTestGaugeFloatHistogram(int(value))}
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
//},
|
|
|
|
// },
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// requireEqualSamples checks that the actual series are equal to the expected ones. It ignores the counter reset hints for histograms.
|
|
|
|
// requireEqualSamples checks that the actual series are equal to the expected ones. It ignores the counter reset hints for histograms.
|
|
|
|