enhance: memory value are displayed in MB (#35292)

Signed-off-by: lixinguo <xinguo.li@zilliz.com>
Co-authored-by: lixinguo <xinguo.li@zilliz.com>
pull/35402/head
smellthemoon 2024-08-09 14:14:25 +08:00 committed by GitHub
parent e1d725b938
commit c4a240acb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 4 deletions

View File

@ -360,9 +360,12 @@ func WrapErrServiceUnavailable(reason string, msg ...string) error {
}
func WrapErrServiceMemoryLimitExceeded(predict, limit float32, msg ...string) error {
toMB := func(mem float32) float32 {
return mem / 1024 / 1024
}
err := wrapFields(ErrServiceMemoryLimitExceeded,
value("predict", predict),
value("limit", limit),
value("predict(MB)", toMB(predict)),
value("limit(MB)", toMB(limit)),
)
if len(msg) > 0 {
err = errors.Wrap(err, strings.Join(msg, "->"))
@ -400,9 +403,12 @@ func WrapErrServiceCrossClusterRouting(expectedCluster, actualCluster string, ms
}
func WrapErrServiceDiskLimitExceeded(predict, limit float32, msg ...string) error {
toMB := func(mem float32) float32 {
return mem / 1024 / 1024
}
err := wrapFields(ErrServiceDiskLimitExceeded,
value("predict", predict),
value("limit", limit),
value("predict(MB)", toMB(predict)),
value("limit(MB)", toMB(limit)),
)
if len(msg) > 0 {
err = errors.Wrap(err, strings.Join(msg, "->"))