metrics

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendRemoteWrite

func SendRemoteWrite(ctx context.Context, cfg *ConfigWrite, gatherer prometheus.Gatherer) error

SendRemoteWrite initializes a http client and sends metrics to a prometheus compatible remote endpoint.

func ToTimeSeriesSlice

func ToTimeSeriesSlice(metricFamilies []*dto.MetricFamily) []prompb.TimeSeries

ToTimeSeriesSlice converts a slice of metricFamilies containing samples into a slice of TimeSeries

Types

type Client

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

Client for the remote write requests.

func (*Client) Store

func (c *Client) Store(ctx context.Context, req *prompb.WriteRequest) error

Store sends a batch of samples to the HTTP endpoint.

type Collector added in v0.6.0

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

func NewCollector added in v0.6.0

func NewCollector(cfg Config) *Collector

NewCollector returns Prometheus collector that can be registered in registry that handles metric creation and changes, based on the given configuration.

func (*Collector) Collect added in v0.6.0

func (c *Collector) Collect(metricCh chan<- prometheus.Metric)

func (*Collector) Describe added in v0.6.0

func (c *Collector) Describe(chan<- *prometheus.Desc)

Describe is used when registering metrics. It's noop avoiding us to have an easier dynamicity. No descriptors allow this collector to be "unchecked", but more efficient with what we try to do here.

func (*Collector) Run added in v0.6.0

func (c *Collector) Run() error

Run creates a set of Prometheus test series that update over time. NOTE: Only one execution of RunMetrics is currently expected.

func (*Collector) Stop added in v0.6.0

func (c *Collector) Stop(_ error)

func (*Collector) UpdateNotifyCh added in v0.6.0

func (c *Collector) UpdateNotifyCh() chan struct{}

type Config added in v0.6.0

type Config struct {
	GaugeMetricCount, CounterMetricCount, HistogramMetricCount, NativeHistogramMetricCount, SummaryMetricCount int

	HistogramBuckets, SummaryObjectives int

	LabelCount, SeriesCount        int
	MaxSeriesCount, MinSeriesCount int
	MetricLength, LabelLength      int

	ValueInterval, SeriesInterval, MetricInterval, SeriesChangeInterval, SeriesChangeRate int

	SpikeMultiplier     float64
	SeriesOperationMode opMode
	ConstLabels         []string
}

func NewConfigFromFlags added in v0.6.0

func NewConfigFromFlags(flagReg func(name, help string) *kingpin.FlagClause) *Config

func (Config) Validate added in v0.6.0

func (c Config) Validate() error

type ConfigWrite

type ConfigWrite struct {
	URL             *url.URL
	RequestInterval time.Duration
	BatchSize,
	RequestCount int
	UpdateNotify    chan struct{}
	PprofURLs       []*url.URL
	Tenant          string
	TLSClientConfig tls.Config
	TenantHeader    string
	OutOfOrder      bool
	Concurrency     int
}

ConfigWrite for the remote write requests.

func NewWriteConfigFromFlags added in v0.7.0

func NewWriteConfigFromFlags(flagReg func(name, help string) *kingpin.FlagClause) *ConfigWrite

func (*ConfigWrite) Validate added in v0.7.0

func (c *ConfigWrite) Validate() error

Jump to

Keyboard shortcuts

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