vm

package
v1.56.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadRequest = errors.New("bad request")

ErrBadRequest represents bad request error.

Functions

func AddExtraLabelsToImportPath

func AddExtraLabelsToImportPath(path string, extraLabels []string) (string, error)

AddExtraLabelsToImportPath - adds extra labels query params to given url path.

Types

type Config

type Config struct {
	// VictoriaMetrics address to perform import requests
	//   --httpListenAddr value for single node version
	//   --httpListenAddr value of VMSelect  component for cluster version
	Addr string
	// Concurrency defines number of worker
	// performing the import requests concurrently
	Concurrency uint8
	// Whether to apply gzip compression
	Compress bool
	// AccountID for cluster version.
	// Empty value assumes it is a single node version
	AccountID string
	// BatchSize defines how many samples
	// importer collects before sending the import request
	BatchSize int
	// User name for basic auth
	User string
	// Password for basic auth
	Password string
	// SignificantFigures defines the number of significant figures to leave
	// in metric values before importing.
	// Zero value saves all the significant decimal places
	SignificantFigures int
	// RoundDigits defines the number of decimal digits after the point that must be left
	// in metric values before importing.
	RoundDigits int
	// ExtraLabels that will be added to all imported series. Must be in label=value format.
	ExtraLabels []string
}

Config contains list of params to configure the Importer

type ImportError

type ImportError struct {
	// The batch of timeseries that failed
	Batch []*TimeSeries
	// The error that appeared during insert
	Err error
}

ImportError is type of error generated in case of unsuccessful import request

type Importer

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

Importer performs insertion of timeseries via VictoriaMetrics import protocol see https://github.com/VictoriaMetrics/VictoriaMetrics/tree/master#how-to-import-time-series-data

func NewImporter

func NewImporter(cfg Config) (*Importer, error)

NewImporter creates new Importer for the given cfg.

func (*Importer) Close

func (im *Importer) Close()

Close sends signal to all goroutines to exit and waits until they are finished

func (*Importer) Errors

func (im *Importer) Errors() chan *ImportError

Errors returns a channel for receiving import errors if any

func (*Importer) Import

func (im *Importer) Import(tsBatch []*TimeSeries) error

Import imports tsBatch.

func (*Importer) Input

func (im *Importer) Input() chan<- *TimeSeries

Input returns a channel for sending timeseries that need to be imported

func (*Importer) Ping

func (im *Importer) Ping() error

Ping sends a ping to im.addr.

func (*Importer) ResetStats

func (im *Importer) ResetStats()

ResetStats resets im stats.

func (*Importer) Stats

func (im *Importer) Stats() string

Stats returns im stats.

type LabelPair

type LabelPair struct {
	Name  string
	Value string
}

LabelPair represents a label

type TimeSeries

type TimeSeries struct {
	Name       string
	LabelPairs []LabelPair
	Timestamps []int64
	Values     []float64
}

TimeSeries represents a time series.

func (TimeSeries) String

func (ts TimeSeries) String() string

String returns user-readable ts.

Jump to

Keyboard shortcuts

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