mirror of
https://github.com/minio/minio.git
synced 2024-12-25 06:35:56 -05:00
trace: Publish storage layer errors (#16153)
This commit is contained in:
parent
641ab24aec
commit
c84e2939e4
@ -35,12 +35,13 @@ func _() {
|
|||||||
_ = x[storageMetricStatInfoFile-24]
|
_ = x[storageMetricStatInfoFile-24]
|
||||||
_ = x[storageMetricReadMultiple-25]
|
_ = x[storageMetricReadMultiple-25]
|
||||||
_ = x[storageMetricDeleteAbandonedParts-26]
|
_ = x[storageMetricDeleteAbandonedParts-26]
|
||||||
_ = x[storageMetricLast-27]
|
_ = x[storageMetricDiskInfo-27]
|
||||||
|
_ = x[storageMetricLast-28]
|
||||||
}
|
}
|
||||||
|
|
||||||
const _storageMetric_name = "MakeVolBulkMakeVolListVolsStatVolDeleteVolWalkDirListDirReadFileAppendFileCreateFileReadFileStreamRenameFileRenameDataCheckPartsDeleteDeleteVersionsVerifyFileWriteAllDeleteVersionWriteMetadataUpdateMetadataReadVersionReadXLReadAllStatInfoFileReadMultipleDeleteAbandonedPartsLast"
|
const _storageMetric_name = "MakeVolBulkMakeVolListVolsStatVolDeleteVolWalkDirListDirReadFileAppendFileCreateFileReadFileStreamRenameFileRenameDataCheckPartsDeleteDeleteVersionsVerifyFileWriteAllDeleteVersionWriteMetadataUpdateMetadataReadVersionReadXLReadAllStatInfoFileReadMultipleDeleteAbandonedPartsDiskInfoLast"
|
||||||
|
|
||||||
var _storageMetric_index = [...]uint16{0, 11, 18, 26, 33, 42, 49, 56, 64, 74, 84, 98, 108, 118, 128, 134, 148, 158, 166, 179, 192, 206, 217, 223, 230, 242, 254, 274, 278}
|
var _storageMetric_index = [...]uint16{0, 11, 18, 26, 33, 42, 49, 56, 64, 74, 84, 98, 108, 118, 128, 134, 148, 158, 166, 179, 192, 206, 217, 223, 230, 242, 254, 274, 282, 286}
|
||||||
|
|
||||||
func (i storageMetric) String() string {
|
func (i storageMetric) String() string {
|
||||||
if i >= storageMetric(len(_storageMetric_index)-1) {
|
if i >= storageMetric(len(_storageMetric_index)-1) {
|
||||||
|
@ -66,6 +66,7 @@ const (
|
|||||||
storageMetricStatInfoFile
|
storageMetricStatInfoFile
|
||||||
storageMetricReadMultiple
|
storageMetricReadMultiple
|
||||||
storageMetricDeleteAbandonedParts
|
storageMetricDeleteAbandonedParts
|
||||||
|
storageMetricDiskInfo
|
||||||
|
|
||||||
// .... add more
|
// .... add more
|
||||||
|
|
||||||
@ -226,6 +227,9 @@ func (p *xlStorageDiskIDCheck) DiskInfo(ctx context.Context) (info DiskInfo, err
|
|||||||
return DiskInfo{}, ctx.Err()
|
return DiskInfo{}, ctx.Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
si := p.updateStorageMetrics(storageMetricDiskInfo)
|
||||||
|
defer si(&err)
|
||||||
|
|
||||||
info, err = p.storage.DiskInfo(ctx)
|
info, err = p.storage.DiskInfo(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return info, err
|
return info, err
|
||||||
@ -539,7 +543,7 @@ func (p *xlStorageDiskIDCheck) CleanAbandonedData(ctx context.Context, volume st
|
|||||||
return p.storage.CleanAbandonedData(ctx, volume, path)
|
return p.storage.CleanAbandonedData(ctx, volume, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
func storageTrace(s storageMetric, startTime time.Time, duration time.Duration, path string) madmin.TraceInfo {
|
func storageTrace(s storageMetric, startTime time.Time, duration time.Duration, path string, err string) madmin.TraceInfo {
|
||||||
return madmin.TraceInfo{
|
return madmin.TraceInfo{
|
||||||
TraceType: madmin.TraceStorage,
|
TraceType: madmin.TraceStorage,
|
||||||
Time: startTime,
|
Time: startTime,
|
||||||
@ -547,6 +551,7 @@ func storageTrace(s storageMetric, startTime time.Time, duration time.Duration,
|
|||||||
FuncName: "storage." + s.String(),
|
FuncName: "storage." + s.String(),
|
||||||
Duration: duration,
|
Duration: duration,
|
||||||
Path: path,
|
Path: path,
|
||||||
|
Error: err,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -565,15 +570,19 @@ func scannerTrace(s scannerMetric, startTime time.Time, duration time.Duration,
|
|||||||
func (p *xlStorageDiskIDCheck) updateStorageMetrics(s storageMetric, paths ...string) func(err *error) {
|
func (p *xlStorageDiskIDCheck) updateStorageMetrics(s storageMetric, paths ...string) func(err *error) {
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
trace := globalTrace.NumSubscribers(madmin.TraceStorage) > 0
|
trace := globalTrace.NumSubscribers(madmin.TraceStorage) > 0
|
||||||
return func(err *error) {
|
return func(errp *error) {
|
||||||
duration := time.Since(startTime)
|
duration := time.Since(startTime)
|
||||||
|
|
||||||
atomic.AddUint64(&p.apiCalls[s], 1)
|
atomic.AddUint64(&p.apiCalls[s], 1)
|
||||||
p.apiLatencies[s].add(duration)
|
p.apiLatencies[s].add(duration)
|
||||||
|
|
||||||
paths = append([]string{p.String()}, paths...)
|
|
||||||
if trace {
|
if trace {
|
||||||
globalTrace.Publish(storageTrace(s, startTime, duration, strings.Join(paths, " ")))
|
var errStr string
|
||||||
|
if errp != nil && *errp != nil {
|
||||||
|
errStr = (*errp).Error()
|
||||||
|
}
|
||||||
|
paths = append([]string{p.String()}, paths...)
|
||||||
|
globalTrace.Publish(storageTrace(s, startTime, duration, strings.Join(paths, " "), errStr))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user