vm

package
v1.101.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 15 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
	// Transport allows specifying custom http.Transport
	Transport *http.Transport
	// 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
	// RateLimit defines a data transfer speed in bytes per second.
	// Is applied to each worker (see Concurrency) independently.
	RateLimit int64
	// Whether to disable progress bar per VM worker
	DisableProgressBar bool
}

Config contains list of params to configure the Importer

type ImportError

type ImportError struct {
	// The batch of timeseries processed by importer at the moment
	Batch []*TimeSeries
	// The error that appeared during insert
	// If err is nil - no error happened and Batch
	// Is the latest delivered Batch.
	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://docs.victoriametrics.com/#how-to-import-time-series-data

func NewImporter

func NewImporter(ctx context.Context, 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(ts *TimeSeries) error

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