s3 add metrics
empty for now
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
|||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||||
"github.com/chrislusf/seaweedfs/weed/s3api"
|
"github.com/chrislusf/seaweedfs/weed/s3api"
|
||||||
|
stats_collect "github.com/chrislusf/seaweedfs/weed/stats"
|
||||||
"github.com/chrislusf/seaweedfs/weed/util"
|
"github.com/chrislusf/seaweedfs/weed/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -128,6 +129,10 @@ func (s3opt *S3Options) startS3Server() bool {
|
|||||||
|
|
||||||
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client")
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client")
|
||||||
|
|
||||||
|
// metrics read from the filer
|
||||||
|
var metricsAddress string
|
||||||
|
var metricsIntervalSec int
|
||||||
|
|
||||||
for {
|
for {
|
||||||
err = pb.WithGrpcFilerClient(filerGrpcAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
|
err = pb.WithGrpcFilerClient(filerGrpcAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
|
||||||
resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})
|
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)
|
return fmt.Errorf("get filer %s configuration: %v", filerGrpcAddress, err)
|
||||||
}
|
}
|
||||||
filerBucketsPath = resp.DirBuckets
|
filerBucketsPath = resp.DirBuckets
|
||||||
|
metricsAddress, metricsIntervalSec = resp.MetricsAddress, int(resp.MetricsIntervalSec)
|
||||||
glog.V(0).Infof("S3 read filer buckets dir: %s", filerBucketsPath)
|
glog.V(0).Infof("S3 read filer buckets dir: %s", filerBucketsPath)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
@@ -146,6 +152,9 @@ func (s3opt *S3Options) startS3Server() bool {
|
|||||||
break
|
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)
|
router := mux.NewRouter().SkipClean(true)
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import (
|
|||||||
var (
|
var (
|
||||||
FilerGather = prometheus.NewRegistry()
|
FilerGather = prometheus.NewRegistry()
|
||||||
VolumeServerGather = prometheus.NewRegistry()
|
VolumeServerGather = prometheus.NewRegistry()
|
||||||
|
S3Gather = prometheus.NewRegistry()
|
||||||
|
|
||||||
FilerRequestCounter = prometheus.NewCounterVec(
|
FilerRequestCounter = prometheus.NewCounterVec(
|
||||||
prometheus.CounterOpts{
|
prometheus.CounterOpts{
|
||||||
|
|||||||
Reference in New Issue
Block a user