common

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGzipReader added in v1.26.0

func GetGzipReader(r io.Reader) (*gzip.Reader, error)

GetGzipReader returns new gzip reader from the pool.

Return back the gzip reader when it no longer needed with PutGzipReader.

func PutGzipReader added in v1.26.0

func PutGzipReader(zr *gzip.Reader)

PutGzipReader returns back gzip reader obtained via GetGzipReader.

func ReadLinesBlock added in v1.18.7

func ReadLinesBlock(r io.Reader, dstBuf, tailBuf []byte) ([]byte, []byte, error)

ReadLinesBlock reads a block of lines delimited by '\n' from tailBuf and r into dstBuf.

Trailing chars after the last newline are put into tailBuf.

Returns (dstBuf, tailBuf).

func ReadLinesBlockExt added in v1.30.6

func ReadLinesBlockExt(r io.Reader, dstBuf, tailBuf []byte, maxLineLen int) ([]byte, []byte, error)

ReadLinesBlockExt reads a block of lines delimited by '\n' from tailBuf and r into dstBuf.

Trailing chars after the last newline are put into tailBuf.

Returns (dstBuf, tailBuf).

maxLineLen limits the maximum length of a single line.

Types

type InsertCtx

type InsertCtx struct {
	Labels []prompb.Label
	// contains filtered or unexported fields
}

InsertCtx contains common bits for data points insertion.

func (*InsertCtx) AddLabel

func (ctx *InsertCtx) AddLabel(name, value string)

AddLabel adds (name, value) label to ctx.Labels.

name and value must exist until ctx.Labels is used.

func (*InsertCtx) AddLabelBytes added in v1.30.6

func (ctx *InsertCtx) AddLabelBytes(name, value []byte)

AddLabelBytes adds (name, value) label to ctx.Labels.

name and value must exist until ctx.Labels is used.

func (*InsertCtx) FlushBufs

func (ctx *InsertCtx) FlushBufs() error

FlushBufs flushes buffered rows to the underlying storage.

func (*InsertCtx) Reset

func (ctx *InsertCtx) Reset(rowsLen int)

Reset resets ctx for future fill with rowsLen rows.

func (*InsertCtx) WriteDataPoint

func (ctx *InsertCtx) WriteDataPoint(prefix []byte, labels []prompb.Label, timestamp int64, value float64)

WriteDataPoint writes (timestamp, value) with the given prefix and labels into ctx buffer.

func (*InsertCtx) WriteDataPointExt

func (ctx *InsertCtx) WriteDataPointExt(metricNameRaw []byte, labels []prompb.Label, timestamp int64, value float64) []byte

WriteDataPointExt writes (timestamp, value) with the given metricNameRaw and labels into ctx buffer.

It returns metricNameRaw for the given labels if len(metricNameRaw) == 0.

Jump to

Keyboard shortcuts

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