Documentation
¶
Index ¶
- func Init(storage_addrs []string, hashSeed_storage uint64, sketch_addrs []string, ...)
- func MustStop()
- func PutInsertCtx(ctx *InsertCtx)
- func PutInsertCtxSketch(ctx *InsertCtxSketch)
- type InsertCtx
- func (ctx *InsertCtx) AddLabel(name, value string)
- func (ctx *InsertCtx) AddLabelBytes(name, value []byte)
- func (ctx *InsertCtx) FlushBufs() error
- func (ctx *InsertCtx) GetLocalAuthToken(at *auth.Token) *auth.Token
- func (ctx *InsertCtx) GetStorageNodeIdx(at *auth.Token, labels []prompbmarshal.Label) int
- func (ctx *InsertCtx) Reset()
- func (ctx *InsertCtx) TryPrepareLabels(hasRelabeling bool) bool
- func (ctx *InsertCtx) WriteDataPoint(at *auth.Token, labels []prompbmarshal.Label, timestamp int64, value float64) error
- func (ctx *InsertCtx) WriteDataPointExt(storageNodeIdx int, metricNameRaw []byte, timestamp int64, value float64) error
- type InsertCtxSketch
- func (ctx *InsertCtxSketch) AddLabel(name, value string)
- func (ctx *InsertCtxSketch) AddLabelBytes(name, value []byte)
- func (ctx *InsertCtxSketch) FlushBufs() error
- func (ctx *InsertCtxSketch) GetSketchNodeIdx(at *auth.Token, labels []prompbmarshal.Label) int
- func (ctx *InsertCtxSketch) Reset()
- func (ctx *InsertCtxSketch) WriteDataPointExtSketch(sketchNodeIdx int, metricNameRaw []byte, timestamp int64, value float64) error
- func (ctx *InsertCtxSketch) WriteDataPointSketch(at *auth.Token, labels []prompbmarshal.Label, timestamp int64, value float64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init(storage_addrs []string, hashSeed_storage uint64, sketch_addrs []string, hashSeed_sketch uint64)
Init initializes vmstorage nodes' connections to the given addrs.
hashSeed is used for changing the distribution of input time series among addrs.
Call MustStop when the initialized vmstorage connections are no longer needed.
func PutInsertCtx ¶
func PutInsertCtx(ctx *InsertCtx)
PutInsertCtx returns ctx to the pool.
ctx cannot be used after the call.
func PutInsertCtxSketch ¶
func PutInsertCtxSketch(ctx *InsertCtxSketch)
PutInsertCtxSketch returns ctx to the pool.
ctx cannot be used after the call.
Types ¶
type InsertCtx ¶
type InsertCtx struct {
Labels sortedLabels
MetricNameBuf []byte
// contains filtered or unexported fields
}
InsertCtx is a generic context for inserting data.
InsertCtx.Reset must be called before the first usage.
func GetInsertCtx ¶
func GetInsertCtx() *InsertCtx
GetInsertCtx returns InsertCtx from the pool.
Call PutInsertCtx for returning it to the pool.
func (*InsertCtx) AddLabel ¶
AddLabel adds (name, value) label to ctx.Labels.
name and value must exist until ctx.Labels is used.
func (*InsertCtx) AddLabelBytes ¶
AddLabelBytes adds (name, value) label to ctx.Labels.
name and value must exist until ctx.Labels is used.
func (*InsertCtx) GetLocalAuthToken ¶
GetLocalAuthToken obtains auth.Token from context labels vm_account_id and vm_project_id if at is nil.
At is returned as is if it isn't nil.
The vm_account_id and vm_project_id labels are automatically removed from the ctx.
func (*InsertCtx) GetStorageNodeIdx ¶
GetStorageNodeIdx returns storage node index for the given at and labels.
The returned index must be passed to WriteDataPoint.
func (*InsertCtx) TryPrepareLabels ¶
TryPrepareLabels prepares context labels to the ingestion
It returns false if timeseries should be skipped
func (*InsertCtx) WriteDataPoint ¶
func (ctx *InsertCtx) WriteDataPoint(at *auth.Token, labels []prompbmarshal.Label, timestamp int64, value float64) error
WriteDataPoint writes (timestamp, value) data point with the given at and labels to ctx buffer.
caller must invoke TryPrepareLabels before using this function
func (*InsertCtx) WriteDataPointExt ¶
func (ctx *InsertCtx) WriteDataPointExt(storageNodeIdx int, metricNameRaw []byte, timestamp int64, value float64) error
WriteDataPointExt writes the given metricNameRaw with (timestmap, value) to ctx buffer with the given storageNodeIdx.
caller must invoke TryPrepareLabels before using this function
type InsertCtxSketch ¶
type InsertCtxSketch struct {
Labels sortedLabels
MetricNameBuf []byte
// contains filtered or unexported fields
}
InsertCtx is a generic context for inserting data.
InsertCtx.Reset must be called before the first usage.
func GetInsertCtxSketch ¶
func GetInsertCtxSketch() *InsertCtxSketch
GetInsertCtxSketch returns InsertCtxSketch from the pool.
Call PutInsertCtxSketch for returning it to the pool.
func (*InsertCtxSketch) AddLabel ¶
func (ctx *InsertCtxSketch) AddLabel(name, value string)
AddLabel adds (name, value) label to ctx.Labels.
name and value must exist until ctx.Labels is used.
func (*InsertCtxSketch) AddLabelBytes ¶
func (ctx *InsertCtxSketch) AddLabelBytes(name, value []byte)
AddLabelBytes adds (name, value) label to ctx.Labels.
name and value must exist until ctx.Labels is used.
func (*InsertCtxSketch) FlushBufs ¶
func (ctx *InsertCtxSketch) FlushBufs() error
FlushBufs flushes ctx bufs to remote storage nodes.
func (*InsertCtxSketch) GetSketchNodeIdx ¶
func (ctx *InsertCtxSketch) GetSketchNodeIdx(at *auth.Token, labels []prompbmarshal.Label) int
GetSketchNodeIdx returns promstorage node index for the given at and labels. The returned index must be passed to WriteDataPoint.
func (*InsertCtxSketch) WriteDataPointExtSketch ¶
func (ctx *InsertCtxSketch) WriteDataPointExtSketch(sketchNodeIdx int, metricNameRaw []byte, timestamp int64, value float64) error
WriteDataPointExt writes the given metricNameRaw with (timestmap, value) to ctx buffer with the given storageNodeIdx.
caller must invoke TryPrepareLabels before using this function
func (*InsertCtxSketch) WriteDataPointSketch ¶
func (ctx *InsertCtxSketch) WriteDataPointSketch(at *auth.Token, labels []prompbmarshal.Label, timestamp int64, value float64) error
WriteDataPoint writes (timestamp, value) data point with the given at and labels to ctx buffer.
caller must invoke TryPrepareLabels before using this function