Skip to content

Commit 2b0802c

Browse files
committed
Add port to doorman_shell.
1 parent a2af521 commit 2b0802c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

go/cmd/doorman_shell/doorman_shell.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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

3840
var (
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

0 commit comments

Comments
 (0)