summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/prometheus/client_golang/prometheus/push/examples_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/prometheus/client_golang/prometheus/push/examples_test.go')
-rw-r--r--vendor/github.com/prometheus/client_golang/prometheus/push/examples_test.go24
1 files changed, 2 insertions, 22 deletions
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/push/examples_test.go b/vendor/github.com/prometheus/client_golang/prometheus/push/examples_test.go
index 7f17ca291..7e0ac66a5 100644
--- a/vendor/github.com/prometheus/client_golang/prometheus/push/examples_test.go
+++ b/vendor/github.com/prometheus/client_golang/prometheus/push/examples_test.go
@@ -15,7 +15,6 @@ package push_test
import (
"fmt"
- "time"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/push"
@@ -24,9 +23,9 @@ import (
func ExampleCollectors() {
completionTime := prometheus.NewGauge(prometheus.GaugeOpts{
Name: "db_backup_last_completion_timestamp_seconds",
- Help: "The timestamp of the last succesful completion of a DB backup.",
+ Help: "The timestamp of the last successful completion of a DB backup.",
})
- completionTime.Set(float64(time.Now().Unix()))
+ completionTime.SetToCurrentTime()
if err := push.Collectors(
"db_backup", push.HostnameGroupingKey(),
"http://pushgateway:9091",
@@ -35,22 +34,3 @@ func ExampleCollectors() {
fmt.Println("Could not push completion time to Pushgateway:", err)
}
}
-
-func ExampleRegistry() {
- registry := prometheus.NewRegistry()
-
- completionTime := prometheus.NewGauge(prometheus.GaugeOpts{
- Name: "db_backup_last_completion_timestamp_seconds",
- Help: "The timestamp of the last succesful completion of a DB backup.",
- })
- registry.MustRegister(completionTime)
-
- completionTime.Set(float64(time.Now().Unix()))
- if err := push.FromGatherer(
- "db_backup", push.HostnameGroupingKey(),
- "http://pushgateway:9091",
- registry,
- ); err != nil {
- fmt.Println("Could not push completion time to Pushgateway:", err)
- }
-}