Documentation
¶
Overview ¶
Package remotewrite provides a k6 extension for sending metrics to Prometheus Remote Write endpoints. This extension allows k6 load tests to generate and send time series data to any Prometheus-compatible remote write endpoint, enabling performance testing of metric ingestion pipelines.
Index ¶
- Variables
- func FromTimeseriesToPrometheusTimeseries(ts Timeseries) prompb.TimeSeries
- func ResponseCallback(n int) bool
- type Client
- func (c *Client) Store(ts []Timeseries) (httpext.Response, error)
- func (c *Client) StoreFromPrecompiledTemplates(minValue, maxValue int, timestamp int64, minSeriesID, maxSeriesID int, ...) (httpext.Response, error)
- func (c *Client) StoreFromTemplates(minValue, maxValue int, timestamp int64, minSeriesID, maxSeriesID int, ...) (httpext.Response, error)
- func (c *Client) StoreGenerated(totalSeries, batches, batchSize, batch int64) (httpext.Response, error)
- type Config
- type Label
- type RemoteWrite
- type Sample
- type Timeseries
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidConfig is returned when the client configuration is invalid. ErrInvalidConfig = errors.New("Client constructor expects first argument to be Config") // ErrURLRequired is returned when the URL is not provided in the configuration. ErrURLRequired = errors.New("url is required") )
Functions ¶
func FromTimeseriesToPrometheusTimeseries ¶
func FromTimeseriesToPrometheusTimeseries(ts Timeseries) prompb.TimeSeries
FromTimeseriesToPrometheusTimeseries converts a Timeseries to a Prometheus TimeSeries.
func ResponseCallback ¶ added in v0.0.2
ResponseCallback checks if the HTTP status code indicates success (2xx).
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the client wrapper.
func (*Client) Store ¶
func (c *Client) Store(ts []Timeseries) (httpext.Response, error)
Store sends the provided time series to the Prometheus Remote Write endpoint.
func (*Client) StoreFromPrecompiledTemplates ¶ added in v0.2.0
func (c *Client) StoreFromPrecompiledTemplates( minValue, maxValue int, timestamp int64, minSeriesID, maxSeriesID int, template *labelTemplates, ) (httpext.Response, error)
StoreFromPrecompiledTemplates generates and stores time series data using precompiled label templates.
func (*Client) StoreFromTemplates ¶ added in v0.1.0
func (c *Client) StoreFromTemplates( minValue, maxValue int, timestamp int64, minSeriesID, maxSeriesID int, labelsTemplate map[string]string, ) (httpext.Response, error)
StoreFromTemplates generates and stores time series data using label templates.
type Config ¶
type Config struct {
Url string `json:"url"` //nolint:revive // sobek exports value here
UserAgent string `json:"user_agent"` //nolint:tagliatelle // sobek use snake case for JSON keys
Timeout string `json:"timeout"`
TenantName string `json:"tenant_name"` //nolint:tagliatelle // sobek use snake case for JSON keys
Headers map[string]string `json:"headers"`
}
Config holds the configuration for the Prometheus Remote Write client.
type Label ¶ added in v0.0.3
type Label struct {
Name, Value string
}
Label represents a Prometheus label name-value pair.
type RemoteWrite ¶
type RemoteWrite struct {
// contains filtered or unexported fields
}
RemoteWrite is the k6 extension for interacting Prometheus Remote Write endpoints.
func (*RemoteWrite) Exports ¶ added in v0.2.0
func (r *RemoteWrite) Exports() modules.Exports
Exports returns the exports of the module for k6.
type Sample ¶ added in v0.0.3
Sample represents a single Prometheus sample with value and timestamp.
type Timeseries ¶
Timeseries represents a Prometheus time series with labels and samples.