Documentation ¶
Index ¶
- type HTTPDoer
- type Pusher
- func (p *Pusher) Add(url string) error
- func (p *Pusher) AddLocal(url string) error
- func (p *Pusher) BasicAuth(username, password string) *Pusher
- func (p *Pusher) Collect() error
- func (p *Pusher) Collector(c prometheus.Collector) *Pusher
- func (p *Pusher) ExtraLabel(key, values string) *Pusher
- func (p *Pusher) Format(format expfmt.Format) *Pusher
- func (p *Pusher) Gatherer(g prometheus.Gatherer) *Pusher
- func (p *Pusher) Push(url string) error
- func (p *Pusher) PushLocal(url string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pusher ¶
type Pusher struct {
// contains filtered or unexported fields
}
func (*Pusher) Add ¶
Add works like push, but only previously pushed metrics with the same name (and the same job and other grouping labels) will be replaced. (It uses HTTP method “POST” to push to the Pushgateway.)
func (*Pusher) Collect ¶
Collect will generate a prompb.WriteRequest with snappy compress and save in memory, use PushLocal or AddLocal to write same.
func (*Pusher) Collector ¶
func (p *Pusher) Collector(c prometheus.Collector) *Pusher
Collector adds a Collector to the Pusher, from which metrics will be collected to push them to the Pushgateway. The collected metrics must not contain a job label of their own.
For convenience, this method returns a pointer to the Pusher itself.
func (*Pusher) ExtraLabel ¶
ExtraLabel adds more label to Pusher, for add extra label when push to storage.
For convenience, this method returns a pointer to the Pusher itself.
func (*Pusher) Gatherer ¶
func (p *Pusher) Gatherer(g prometheus.Gatherer) *Pusher
Gatherer adds a Gatherer to the Pusher, from which metrics will be gathered to push them to the Pushgateway. The gathered metrics must not contain a job label of their own.
For convenience, this method returns a pointer to the Pusher itself.
func (*Pusher) Push ¶
Push collects/gathers all metrics from all Collectors and Gatherers added to this Pusher. Then, it pushes them to the Pushgateway configured while creating this Pusher, using the configured job name and any added grouping labels as grouping key. All previously pushed metrics with the same job and other grouping labels will be replaced with the metrics pushed by this call. (It uses HTTP method “PUT” to push to the Pushgateway.)
Push returns the first error encountered by any method call (including this one) in the lifetime of the Pusher.