remotewrite

package
v0.0.0-...-6d17679 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package remotewrite is a k6 output that sends metrics to a Prometheus remote write endpoint.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapSeries

func MapSeries(series metrics.TimeSeries, suffix string) []*prompb.Label

MapSeries converts a k6 time series into the equivalent set of Labels (name+tags) as expected from the Prometheus' data model.

The labels are lexicographic sorted as required from the Remote write's specification.

func MapTagSet

func MapTagSet(t *metrics.TagSet) []*prompb.Label

MapTagSet converts a k6 tag set into the equivalent set of Labels as expected from the Prometheus' data model.

Types

type Config

type Config struct {
	// ServerURL contains the absolute ServerURL for the Write endpoint where to flush the time series.
	ServerURL null.String `json:"url"`

	// Headers contains additional headers that should be included in the HTTP requests.
	Headers map[string]string `json:"headers"`

	// InsecureSkipTLSVerify skips TLS client side checks.
	InsecureSkipTLSVerify null.Bool `json:"insecureSkipTLSVerify"`

	// Username is the User for Basic Auth.
	Username null.String `json:"username"`

	// Password is the Password for the Basic Auth.
	Password null.String `json:"password"`

	// PushInterval defines the time between flushes. The Output will wait the set time
	// before push a new set of time series to the endpoint.
	PushInterval types.NullDuration `json:"pushInterval"`

	// TrendAsNativeHistogram defines if the mapping for metrics defined as Trend type
	// should map to a Prometheus' Native Histogram.
	TrendAsNativeHistogram null.Bool `json:"trendAsNativeHistogram"`

	// TrendStats defines the stats to flush for Trend metrics.
	//
	// TODO: should we support K6_SUMMARY_TREND_STATS?
	TrendStats []string `json:"trendStats"`

	StaleMarkers null.Bool `json:"staleMarkers"`
}

Config contains the configuration for the Output.

func GetConsolidatedConfig

func GetConsolidatedConfig(jsonRawConf json.RawMessage, env map[string]string, url string) (Config, error)

GetConsolidatedConfig combines the options' values from the different sources and returns the merged options. The Order of precedence used is documented in the k6 Documentation https://k6.io/docs/using-k6/k6-options/how-to/#order-of-precedence.

func NewConfig

func NewConfig() Config

NewConfig creates an Output's configuration.

func (Config) Apply

func (conf Config) Apply(applied Config) Config

Apply merges applied Config into base.

func (Config) RemoteConfig

func (conf Config) RemoteConfig() (*remote.HTTPConfig, error)

RemoteConfig creates a configuration for the HTTP Remote-write client.

type Output

type Output struct {
	output.SampleBuffer
	// contains filtered or unexported fields
}

Output is a k6 output that sends metrics to a Prometheus remote write endpoint.

func New

func New(params output.Params) (*Output, error)

New creates a new Output instance.

func (*Output) Description

func (o *Output) Description() string

Description returns a short human-readable description of the output.

func (*Output) Start

func (o *Output) Start() error

Start initializes the output.

func (*Output) Stop

func (o *Output) Stop() error

Stop stops the output.

type TrendStatsResolver

type TrendStatsResolver map[string]func(*metrics.TrendSink) float64

TrendStatsResolver is a map of trend stats name and their relative resolver function

Jump to

Keyboard shortcuts

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