Skip to content

Commit

Permalink
Merge pull request etcd-io#7376 from heyitsanthony/fix-example-metric…
Browse files Browse the repository at this point in the history
…s-port

clientv3: use any port for metrics example
  • Loading branch information
Anthony Romano authored Feb 25, 2017
2 parents 15d8ca7 + c231950 commit 01557eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clientv3/example_metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func ExampleMetrics_range() {
cli.Get(context.TODO(), "test_key")

// listen for all prometheus metrics
ln, err := net.Listen("tcp", ":47989")
ln, err := net.Listen("tcp", ":0")
if err != nil {
log.Fatal(err)
}
Expand All @@ -62,7 +62,7 @@ func ExampleMetrics_range() {
}()

// make an http request to fetch all prometheus metrics
url := "http://localhost:47989/metrics"
url := "http://" + ln.Addr().String() + "/metrics"
resp, err := http.Get(url)
if err != nil {
log.Fatalf("fetch error: %v", err)
Expand Down

0 comments on commit 01557eb

Please sign in to comment.