tsdbutil

package
v0.0.0-...-f8c6d31 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChunkFromSamples

func ChunkFromSamples(s []Sample) chunks.Meta

ChunkFromSamples requires all samples to have the same type.

func ChunkFromSamplesGeneric

func ChunkFromSamplesGeneric(s Samples) chunks.Meta

ChunkFromSamplesGeneric requires all samples to have the same type.

func GenerateTestFloatHistogram

func GenerateTestFloatHistogram(i int) *histogram.FloatHistogram

GenerateTestFloatHistogram but it is up to the user to set any known counter reset hint.

func GenerateTestFloatHistograms

func GenerateTestFloatHistograms(n int) (r []*histogram.FloatHistogram)

func GenerateTestGaugeFloatHistogram

func GenerateTestGaugeFloatHistogram(i int) *histogram.FloatHistogram

func GenerateTestGaugeFloatHistograms

func GenerateTestGaugeFloatHistograms(n int) (r []*histogram.FloatHistogram)

func GenerateTestGaugeHistogram

func GenerateTestGaugeHistogram(i int) *histogram.Histogram

func GenerateTestGaugeHistograms

func GenerateTestGaugeHistograms(n int) (r []*histogram.Histogram)

func GenerateTestHistogram

func GenerateTestHistogram(i int) *histogram.Histogram

GenerateTestHistogram but it is up to the user to set any known counter reset hint.

func GenerateTestHistograms

func GenerateTestHistograms(n int) (r []*histogram.Histogram)

func PopulatedChunk

func PopulatedChunk(numSamples int, minTime int64) chunks.Meta

PopulatedChunk creates a chunk populated with samples every second starting at minTime

func TestDirLockerUsage

func TestDirLockerUsage(t *testing.T, open func(t *testing.T, data string, createLock bool) (*DirLocker, testutil.Closer))

TestDirLockerUsage performs a set of tests which guarantee correct usage of DirLocker. open should use data as the storage directory, and createLock to determine if a lock file should be used.

Types

type DirLocker

type DirLocker struct {
	// contains filtered or unexported fields
}

func NewDirLocker

func NewDirLocker(dir, subsystem string, l log.Logger, r prometheus.Registerer) (*DirLocker, error)

NewDirLocker creates a DirLocker that can obtain an exclusive lock on dir.

func (*DirLocker) Lock

func (l *DirLocker) Lock() error

Lock obtains the lock on the locker directory.

func (*DirLocker) Release

func (l *DirLocker) Release() error

Release releases the lock. No-op if the lock is not held.

type Sample

type Sample interface {
	T() int64
	V() float64
	H() *histogram.Histogram
	FH() *histogram.FloatHistogram
	Type() chunkenc.ValueType
}

func GenerateSamples

func GenerateSamples(start, numSamples int) []Sample

GenerateSamples starting at start and counting up numSamples.

type SampleSlice

type SampleSlice []Sample

func (SampleSlice) Get

func (s SampleSlice) Get(i int) Sample

func (SampleSlice) Len

func (s SampleSlice) Len() int

type Samples

type Samples interface {
	Get(i int) Sample
	Len() int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL