diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-09-17 06:56:15 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-09-17 06:56:15 -0700 |
| commit | 6544e60bea3c9612cbb382f6dfd284c3c4f65d76 (patch) | |
| tree | 99ba778940d8a118f36161f6ff07b0ef8107f46b | |
| parent | cb427d48fa42241b9396fa850e4bf02ecddc21ed (diff) | |
| download | seaweedfs-6544e60bea3c9612cbb382f6dfd284c3c4f65d76.tar.xz seaweedfs-6544e60bea3c9612cbb382f6dfd284c3c4f65d76.zip | |
s3 add metrics
empty for now
| -rw-r--r-- | weed/command/s3.go | 9 | ||||
| -rw-r--r-- | weed/stats/metrics.go | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/weed/command/s3.go b/weed/command/s3.go index 92f13673c..b944c9bcf 100644 --- a/weed/command/s3.go +++ b/weed/command/s3.go @@ -14,6 +14,7 @@ import ( "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/s3api" + stats_collect "github.com/chrislusf/seaweedfs/weed/stats" "github.com/chrislusf/seaweedfs/weed/util" ) @@ -128,6 +129,10 @@ func (s3opt *S3Options) startS3Server() bool { grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") + // metrics read from the filer + var metricsAddress string + var metricsIntervalSec int + for { err = pb.WithGrpcFilerClient(filerGrpcAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error { resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{}) @@ -135,6 +140,7 @@ func (s3opt *S3Options) startS3Server() bool { return fmt.Errorf("get filer %s configuration: %v", filerGrpcAddress, err) } filerBucketsPath = resp.DirBuckets + metricsAddress, metricsIntervalSec = resp.MetricsAddress, int(resp.MetricsIntervalSec) glog.V(0).Infof("S3 read filer buckets dir: %s", filerBucketsPath) return nil }) @@ -146,6 +152,9 @@ func (s3opt *S3Options) startS3Server() bool { break } } + if metricsAddress != "" && metricsIntervalSec > 0 { + go stats_collect.LoopPushingMetric("s3", stats_collect.SourceName(uint32(*s3opt.port)), stats_collect.S3Gather, metricsAddress, metricsIntervalSec) + } router := mux.NewRouter().SkipClean(true) diff --git a/weed/stats/metrics.go b/weed/stats/metrics.go index f3824728e..fc47cebb0 100644 --- a/weed/stats/metrics.go +++ b/weed/stats/metrics.go @@ -15,6 +15,7 @@ import ( var ( FilerGather = prometheus.NewRegistry() VolumeServerGather = prometheus.NewRegistry() + S3Gather = prometheus.NewRegistry() FilerRequestCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ |
