Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 593cc9a

Browse files
committed
Request to move from prometheus http (deprecated) to the promhttp
fixes go-kit#491
1 parent ab50580 commit 593cc9a

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

‎examples/addsvc/cmd/addsvc/main.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
stdopentracing "github.com/opentracing/opentracing-go"
1818
zipkin "github.com/openzipkin/zipkin-go-opentracing"
1919
stdprometheus "github.com/prometheus/client_golang/prometheus"
20+
"github.com/prometheus/client_golang/prometheus/promhttp"
2021
"google.golang.org/grpc"
2122
"sourcegraph.com/sourcegraph/appdash"
2223
appdashot "sourcegraph.com/sourcegraph/appdash/opentracing"
@@ -198,7 +199,7 @@ func main() {
198199
m.Handle("/debug/pprof/profile", http.HandlerFunc(pprof.Profile))
199200
m.Handle("/debug/pprof/symbol", http.HandlerFunc(pprof.Symbol))
200201
m.Handle("/debug/pprof/trace", http.HandlerFunc(pprof.Trace))
201-
m.Handle("/metrics", stdprometheus.Handler())
202+
m.Handle("/metrics", promhttp.Handler())
202203

203204
logger.Log("addr", *debugAddr)
204205
errc <- http.ListenAndServe(*debugAddr, m)

‎examples/shipping/main.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"time"
1313

1414
stdprometheus "github.com/prometheus/client_golang/prometheus"
15+
"github.com/prometheus/client_golang/prometheus/promhttp"
1516

1617
"github.com/go-kit/kit/log"
1718
kitprometheus "github.com/go-kit/kit/metrics/prometheus"
@@ -142,7 +143,7 @@ func main() {
142143
mux.Handle("/handling/v1/", handling.MakeHandler(hs, httpLogger))
143144

144145
http.Handle("/", accessControl(mux))
145-
http.Handle("/metrics", stdprometheus.Handler())
146+
http.Handle("/metrics", promhttp.Handler())
146147

147148
errs := make(chan error, 2)
148149
go func() {

‎examples/stringsvc2/main.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"os"
66

77
stdprometheus "github.com/prometheus/client_golang/prometheus"
8+
"github.com/prometheus/client_golang/prometheus/promhttp"
89

910
"github.com/go-kit/kit/log"
1011
kitprometheus "github.com/go-kit/kit/metrics/prometheus"
@@ -53,7 +54,7 @@ func main() {
5354

5455
http.Handle("/uppercase", uppercaseHandler)
5556
http.Handle("/count", countHandler)
56-
http.Handle("/metrics", stdprometheus.Handler())
57+
http.Handle("/metrics", promhttp.Handler())
5758
logger.Log("msg", "HTTP", "addr", ":8080")
5859
logger.Log("err", http.ListenAndServe(":8080", nil))
5960
}

‎examples/stringsvc3/main.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os"
88

99
stdprometheus "github.com/prometheus/client_golang/prometheus"
10+
"github.com/prometheus/client_golang/prometheus/promhttp"
1011

1112
"github.com/go-kit/kit/log"
1213
kitprometheus "github.com/go-kit/kit/metrics/prometheus"
@@ -63,7 +64,7 @@ func main() {
6364

6465
http.Handle("/uppercase", uppercaseHandler)
6566
http.Handle("/count", countHandler)
66-
http.Handle("/metrics", stdprometheus.Handler())
67+
http.Handle("/metrics", promhttp.Handler())
6768
logger.Log("msg", "HTTP", "addr", *listen)
6869
logger.Log("err", http.ListenAndServe(*listen, nil))
6970
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /