prometheusremotewriteexporter

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

README

Prometheus Remote Write Exporter

This Exporter sends metrics data in Prometheus TimeSeries format to Cortex or any Prometheus remote write compatible backend.

Non-cumulative monotonic, histogram, and summary OTLP metrics are dropped by this exporter.

The following settings are required:

  • endpoint: protocol:host:port to which the exporter is going to send traces or metrics, using the HTTP/HTTPS protocol.

The following settings can be optionally configured:

  • namespace: prefix attached to each exported metric name.
  • headers: additional headers attached to each HTTP request. If X-Prometheus-Remote-Write-Version is set by user, its value must be 0.1.0
  • insecure (default = false): whether to enable client transport security for the exporter's connection.
  • ca_file: path to the CA cert. For a client this verifies the server certificate. Should only be used if insecure is set to false.
  • cert_file: path to the TLS cert to use for TLS required connections. Should only be used if insecure is set to false.
  • key_file: path to the TLS key to use for TLS required connections. Should only be used if insecure is set to false.
  • timeout (default = 5s): How long to wait until the connection is close.
  • read_buffer_size (default = 0): ReadBufferSize for HTTP client.
  • write_buffer_size (default = 512 * 1024): WriteBufferSize for HTTP client.

Example:

exporters:
prometheusremotewrite:
 endpoint: "http://some.url:9411/api/prom/push"

The full list of settings exposed for this exporter are documented here with detailed sample configurations here.

Here is a link to the overall project design

Documentation

Overview

Note: implementation for this class is in a separate PR

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory() component.ExporterFactory

Types

type ByLabelName

type ByLabelName []prompb.Label

ByLabelName enables the usage of sort.Sort() with a slice of labels

func (ByLabelName) Len

func (a ByLabelName) Len() int

func (ByLabelName) Less

func (a ByLabelName) Less(i, j int) bool

func (ByLabelName) Swap

func (a ByLabelName) Swap(i, j int)

type Config

type Config struct {
	// squash ensures fields are correctly decoded in embedded struct.
	configmodels.ExporterSettings  `mapstructure:",squash"`
	exporterhelper.TimeoutSettings `mapstructure:",squash"`
	exporterhelper.QueueSettings   `mapstructure:"sending_queue"`
	exporterhelper.RetrySettings   `mapstructure:"retry_on_failure"`

	// prefix attached to each exported metric name
	// See: https://prometheus.io/docs/practices/naming/#metric-names
	Namespace string `mapstructure:"namespace"`

	HTTPClientSettings confighttp.HTTPClientSettings `mapstructure:",squash"`
}

Config defines configuration for Remote Write exporter.

type PrwExporter added in v0.10.0

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

PrwExporter converts OTLP metrics to Prometheus remote write TimeSeries and sends them to a remote endpoint

func NewPrwExporter added in v0.10.0

func NewPrwExporter(namespace string, endpoint string, client *http.Client) (*PrwExporter, error)

NewPrwExporter initializes a new PrwExporter instance and sets fields accordingly. client parameter cannot be nil.

func (*PrwExporter) PushMetrics added in v0.10.0

func (prwe *PrwExporter) PushMetrics(ctx context.Context, md pdata.Metrics) (int, error)

PushMetrics converts metrics to Prometheus remote write TimeSeries and send to remote endpoint. It maintain a map of TimeSeries, validates and handles each individual metric, adding the converted TimeSeries to the map, and finally exports the map.

func (*PrwExporter) Shutdown added in v0.10.0

func (prwe *PrwExporter) Shutdown(context.Context) error

Shutdown stops the exporter from accepting incoming calls(and return error), and wait for current export operations to finish before returning

Jump to

Keyboard shortcuts

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