Upgrade prometheus client to v1.x (#31)

Replace push.AddFromGatherer with push.New

Signed-off-by: lucklove <gnu.crazier@gmail.com>
This commit is contained in:
SIGSEGV 2019-08-22 20:59:24 +08:00 committed by disksing
parent 72c56e71aa
commit d9c03d0f44
1 changed files with 1 additions and 6 deletions

View File

@ -41,12 +41,7 @@ func PushMetrics(ctx context.Context, addr string, interval time.Duration, job,
case <-ticker.C:
}
err := push.AddFromGatherer(
job,
map[string]string{"instance": instance},
addr,
prometheus.DefaultGatherer,
)
err := push.New(addr, job).Grouping("instance", instance).Gatherer(prometheus.DefaultGatherer).Push()
if err != nil {
log.Errorf("cannot push metrics to prometheus pushgateway: %v", err)
}