Documentation ¶
Index ¶
Constants ¶
const ( // DefaultTimeout is the length of time servicing the metrics before canceling. DefaultTimeout = 10 * time.Second // DefaultMaxBytes is the largest request body read. DefaultMaxBytes = 1024000 )
Variables ¶
var ( // ErrMetricsTimestampPresent is returned when the prometheus metrics has timestamps set. // Not sure why, but, pushgateway does not allow timestamps. ErrMetricsTimestampPresent = fmt.Errorf("pushed metrics must not have timestamp") )
Functions ¶
This section is empty.
Types ¶
type AddTimestamps ¶
type AddTimestamps struct {
// contains filtered or unexported fields
}
AddTimestamps enriches prometheus metrics by adding timestamps.
func (*AddTimestamps) Transform ¶
func (a *AddTimestamps) Transform(mfs []*dto.MetricFamily) []*dto.MetricFamily
Transform adds now as a timestamp to all metrics.
type LogStore ¶
type LogStore struct {
// contains filtered or unexported fields
}
LogStore logs data written to the store.
func NewLogStore ¶
type PushGateway ¶
type PushGateway struct { Timeout time.Duration // handler returns after this duration with an error; defaults to 5 seconds MaxBytes int64 // maximum number of bytes to read from the body; defaults to 1024000 Store Store Transformers []prometheus.Transformer Encoder prometheus.Encoder // contains filtered or unexported fields }
PushGateway handles receiving prometheus push metrics and forwards them to the Store. If Format is not set, the format of the inbound metrics are used.
func NewPushGateway ¶
func NewPushGateway(log *zap.Logger, store Store, xforms ...prometheus.Transformer) *PushGateway
NewPushGateway constructs the PushGateway.
func (*PushGateway) Handler ¶
func (p *PushGateway) Handler(w http.ResponseWriter, r *http.Request)
Handler accepts prometheus metrics send via the Push client and sends those metrics into the store.
type Pusher ¶
type Pusher struct { URL string Gather prometheus.Gatherer Client *http.Client PushFormat expfmt.Format }
Pusher pushes metrics to a prometheus push gateway.
func NewPusher ¶
func NewPusher(g prometheus.Gatherer) *Pusher
NewPusher sends usage metrics to a prometheus push gateway.
type Reporter ¶
type Reporter struct { Pusher *Pusher Interval time.Duration // contains filtered or unexported fields }
Reporter reports telemetry metrics to a prometheus push gateway every interval.
func NewReporter ¶
func NewReporter(log *zap.Logger, g prometheus.Gatherer) *Reporter
NewReporter reports telemetry every 24 hours.