push

package module
v0.0.0-...-21a2a3f Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

README

prometheus-remote-write

You can use like github.com/prometheus/client_golang/prometheus/push to push any gatherers to any prometheus like storage. Use AddLable function to add extra label.

Summery and Histogram only report sum and count.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPDoer

type HTTPDoer interface {
	Do(*http.Request) (*http.Response, error)
}

type Pusher

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

func New

func New() *Pusher

func (*Pusher) Add

func (p *Pusher) Add(url string) error

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) AddLocal

func (p *Pusher) AddLocal(url string) error

AddLocal add local snappy buffer to given url

func (*Pusher) BasicAuth

func (p *Pusher) BasicAuth(username, password string) *Pusher

func (*Pusher) Collect

func (p *Pusher) Collect() error

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

func (p *Pusher) ExtraLabel(key, values string) *Pusher

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) Format

func (p *Pusher) Format(format expfmt.Format) *Pusher

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

func (p *Pusher) Push(url string) error

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.

func (*Pusher) PushLocal

func (p *Pusher) PushLocal(url string) error

PushLocal push local snappy buffer to given url

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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