The prometheus metrics refractoring (#8003)

The measures are consolidated to the following metrics

- `disk_storage_used` : Disk space used by the disk.
- `disk_storage_available`: Available disk space left on the disk.
- `disk_storage_total`: Total disk space on the disk.
- `disks_offline`: Total number of offline disks in current MinIO instance.
- `disks_total`: Total number of disks in current MinIO instance.
- `s3_requests_total`: Total number of s3 requests in current MinIO instance.
- `s3_errors_total`: Total number of errors in s3 requests in current MinIO instance.
- `s3_requests_current`: Total number of active s3 requests in current MinIO instance.
- `internode_rx_bytes_total`: Total number of internode bytes received by current MinIO server instance.
- `internode_tx_bytes_total`: Total number of bytes sent to the other nodes by current MinIO server instance.
- `s3_rx_bytes_total`: Total number of s3 bytes received by current MinIO server instance.
- `s3_tx_bytes_total`: Total number of s3 bytes sent by current MinIO server instance.
- `minio_version_info`: Current MinIO version with commit-id.
- `s3_ttfb_seconds_bucket`: Histogram that holds the latency information of the requests.

And this PR also modifies the current StorageInfo queries

- Decouples StorageInfo from ServerInfo .
- StorageInfo is enhanced to give endpoint information.

NOTE: ADMIN API VERSION IS BUMPED UP IN THIS PR

Fixes #7873
This commit is contained in:
Praveen raj Mani
2019-10-23 09:31:14 +05:30
committed by Harshavardhana
parent f01d53b20f
commit 8836d57e3c
49 changed files with 938 additions and 658 deletions

View File

@@ -59,11 +59,13 @@ type DriveInfo HealDriveInfo
// StorageInfo - represents total capacity of underlying storage.
type StorageInfo struct {
Used uint64 // Total used spaced per tenant.
Used []uint64 // Used total used per disk.
Available uint64 // Total available space.
Total []uint64 // Total disk space per disk.
Total uint64 // Total disk space.
Available []uint64 // Total disk space available per disk.
MountPaths []string // Disk mountpoints
// Backend type.
Backend struct {
@@ -71,18 +73,41 @@ type StorageInfo struct {
Type BackendType
// Following fields are only meaningful if BackendType is Erasure.
OnlineDisks int // Online disks during server startup.
OfflineDisks int // Offline disks during server startup.
StandardSCData int // Data disks for currently configured Standard storage class.
StandardSCParity int // Parity disks for currently configured Standard storage class.
RRSCData int // Data disks for currently configured Reduced Redundancy storage class.
RRSCParity int // Parity disks for currently configured Reduced Redundancy storage class.
OnlineDisks BackendDisks // Online disks during server startup.
OfflineDisks BackendDisks // Offline disks during server startup.
StandardSCData int // Data disks for currently configured Standard storage class.
StandardSCParity int // Parity disks for currently configured Standard storage class.
RRSCData int // Data disks for currently configured Reduced Redundancy storage class.
RRSCParity int // Parity disks for currently configured Reduced Redundancy storage class.
// List of all disk status, this is only meaningful if BackendType is Erasure.
Sets [][]DriveInfo
}
}
// BackendDisks - represents the map of endpoint-disks.
type BackendDisks map[string]int
// Sum - Return the sum of the disks in the endpoint-disk map.
func (d1 BackendDisks) Sum() (sum int) {
for _, count := range d1 {
sum += count
}
return sum
}
// Merge - Reduces two endpoint-disk maps.
func (d1 BackendDisks) Merge(d2 BackendDisks) BackendDisks {
for i1, v1 := range d1 {
if v2, ok := d2[i1]; ok {
d2[i1] = v2 + v1
continue
}
d2[i1] = v1
}
return d2
}
// ServerProperties holds some of the server's information such as uptime,
// version, region, ..
type ServerProperties struct {
@@ -141,7 +166,7 @@ type ServerInfo struct {
// ServerInfo - Connect to a minio server and call Server Info Management API
// to fetch server's information represented by ServerInfo structure
func (adm *AdminClient) ServerInfo() ([]ServerInfo, error) {
resp, err := adm.executeMethod("GET", requestData{relPath: "/v1/info"})
resp, err := adm.executeMethod("GET", requestData{relPath: adminAPIPrefix + "/info"})
defer closeResponse(resp)
if err != nil {
return nil, err
@@ -168,6 +193,36 @@ func (adm *AdminClient) ServerInfo() ([]ServerInfo, error) {
return serversInfo, nil
}
// StorageInfo - Connect to a minio server and call Storage Info Management API
// to fetch server's information represented by StorageInfo structure
func (adm *AdminClient) StorageInfo() (StorageInfo, error) {
resp, err := adm.executeMethod("GET", requestData{relPath: adminAPIPrefix + "/storageinfo"})
defer closeResponse(resp)
if err != nil {
return StorageInfo{}, err
}
// Check response http status code
if resp.StatusCode != http.StatusOK {
return StorageInfo{}, httpRespToErrorResponse(resp)
}
// Unmarshal the server's json response
var storageInfo StorageInfo
respBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
return StorageInfo{}, err
}
err = json.Unmarshal(respBytes, &storageInfo)
if err != nil {
return StorageInfo{}, err
}
return storageInfo, nil
}
// ServerDrivesPerfInfo holds informantion about address and write speed of
// all drives in a single server node
type ServerDrivesPerfInfo struct {
@@ -185,7 +240,7 @@ func (adm *AdminClient) ServerDrivesPerfInfo(size int64) ([]ServerDrivesPerfInfo
v.Set("size", strconv.FormatInt(size, 10))
resp, err := adm.executeMethod("GET", requestData{
relPath: "/v1/performance",
relPath: adminAPIPrefix + "/performance",
queryValues: v,
})
@@ -229,7 +284,7 @@ func (adm *AdminClient) ServerCPULoadInfo() ([]ServerCPULoadInfo, error) {
v := url.Values{}
v.Set("perfType", string("cpu"))
resp, err := adm.executeMethod("GET", requestData{
relPath: "/v1/performance",
relPath: adminAPIPrefix + "/performance",
queryValues: v,
})
@@ -273,7 +328,7 @@ func (adm *AdminClient) ServerMemUsageInfo() ([]ServerMemUsageInfo, error) {
v := url.Values{}
v.Set("perfType", string("mem"))
resp, err := adm.executeMethod("GET", requestData{
relPath: "/v1/performance",
relPath: adminAPIPrefix + "/performance",
queryValues: v,
})
@@ -318,7 +373,7 @@ func (adm *AdminClient) NetPerfInfo(size int) (map[string][]NetPerfInfo, error)
v.Set("size", strconv.Itoa(size))
}
resp, err := adm.executeMethod("GET", requestData{
relPath: "/v1/performance",
relPath: adminAPIPrefix + "/performance",
queryValues: v,
})