()
| 21 | ) |
| 22 | |
| 23 | func 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 | } |