Documentation
¶
Overview ¶
Package pusher provides a mechanism for pushing metrics to a remote write endpoint. It periodically collects metrics from a resource store, formats them, and sends them to the specified endpoint. The package includes Prometheus metrics to monitor the performance and success of the remote write operations. It supports configuration for send intervals, timeouts, maximum payload sizes, and retry logic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // RemoteWriteTimeseriesSent counts the number of timeseries sent. RemoteWriteTimeseriesSent = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "remote_write_timeseries_total", Help: "Total number of timeseries attempted to be sent to remote write endpoint", }, []string{"endpoint"}, ) // RemoteWriteRequestDuration measures the duration of requests to remote write endpoint. RemoteWriteRequestDuration = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Name: "remote_write_request_duration_seconds", Help: "Histogram of request durations to remote write endpoint", Buckets: prometheus.DefBuckets, }, []string{"endpoint"}, ) // RemoteWriteResponseCodes counts the response codes returned by remote write endpoint. RemoteWriteResponseCodes = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "remote_write_response_codes_total", Help: "Count of response codes from remote write endpoint", }, []string{"endpoint", "status_code"}, ) // RemoteWritePayloadSizeBytes measures the payload size of requests in bytes. RemoteWritePayloadSizeBytes = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Name: "remote_write_payload_size_bytes", Help: "Size of payloads sent to remote write endpoint in bytes", Buckets: prometheus.ExponentialBuckets(256, 2, 10), }, []string{"endpoint"}, ) // RemoteWriteFailures counts how many times the remote write fails. RemoteWriteFailures = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "remote_write_failures_total", Help: "Total number of failed attempts to write metrics to the remote endpoint", }, []string{"endpoint"}, ) // RemoteWriteBacklog tracks how many records are waiting to be sent to the remote write endpoint. RemoteWriteBacklog = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Name: "remote_write_backlog_records", Help: "Number of records that are currently waiting to be sent to the remote write endpoint", }, []string{"endpoint"}, ) // Tracks how many records have been successfully updated in the database after sending RemoteWriteRecordsProcessed = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "remote_write_records_processed_total", Help: "Total number of records successfully processed (sent and marked as sent_at)", }, []string{"endpoint"}, ) // Tracks how many times updating sent_at in the database fails RemoteWriteDBFailures = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "remote_write_db_failures_total", Help: "Total number of failures when updating sent_at for records in the database", }, []string{"endpoint"}, ) )
-------------------- Prometheus Metrics --------------------
Functions ¶
Types ¶
type MetricsPusher ¶
type MetricsPusher struct {
// contains filtered or unexported fields
}
MetricsPusher is a runnable that periodically flushes metrics to a remote write endpoint.
func (*MetricsPusher) Flush ¶
func (h *MetricsPusher) Flush() error
func (*MetricsPusher) IsRunning ¶
func (h *MetricsPusher) IsRunning() bool
func (*MetricsPusher) ResetStats ¶
func (h *MetricsPusher) ResetStats()
func (*MetricsPusher) Run ¶
func (h *MetricsPusher) Run() error
func (*MetricsPusher) Shutdown ¶
func (h *MetricsPusher) Shutdown() error
Click to show internal directories.
Click to hide internal directories.