Documentation ¶
Index ¶
- Variables
- func BuildCustomIterator(dps [][]Datapoint, testTags map[string]string, ...) (encoding.SeriesIterator, models.Bounds, error)
- func BuildTestSeriesIterator(id string) (encoding.SeriesIterator, error)
- func CompareListsInOrder(t *testing.T, meta, exMeta []block.SeriesMeta, index, exIndex [][]int)
- func CompareValues(t *testing.T, meta, exMeta []block.SeriesMeta, vals, exVals [][]float64)
- func CompareValuesInOrder(t *testing.T, meta, exMeta []block.SeriesMeta, vals, exVals [][]float64)
- func EqualsWithNans(t *testing.T, expected interface{}, actual interface{})
- func EqualsWithNansWithDelta(t *testing.T, expected interface{}, actual interface{}, delta float64)
- func GeneratePromReadBody(t *testing.T) io.Reader
- func GeneratePromReadRequest() *prompb.ReadRequest
- func GenerateValuesAndBounds(vals [][]float64, b *models.Bounds) ([][]float64, models.Bounds)
- func MakeMockPoolWrapper() *pools.PoolWrapper
- func MustMakeMeta(bounds models.Bounds, tags ...string) block.Metadata
- func MustMakeSeriesMeta(tags ...string) block.SeriesMeta
- func NewBlockFromValues(bounds models.Bounds, seriesValues [][]float64) block.Block
- func NewBlockFromValuesWithMetaAndSeriesMeta(meta block.Metadata, seriesMeta []block.SeriesMeta, seriesValues [][]float64) block.Block
- func NewBlockFromValuesWithSeriesMeta(bounds models.Bounds, seriesMeta []block.SeriesMeta, seriesValues [][]float64) block.Block
- func NewSeriesMeta(tagPrefix string, count int) []block.SeriesMeta
- func NewSeriesMetaWithoutName(tagPrefix string, count int) []block.SeriesMeta
- func NewSlowStorage(storage storage.Storage, delay time.Duration) storage.Storage
- func NewUnconsolidatedBlockFromDatapointsWithMeta(bounds models.Bounds, seriesMetas []block.SeriesMeta, ...) block.Block
- func NoopMod(v []float64) []float64
- func StringTagsSliceToTagSlice(s []StringTags) []models.Tags
- func StringTagsToTags(s StringTags) models.Tags
- func TagSliceSliceToTagSlice(s [][]models.Tag) []models.Tags
- func TagSliceToTags(s []models.Tag) models.Tags
- type Datapoint
- type MockIteratorPool
- func (ip *MockIteratorPool) CheckedBytesWrapper() xpool.CheckedBytesWrapperPool
- func (ip *MockIteratorPool) ID() ident.Pool
- func (ip *MockIteratorPool) MultiReaderIterator() encoding.MultiReaderIteratorPool
- func (ip *MockIteratorPool) MultiReaderIteratorArray() encoding.MultiReaderIteratorArrayPool
- func (ip *MockIteratorPool) MutableSeriesIterators() encoding.MutableSeriesIteratorsPool
- func (ip *MockIteratorPool) SeriesIterator() encoding.SeriesIteratorPool
- func (ip *MockIteratorPool) TagDecoder() serialize.TagDecoderPool
- func (ip *MockIteratorPool) TagEncoder() serialize.TagEncoderPool
- type SlowHandler
- type StringTag
- type StringTags
- type ValueMod
Constants ¶
This section is empty.
Variables ¶
var ( // SeriesNamespace is the expected namespace for the generated series SeriesNamespace string // TestTags is the expected tags for the generated series TestTags map[string]string // BlockSize is the expected block size for the generated series BlockSize time.Duration // Start is the expected start time for the first block in the generated series Start time.Time // SeriesStart is the expected start time for the generated series SeriesStart time.Time // Middle is the expected end for the first block, and start of the second block Middle time.Time // End is the expected end time for the generated series End time.Time )
Functions ¶
func BuildCustomIterator ¶ added in v0.5.0
func BuildCustomIterator( dps [][]Datapoint, testTags map[string]string, seriesID, seriesNamespace string, start time.Time, blockSize, stepSize time.Duration, ) (encoding.SeriesIterator, models.Bounds, error)
BuildCustomIterator builds a custom iterator with bounds
func BuildTestSeriesIterator ¶
func BuildTestSeriesIterator(id string) (encoding.SeriesIterator, error)
BuildTestSeriesIterator creates a sample SeriesIterator This series iterator has two identical replicas. Each replica has two blocks. The first block in each replica is merged and has values 1->30 The values 1 and 2 appear before the SeriesIterator start time, and are not expected to appear when reading through the iterator The second block is unmerged; when it was merged, it has values 101 -> 130 from two readers, one with even values and other with odd values Expected data points for reading through the iterator: [3..30,101..130], 58 in total SeriesIterator ID is given, namespace is 'namespace' Tags are "foo": "bar" and "baz": "qux"
func CompareListsInOrder ¶ added in v0.15.1
func CompareListsInOrder(t *testing.T, meta, exMeta []block.SeriesMeta, index, exIndex [][]int)
CompareListsInOrder compares series meta / index pairs (order sensitive)
func CompareValues ¶ added in v0.4.2
func CompareValues(t *testing.T, meta, exMeta []block.SeriesMeta, vals, exVals [][]float64)
CompareValues compares series meta / value pairs (order insensitive)
func CompareValuesInOrder ¶ added in v0.15.1
func CompareValuesInOrder(t *testing.T, meta, exMeta []block.SeriesMeta, vals, exVals [][]float64)
CompareValuesInOrder compares series meta / value pairs (order sensitive)
func EqualsWithNans ¶
EqualsWithNans helps compare float slices which have NaNs in them
func EqualsWithNansWithDelta ¶ added in v0.4.2
EqualsWithNansWithDelta helps compare float slices which have NaNs in them allowing a delta for float comparisons.
func GeneratePromReadBody ¶
GeneratePromReadBody generates a sample snappy encoded prometheus remote read request body
func GeneratePromReadRequest ¶
func GeneratePromReadRequest() *prompb.ReadRequest
GeneratePromReadRequest generates a sample prometheus remote read request
func GenerateValuesAndBounds ¶
GenerateValuesAndBounds generates a list of sample values and bounds while allowing overrides.
func MakeMockPoolWrapper ¶ added in v0.4.6
func MakeMockPoolWrapper() *pools.PoolWrapper
MakeMockPoolWrapper builds a pool wrapper wrapping a mock iterator
func MustMakeMeta ¶ added in v0.15.0
MustMakeMeta returns block metadata or panics (unsafe for use).
func MustMakeSeriesMeta ¶ added in v0.15.0
func MustMakeSeriesMeta(tags ...string) block.SeriesMeta
MustMakeSeriesMeta returns series metadata or panics (unsafe for use).
func NewBlockFromValues ¶
NewBlockFromValues creates a new block using the provided values.
func NewBlockFromValuesWithMetaAndSeriesMeta ¶ added in v0.4.1
func NewBlockFromValuesWithMetaAndSeriesMeta( meta block.Metadata, seriesMeta []block.SeriesMeta, seriesValues [][]float64, ) block.Block
NewBlockFromValuesWithMetaAndSeriesMeta creates a new block using the provided values.
func NewBlockFromValuesWithSeriesMeta ¶ added in v0.4.1
func NewBlockFromValuesWithSeriesMeta( bounds models.Bounds, seriesMeta []block.SeriesMeta, seriesValues [][]float64, ) block.Block
NewBlockFromValuesWithSeriesMeta creates a new block using the provided values.
func NewSeriesMeta ¶ added in v0.4.1
func NewSeriesMeta(tagPrefix string, count int) []block.SeriesMeta
NewSeriesMeta creates new metadata tags in the format [tagPrefix:i] for the number of series.
func NewSeriesMetaWithoutName ¶ added in v0.11.0
func NewSeriesMetaWithoutName(tagPrefix string, count int) []block.SeriesMeta
NewSeriesMetaWithoutName creates new metadata tags in the format [tagPrefix:i] for the number of series, without including the __name__.
func NewSlowStorage ¶
NewSlowStorage creates a new slow storage
func NewUnconsolidatedBlockFromDatapointsWithMeta ¶ added in v0.4.6
func NewUnconsolidatedBlockFromDatapointsWithMeta( bounds models.Bounds, seriesMetas []block.SeriesMeta, resultMeta block.ResultMetadata, seriesValues [][]float64, enableBatched bool, ) block.Block
NewUnconsolidatedBlockFromDatapointsWithMeta creates a new unconsolidated block using the provided values and metadata.
func NoopMod ¶ added in v0.4.1
NoopMod can be used to generate multi blocks when no value modification is needed.
func StringTagsSliceToTagSlice ¶ added in v0.4.6
func StringTagsSliceToTagSlice(s []StringTags) []models.Tags
StringTagsSliceToTagSlice converts a slice of string tags to a slice of tags.
func StringTagsToTags ¶ added in v0.4.6
func StringTagsToTags(s StringTags) models.Tags
StringTagsToTags converts string tags to tags.
func TagSliceSliceToTagSlice ¶ added in v0.4.8
TagSliceSliceToTagSlice converts a slice of tag slices to a slice of tags.
Types ¶
type Datapoint ¶ added in v0.5.0
Datapoint is a datapoint with a value and an offset for building a custom iterator
type MockIteratorPool ¶ added in v0.4.6
type MockIteratorPool struct {
MriPoolUsed, SiPoolUsed, MsiPoolUsed, MriaPoolUsed,
CbwPoolUsed, IdentPoolUsed, EncodePoolUsed, DecodePoolUsed bool
}
MockIteratorPool is an iterator pool used for testing
func MakeMockIteratorPool ¶ added in v0.4.6
func MakeMockIteratorPool() *MockIteratorPool
MakeMockIteratorPool builds a mock iterator pool
func (*MockIteratorPool) CheckedBytesWrapper ¶ added in v0.4.6
func (ip *MockIteratorPool) CheckedBytesWrapper() xpool.CheckedBytesWrapperPool
CheckedBytesWrapper exposes the session's CheckedBytesWrapperPool
func (*MockIteratorPool) ID ¶ added in v0.4.6
func (ip *MockIteratorPool) ID() ident.Pool
ID exposes the session's identity pool
func (*MockIteratorPool) MultiReaderIterator ¶ added in v0.4.6
func (ip *MockIteratorPool) MultiReaderIterator() encoding.MultiReaderIteratorPool
MultiReaderIterator exposes the session's MultiReaderIteratorPool
func (*MockIteratorPool) MultiReaderIteratorArray ¶ added in v0.4.6
func (ip *MockIteratorPool) MultiReaderIteratorArray() encoding.MultiReaderIteratorArrayPool
MultiReaderIteratorArray exposes the session's MultiReaderIteratorArrayPool
func (*MockIteratorPool) MutableSeriesIterators ¶ added in v0.4.6
func (ip *MockIteratorPool) MutableSeriesIterators() encoding.MutableSeriesIteratorsPool
MutableSeriesIterators exposes the session's MutableSeriesIteratorsPool
func (*MockIteratorPool) SeriesIterator ¶ added in v0.4.6
func (ip *MockIteratorPool) SeriesIterator() encoding.SeriesIteratorPool
SeriesIterator exposes the session's SeriesIteratorPool
func (*MockIteratorPool) TagDecoder ¶ added in v0.4.6
func (ip *MockIteratorPool) TagDecoder() serialize.TagDecoderPool
TagDecoder exposes the session's tag decoder pool
func (*MockIteratorPool) TagEncoder ¶ added in v0.4.6
func (ip *MockIteratorPool) TagEncoder() serialize.TagEncoderPool
TagEncoder exposes the session's tag encoder pool
type SlowHandler ¶
type SlowHandler struct {
// contains filtered or unexported fields
}
SlowHandler slows down a request by delay
func NewSlowHandler ¶
func NewSlowHandler(handler http.Handler, delay time.Duration) *SlowHandler
NewSlowHandler creates a new slow handler
func (*SlowHandler) ServeHTTP ¶
func (h *SlowHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.handler