prompb

package
v0.0.0-...-8a5471c Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WriteRequestPool = NewPool[*WriteRequest](
		func() *WriteRequest {
			return &WriteRequest{}
		},
	)

	TimeSeriesPool = NewPool[*TimeSeries](
		func() *TimeSeries {
			return &TimeSeries{}
		},
	)
	LabelPool = NewPool[*Label](
		func() *Label {
			return &Label{}
		},
	)

	SamplePool = NewPool[*Sample](
		func() *Sample {
			return &Sample{}
		},
	)
)

Functions

func CompareLower

func CompareLower(sa, sb []byte) int

func IsSorted

func IsSorted(l []*Label) bool

IsSorted return true if the labels are sorted according to Sort.

func MetricName

func MetricName(ts *TimeSeries) []byte

func Sort

func Sort(l []*Label)

Sort sorts labels ensuring the __name__ is first the remaining labels or ordered by name.

Types

type Iterator

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

func NewIterator

func NewIterator(r io.ReadCloser) *Iterator

func (*Iterator) Close

func (i *Iterator) Close() error

func (*Iterator) Err

func (i *Iterator) Err() error

func (*Iterator) Next

func (i *Iterator) Next() bool

func (*Iterator) ParseTimeSeriesInto

func (i *Iterator) ParseTimeSeriesInto(ts *TimeSeries, line string) (*TimeSeries, error)

func (*Iterator) Reset

func (i *Iterator) Reset(r io.ReadCloser)

func (*Iterator) TimeSeriesInto

func (i *Iterator) TimeSeriesInto(ts *TimeSeries) (*TimeSeries, error)

func (*Iterator) Value

func (i *Iterator) Value() string

type Label

type Label struct {
	Name  []byte
	Value []byte
}

Label is a timeseries label

func (*Label) Reset

func (l *Label) Reset()

func (*Label) Size

func (m *Label) Size() (n int)

type Labels

type Labels []Label

func (Labels) Len

func (l Labels) Len() int

func (Labels) Less

func (l Labels) Less(i, j int) bool

func (Labels) Swap

func (l Labels) Swap(i, j int)

type Pool

type Pool[T Resetter] struct {
	New func() T
	// contains filtered or unexported fields
}

func NewPool

func NewPool[T Resetter](new func() T) *Pool[T]

func (*Pool[T]) Get

func (p *Pool[T]) Get() T

func (*Pool[T]) Put

func (p *Pool[T]) Put(r T)

type Resetter

type Resetter interface {
	Reset()
}

type Sample

type Sample struct {
	Value     float64
	Timestamp int64
}

Sample is a timeseries sample.

func (*Sample) Reset

func (s *Sample) Reset()

func (*Sample) Size

func (s *Sample) Size() (n int)

type TimeSeries

type TimeSeries struct {
	Labels  []*Label
	Samples []*Sample
}

TimeSeries is a timeseries.

func (*TimeSeries) AppendLabel

func (m *TimeSeries) AppendLabel(key []byte, value []byte)

func (*TimeSeries) AppendLabelString

func (m *TimeSeries) AppendLabelString(key string, value string)

func (*TimeSeries) AppendSample

func (m *TimeSeries) AppendSample(timestamp int64, value float64)

func (*TimeSeries) Reset

func (ts *TimeSeries) Reset()

func (*TimeSeries) Size

func (m *TimeSeries) Size() (n int)

type WriteRequest

type WriteRequest struct {
	Timeseries []*TimeSeries
}

WriteRequest represents Prometheus remote write API request

func (*WriteRequest) Marshal

func (wr *WriteRequest) Marshal() (dAtA []byte, err error)

func (*WriteRequest) MarshalTo

func (wr *WriteRequest) MarshalTo(dst []byte) ([]byte, error)

func (*WriteRequest) Reset

func (wr *WriteRequest) Reset()

Reset resets wr.

func (*WriteRequest) Size

func (wr *WriteRequest) Size() (n int)

func (*WriteRequest) Unmarshal

func (wr *WriteRequest) Unmarshal(src []byte) (err error)

Unmarshal unmarshals m from src.

Jump to

Keyboard shortcuts

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