Skip to content

Commit

Permalink
support change metrics port, modify the default value to 9567 (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
chnliyong authored Apr 20, 2021
1 parent 3eff79f commit fd3ef91
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pkg/driver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"os"
"reflect"
"strconv"
"strings"

csi "github.com/container-storage-interface/spec/lib/go/csi"
Expand Down Expand Up @@ -56,8 +57,16 @@ func newNodeService(nodeID string) nodeService {
klog.V(4).Infof("Node: %s", stdoutStderr)

go func() {
klog.V(4).Info("Serve metrics on :9560")
jfsProvider.ServeMetrics(9560)
metricsPort := 9567
if v, ok := os.LookupEnv("JFS_METRICS_PORT"); ok {
if i, err := strconv.Atoi(v); err != nil || i <= 0 || i >= 65536 {
klog.V(4).Infof("Skip invalid JuiceFS metrics port %s", v)
} else {
metricsPort = i
}
}
klog.V(4).Infof("Serve metrics on :%d", metricsPort)
jfsProvider.ServeMetrics(metricsPort)
}()

return nodeService{
Expand Down

0 comments on commit fd3ef91

Please sign in to comment.