README
Prometheus Remote Write Exporter
This exporter sends data in Prometheus TimeSeries format to Cortex or any Prometheus remote write compatible backend. By default, this exporter requires TLS and offers queued retry capabilities.
⚠️ Non-cumulative monotonic, histogram, and summary OTLP metrics are dropped by this exporter.
Here is a link to the overall project design
Supported pipeline types: metrics
Getting Started
The following settings are required:
endpoint
(no default): protocol:host:port to which the exporter is going to send data.
By default, TLS is enabled:
insecure
(default =false
): whether to enable client transport security for the exporter's connection.
As a result, the following parameters are also required:
cert_file
(no default): path to the TLS cert to use for TLS required connections. Should only be used ifinsecure
is set to false.key_file
(no default): path to the TLS key to use for TLS required connections. Should only be used ifinsecure
is set to false.
The following settings can be optionally configured:
external_labels
: list of labels to be attached to each metric data pointheaders
: additional headers attached to each HTTP request.- Note the following headers cannot be changed:
Content-Encoding
,Content-Type
,X-Prometheus-Remote-Write-Version
, andUser-Agent
.
- Note the following headers cannot be changed:
namespace
: prefix attached to each exported metric name.
Example:
exporters:
prometheusremotewrite:
endpoint: "http://some.url:9411/api/prom/push"
Advanced Configuration
Several helper files are leveraged to provide additional capabilities automatically:
Documentation
Overview ¶
Package prometheusremotewriteexporter implements an exporter that sends Prometheus remote write requests.
Index ¶
Constants ¶
Variables ¶
Functions ¶
func NewFactory ¶
func NewFactory() component.ExporterFactory
Types ¶
type ByLabelName ¶
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"` // ExternalLabels defines a map of label keys and values that are allowed to start with reserved prefix "__" ExternalLabels map[string]string `mapstructure:"external_labels"` HTTPClientSettings confighttp.HTTPClientSettings `mapstructure:",squash"` }
Config defines configuration for Remote Write exporter.
type PrwExporter ¶
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 ¶
func NewPrwExporter(namespace string, endpoint string, client *http.Client, externalLabels map[string]string) (*PrwExporter, error)
NewPrwExporter initializes a new PrwExporter instance and sets fields accordingly. client parameter cannot be nil.
func (*PrwExporter) PushMetrics ¶
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.