blob: e08a69f04b999999d3ec72fe6f773e54f0b9b211 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package server
import (
"context"
"github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
)
func (s *server) DiskStatistics(ctx context.Context, _ *gitalypb.DiskStatisticsRequest) (*gitalypb.DiskStatisticsResponse, error) {
var results []*gitalypb.DiskStatisticsResponse_StorageStatus
for _, shard := range s.storages {
shardInfo, err := getStorageStatus(shard)
if err != nil {
ctxlogrus.Extract(ctx).WithField("storage", shard).WithError(err).Error("to retrieve shard disk statistics")
results = append(results, &gitalypb.DiskStatisticsResponse_StorageStatus{StorageName: shard.Name})
continue
}
results = append(results, shardInfo)
}
return &gitalypb.DiskStatisticsResponse{
StorageStatuses: results,
}, nil
}
|