diff options
| author | Konstantin Lebedev <lebedev_k@tochka.com> | 2020-09-24 17:45:39 +0500 |
|---|---|---|
| committer | Konstantin Lebedev <lebedev_k@tochka.com> | 2020-09-24 17:45:39 +0500 |
| commit | 324e44d4b3dffc1197bf8f6c6ec49297ace44c2b (patch) | |
| tree | edf0b2b4d990e4085d58ab084270912fd9fb5e77 /weed/command/s3.go | |
| parent | 3e52329cee39f3a83f58d3896514547093ff0cf8 (diff) | |
| download | seaweedfs-324e44d4b3dffc1197bf8f6c6ec49297ace44c2b.tar.xz seaweedfs-324e44d4b3dffc1197bf8f6c6ec49297ace44c2b.zip | |
add start metrics server
Diffstat (limited to 'weed/command/s3.go')
| -rw-r--r-- | weed/command/s3.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/weed/command/s3.go b/weed/command/s3.go index a9b317138..3562dc765 100644 --- a/weed/command/s3.go +++ b/weed/command/s3.go @@ -23,12 +23,13 @@ var ( ) type S3Options struct { - filer *string - port *int - config *string - domainName *string - tlsPrivateKey *string - tlsCertificate *string + filer *string + port *int + config *string + domainName *string + tlsPrivateKey *string + tlsCertificate *string + metricsHttpPort *int } func init() { @@ -39,6 +40,7 @@ func init() { s3StandaloneOptions.config = cmdS3.Flag.String("config", "", "path to the config file") s3StandaloneOptions.tlsPrivateKey = cmdS3.Flag.String("key.file", "", "path to the TLS private key file") s3StandaloneOptions.tlsCertificate = cmdS3.Flag.String("cert.file", "", "path to the TLS certificate file") + s3StandaloneOptions.metricsHttpPort = cmdS3.Flag.Int("metricsPort", 0, "Prometheus metrics listen port") } var cmdS3 = &Command{ @@ -153,6 +155,7 @@ func (s3opt *S3Options) startS3Server() bool { } } + go stats_collect.StartMetricsServer(stats_collect.S3Gather, *s3opt.metricsHttpPort) go stats_collect.LoopPushingMetric("s3", stats_collect.SourceName(uint32(*s3opt.port)), stats_collect.S3Gather, metricsAddress, metricsIntervalSec) router := mux.NewRouter().SkipClean(true) @@ -169,7 +172,6 @@ func (s3opt *S3Options) startS3Server() bool { if s3ApiServer_err != nil { glog.Fatalf("S3 API Server startup error: %v", s3ApiServer_err) } - httpS := &http.Server{Handler: router} listenAddress := fmt.Sprintf(":%d", *s3opt.port) |
