Add bucket and object count along with total object size (#8639)

This commit is contained in:
Ashish Kumar Sinha 2019-12-12 23:28:33 +05:30 committed by Harshavardhana
parent c364f0af6c
commit abc266caa1
2 changed files with 15 additions and 10 deletions

View File

@ -1307,12 +1307,20 @@ func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Reque
return
}
infoMsg := madmin.InfoMessage{}
vault := madmin.Vault{}
if GlobalKMS != nil {
vault = fetchVaultStatus(cfg)
buckets := madmin.Buckets{}
objects := madmin.Objects{}
usage := madmin.Usage{}
dataUsageInfo, err := loadDataUsageFromBackend(ctx, objectAPI)
if err == nil {
buckets = madmin.Buckets{Count: dataUsageInfo.BucketsCount}
objects = madmin.Objects{Count: dataUsageInfo.ObjectsCount}
usage = madmin.Usage{Size: dataUsageInfo.ObjectsTotalSize}
}
infoMsg := madmin.InfoMessage{}
vault := fetchVaultStatus(cfg)
ldap := madmin.LDAP{}
if globalLDAPConfig.Enabled {
ldapConn, err := globalLDAPConfig.Connect()
@ -1407,9 +1415,6 @@ func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Reque
}
domain := globalDomainNames
buckets := madmin.Buckets{}
objects := madmin.Objects{}
usage := madmin.Usage{}
services := madmin.Services{
Vault: vault,
LDAP: ldap,
@ -1446,7 +1451,7 @@ func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Reque
func fetchLambdaInfo(cfg config.Config) []map[string][]madmin.TargetIDStatus {
lambdaMap := make(map[string][]madmin.TargetIDStatus)
targetList, _ := notify.GetNotificationTargets(cfg, GlobalServiceDoneCh, globalRootCAs)
targetList, _ := notify.GetNotificationTargets(cfg, GlobalServiceDoneCh, NewCustomHTTPTransport())
for targetID, target := range targetList.TargetMap() {
targetIDStatus := make(map[string]madmin.Status)

View File

@ -408,12 +408,12 @@ type Services struct {
// Buckets contains the number of buckets
type Buckets struct {
Count int `json:"count,omitempty"`
Count uint64 `json:"count,omitempty"`
}
// Objects contains the number of objects
type Objects struct {
Count int `json:"count,omitempty"`
Count uint64 `json:"count,omitempty"`
}
// Usage contains the tottal size used