MCPcopy
hub / github.com/prometheus/client_golang / ExamplePusher_Push

Function ExamplePusher_Push

prometheus/push/examples_test.go:23–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21)
22
23func ExamplePusher_Push() {
24 completionTime := prometheus.NewGauge(prometheus.GaugeOpts{
25 Name: "db_backup_last_completion_timestamp_seconds",
26 Help: "The timestamp of the last successful completion of a DB backup.",
27 })
28 completionTime.SetToCurrentTime()
29 if err := push.New("http://pushgateway:9091", "db_backup").
30 Collector(completionTime).
31 Grouping("db", "customers").
32 Push(); err != nil {
33 fmt.Println("Could not push completion time to Pushgateway:", err)
34 }
35}

Callers

nothing calls this directly

Calls 7

SetToCurrentTimeMethod · 0.95
NewGaugeFunction · 0.92
NewFunction · 0.92
GroupingMethod · 0.80
CollectorMethod · 0.80
PrintlnMethod · 0.65
PushMethod · 0.45

Tested by

no test coverage detected