Documentation ¶
Index ¶
Constants ¶
const ( // MaxConns is the number of simultaneous connections we allow to one host MaxConns = 100 // DefaultRemoteTimeout after which a write request will time out DefaultRemoteTimeout = time.Duration(30 * time.Second) // DefaultAuthorizationType if a credential is supplied DefaultAuthorizationType = "Bearer" )
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create( server *veneur.Server, name string, logger *logrus.Entry, config veneur.Config, sinkConfig veneur.MetricSinkConfig, ) (sinks.MetricSink, error)
Create creates a new Cortex sink. @see veneur.MetricSinkTypes
func ParseConfig ¶
ParseConfig extracts Cortex specific fields from the global veneur config
Types ¶
type BasicAuthType ¶
type BasicAuthType struct { Username util.StringSecret `yaml:"username"` Password util.StringSecret `yaml:"password"` }
type CortexMetricSink ¶
type CortexMetricSink struct { URL string RemoteTimeout time.Duration ProxyURL string Client *http.Client // contains filtered or unexported fields }
CortexMetricSink writes metrics to one or more configured Cortex instances using the prometheus remote-write API. For specifications, see https://github.com/prometheus/compliance/tree/main/remote_write
func NewCortexMetricSink ¶
func NewCortexMetricSink(URL string, timeout time.Duration, proxyURL string, logger *logrus.Entry, name string, tags map[string]string, headers map[string]string, basicAuth *BasicAuthType, batchWriteSize int) (*CortexMetricSink, error)
NewCortexMetricSink creates and returns a new instance of the sink
func (*CortexMetricSink) Flush ¶
func (s *CortexMetricSink) Flush(ctx context.Context, metrics []samplers.InterMetric) error
Flush sends a batch of metrics to the configured remote-write endpoint
func (*CortexMetricSink) FlushOtherSamples ¶
func (s *CortexMetricSink) FlushOtherSamples(context.Context, []ssf.SSFSample)
FlushOtherSamples would forward non-metric sanples like spans. Prometheus cannot receive them, so this is a no-op.
func (*CortexMetricSink) Name ¶
func (s *CortexMetricSink) Name() string
Name returns the string cortex
type CortexMetricSinkConfig ¶
type CortexMetricSinkConfig struct { URL string `yaml:"url"` RemoteTimeout time.Duration `yaml:"remote_timeout"` ProxyURL string `yaml:"proxy_url"` BatchWriteSize int `yaml:"batch_write_size"` Headers map[string]string `yaml:"headers"` BasicAuth BasicAuthType `yaml:"basic_auth"` Authorization struct { Type string `yaml:"type"` Credential util.StringSecret `yaml:"credentials"` } `yaml:"authorization"` }
TODO: implement queue config options, at least max_samples_per_send, max_shards, and capacity https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write