mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-21 22:47:24 +08:00
filer: adds basic metrics pushing to Prometheus gateway
This commit is contained in:
@@ -34,6 +34,8 @@ type FilerOptions struct {
|
||||
dataCenter *string
|
||||
enableNotification *bool
|
||||
disableHttp *bool
|
||||
metricsAddress *string
|
||||
metricsIntervalSec *int
|
||||
|
||||
// default leveldb directory, used in "weed server" mode
|
||||
defaultLevelDbDirectory *string
|
||||
@@ -53,6 +55,8 @@ func init() {
|
||||
f.dirListingLimit = cmdFiler.Flag.Int("dirListLimit", 100000, "limit sub dir listing size")
|
||||
f.dataCenter = cmdFiler.Flag.String("dataCenter", "", "prefer to write to volumes in this data center")
|
||||
f.disableHttp = cmdFiler.Flag.Bool("disableHttp", false, "disable http request, only gRpc operations are allowed")
|
||||
f.metricsAddress = cmdFiler.Flag.String("metrics.address", "", "Prometheus gateway address")
|
||||
f.metricsIntervalSec = cmdFiler.Flag.Int("metrics.intervalSeconds", 15, "Prometheus push interval in seconds")
|
||||
}
|
||||
|
||||
var cmdFiler = &Command{
|
||||
@@ -110,6 +114,8 @@ func (fo *FilerOptions) startFiler() {
|
||||
DataCenter: *fo.dataCenter,
|
||||
DefaultLevelDbDir: defaultLevelDbDirectory,
|
||||
DisableHttp: *fo.disableHttp,
|
||||
MetricsAddress: *fo.metricsAddress,
|
||||
MetricsIntervalSec: *fo.metricsIntervalSec,
|
||||
})
|
||||
if nfs_err != nil {
|
||||
glog.Fatalf("Filer startup error: %v", nfs_err)
|
||||
|
@@ -24,8 +24,10 @@ import (
|
||||
)
|
||||
|
||||
type ServerOptions struct {
|
||||
cpuprofile *string
|
||||
v VolumeServerOptions
|
||||
cpuprofile *string
|
||||
metricsAddress *string
|
||||
metricsIntervalSec *int
|
||||
v VolumeServerOptions
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -81,6 +83,8 @@ var (
|
||||
|
||||
func init() {
|
||||
serverOptions.cpuprofile = cmdServer.Flag.String("cpuprofile", "", "cpu profile output file")
|
||||
serverOptions.metricsAddress = cmdServer.Flag.String("metrics.address", "", "Prometheus gateway address")
|
||||
serverOptions.metricsIntervalSec = cmdServer.Flag.Int("metrics.intervalSeconds", 15, "Prometheus push interval in seconds")
|
||||
filerOptions.collection = cmdServer.Flag.String("filer.collection", "", "all data will be stored in this collection")
|
||||
filerOptions.port = cmdServer.Flag.Int("filer.port", 8888, "filer server http listen port")
|
||||
filerOptions.publicPort = cmdServer.Flag.Int("filer.port.public", 0, "filer server public http listen port")
|
||||
@@ -143,6 +147,9 @@ func runServer(cmd *Command, args []string) bool {
|
||||
filerOptions.dataCenter = serverDataCenter
|
||||
filerOptions.disableHttp = serverDisableHttp
|
||||
|
||||
filerOptions.metricsAddress = serverOptions.metricsAddress
|
||||
filerOptions.metricsIntervalSec = serverOptions.metricsIntervalSec
|
||||
|
||||
filerAddress := fmt.Sprintf("%s:%d", *serverIp, *filerOptions.port)
|
||||
s3Options.filer = &filerAddress
|
||||
|
||||
|
Reference in New Issue
Block a user