prometheusremotewritereceiver

package
v0.76.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

README

Prometheus remote write receiver

This prometheus remote write receiver aims to

  1. Deprecate the Prometheus Gateway from signalfx
  2. Support prometheus remote writes as an ingestion mechanism to the open-telemetry collector
  3. Support flaky clients to the best possible degree

Limitations

As of this writing, no official specification exists for remote write endpoints, nor a 1-1 mapping between prometheus remote write metrics and OpenTelemetry metrics.

As such, this receiver implements a best-effort mapping between such metrics. If you find your use case or access patterns do not jive well with this receiver, please cut an issue to our repo with the specific data incongruity that you're experiencing, and we will do our best to provide for you within maintainable reason.

Receiver Configuration

This receiver is configured via standard OpenTelemetry mechanisms. See config.go for specific details.

  • path is the path in which the receiver should respond to prometheus remote write requests.
    • Defaults to /metrics
  • buffer_size is the degree to which metric translations may be buffered without blocking further write requests.
    • Defaults to 100
  • cache_size is the number of most recent metadata requests which should be stored. Turn this to zero if you wish to disable caching between requests, but do ensure your metrics write requests are independently and consistently parseable without any metadata if so.
    • Defaults to 10000

This receiver uses opentelemetry-collector's confighttp options if you would like to set up tls or similar. (See linked documentation for the most up-to-date details). However, we make the following changes to their default options:

  • endpoint is the default interface + port to listen on
    • Defaults to localhost:19291

Remote write client configuration

If you're using the native remote write configuration, it's advisable that you enable send=true under metadata_config. If possible, wait on sending multiple requests until you're reasonably assured that metadata has propagated to the receiver.

Nuances in translation

We do not remove suffixes as is done in the otel-contrib prometheusreceiver

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFreePort

func GetFreePort() (int, error)

func New

func New(
	settings receiver.CreateSettings,
	config *Config,
	nextConsumer consumer.Metrics,
) (receiver.Metrics, error)

New creates the PrometheusRemoteWrite receiver with the given parameters.

func NewFactory

func NewFactory() receiver.Factory

Types

type Config

type Config struct {
	// ListenPath is the path in which the receiver should respond to prometheus remote write requests.
	ListenPath string `mapstructure:"path"`
	// provides generic settings for connecting to HTTP servers as commonly used in opentelemetry
	confighttp.HTTPServerSettings `mapstructure:",squash"`
	// BufferSize is the degree to which metric translations may be buffered without blocking further write requests.
	BufferSize int `mapstructure:"buffer_size"`
	// CacheCapacity determines LRU capacity for how many different metrics may concurrently have persisted metadata.
	CacheCapacity int `mapstructure:"cache_size"`
}

func (*Config) Validate

func (c *Config) Validate() error

type MockPrwClient

type MockPrwClient struct {
	Client  remote.WriteClient
	Timeout time.Duration
}

func NewMockPrwClient

func NewMockPrwClient(addr string, path string) (MockPrwClient, error)

func (*MockPrwClient) SendWriteRequest

func (prwc *MockPrwClient) SendWriteRequest(wr *prompb.WriteRequest) error

type ServerConfig

type ServerConfig struct {
	Reporter reporter
	component.Host
	Mc chan<- pmetric.Metrics
	component.TelemetrySettings
	Path string
	confighttp.HTTPServerSettings
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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