File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import (
2222 "flag"
2323 "fmt"
2424 "io"
25+ "net/http"
2526 "os"
2627 "sort"
2728 "strconv"
@@ -30,12 +31,14 @@ import (
3031 "github.com/chzyer/readline"
3132 log "github.com/golang/glog"
3233 "github.com/google/shlex"
34+ "github.com/prometheus/client_golang/prometheus"
3335 "github.com/youtube/doorman/go/client/doorman"
3436 "google.golang.org/grpc"
3537 "google.golang.org/grpc/credentials"
3638)
3739
3840var (
41+ port = flag .Int ("port" , 0 , "port to bind to" )
3942 server = flag .String ("server" , "" , "Address of the doorman server" )
4043 caFile = flag .String ("ca_file" , "" , "The file containning the CA root cert file to connect over TLS (otherwise plain TCP will be used)" )
4144)
@@ -253,6 +256,11 @@ func main() {
253256 os .Exit (1 )
254257 }
255258
259+ if * port != 0 {
260+ http .Handle ("/metrics" , prometheus .Handler ())
261+ go http .ListenAndServe (fmt .Sprintf (":%v" , * port ), nil )
262+ }
263+
256264 var opts []grpc.DialOption
257265 if len (* caFile ) != 0 {
258266 var creds credentials.TransportAuthenticator
You can’t perform that action at this time.
0 commit comments