Skip to content

Commit

Permalink
enhance: memory value are displayed in MB (milvus-io#35292)
Browse files Browse the repository at this point in the history
Signed-off-by: lixinguo <[email protected]>
Co-authored-by: lixinguo <[email protected]>
  • Loading branch information
smellthemoon and lixinguo authored Aug 9, 2024
1 parent e1d725b commit c4a240a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pkg/util/merr/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, "->"))
Expand Down Expand Up @@ -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, "->"))
Expand Down

0 comments on commit c4a240a

Please sign in to comment.