Skip to content

Commit fe8d1e1

Browse files
authored
Merge pull request #1000 from alissa-tung/patch-1
Fix deprecated `NewBuildInfoCollector` API
2 parents 6c18569 + ffd6362 commit fe8d1e1

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Dockerfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
# This Dockerfile builds an image for a client_golang example.
22
#
33
# Use as (from the root for the client_golang repository):
4-
# docker build -f examples/$name/Dockerfile -t prometheus/golang-example-$name .
4+
# docker build -f Dockerfile -t prometheus/golang-example .
5+
6+
# Run as
7+
# docker run -P prometheus/golang-example /random
8+
# or
9+
# docker run -P prometheus/golang-example /simple
10+
11+
# Test as
12+
# curl $ip:$port/metrics
513

614
# Builder image, where we build the example.
715
FROM golang:1 AS builder

examples/random/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"time"
2727

2828
"github.com/prometheus/client_golang/prometheus"
29+
"github.com/prometheus/client_golang/prometheus/collectors"
2930
"github.com/prometheus/client_golang/prometheus/promhttp"
3031
)
3132

@@ -67,7 +68,7 @@ func main() {
6768
prometheus.MustRegister(rpcDurations)
6869
prometheus.MustRegister(rpcDurationsHistogram)
6970
// Add Go module build info.
70-
prometheus.MustRegister(prometheus.NewBuildInfoCollector())
71+
prometheus.MustRegister(collectors.NewBuildInfoCollector())
7172

7273
start := time.Now()
7374

0 commit comments

Comments
 (0)