tianxiaoliang commented on a change in pull request #1080:
URL:
https://github.com/apache/servicecomb-service-center/pull/1080#discussion_r662117242
##########
File path: datasource/ms.go
##########
@@ -79,6 +79,7 @@ type MetadataManager interface {
BatchFind(ctx context.Context, request *pb.BatchFindInstancesRequest)
(*pb.BatchFindInstancesResponse, error)
// GetAllInstances returns instances under the specified domain
GetAllInstances(ctx context.Context, request
*pb.GetAllInstancesRequest) (*pb.GetAllInstancesResponse, error)
+ GetInstanceCountByDomainProject(ctx context.Context, request
*pb.GetServiceCountRequest) (*pb.GetServiceCountResponse, error)
Review comment:
就叫GetInstanceCount,以后有更多条件,都用options
##########
File path: server/plugin/quota/quota.go
##########
@@ -150,10 +149,29 @@ func GetResourceUsage(ctx context.Context, res
*ApplyQuotaResource) (int64, erro
serviceID := res.ServiceID
switch res.QuotaType {
case TypeService:
- return metrics.GetTotalService(util.ParseDomain(ctx), ""), nil
+ {
+ resp, err :=
datasource.GetMetadataManager().GetServiceCountByDomainProject(ctx,
+ &pb.GetServiceCountRequest{
+ Domain: util.ParseDomain(ctx),
+ Project: util.ParseProject(ctx),
+ })
+ if err != nil {
+ return 0, err
+ }
+ return resp.Count, nil
+ }
case TypeInstance:
- usage := metrics.GetTotalInstance(util.ParseDomain(ctx), "")
- return usage, nil
+ {
+ resp, err :=
datasource.GetMetadataManager().GetInstanceCountByDomainProject(ctx,
Review comment:
抽象个instancesvc.Getxxx
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]