satellite/metainfo: Log in warn level limits exceeds

Don't log as an Error when users make request that cannot be fulfilled
because they exceed their storage or bandwidth limits.

Those are not system errors and the service is handling them correctly
and showing them in the logs an "ERROR" is misleading.

Change-Id: Iac642b7e8ba92840bb943192ad0694b5f4930258
This commit is contained in:
Ivan Fraixedes 2021-11-11 13:50:14 +01:00 committed by Ivan Fraixedes
parent 44b1ca6b97
commit 6dffbd4173

View File

@ -899,7 +899,7 @@ func (endpoint *Endpoint) DownloadObject(ctx context.Context, req *pb.ObjectDown
if exceeded, limit, err := endpoint.projectUsage.ExceedsBandwidthUsage(ctx, keyInfo.ProjectID); err != nil {
endpoint.log.Error("Retrieving project bandwidth total failed; bandwidth limit won't be enforced", zap.Error(err))
} else if exceeded {
endpoint.log.Error("Monthly bandwidth limit exceeded",
endpoint.log.Warn("Monthly bandwidth limit exceeded",
zap.Stringer("Limit", limit),
zap.Stringer("Project ID", keyInfo.ProjectID),
)
@ -2119,7 +2119,7 @@ func (endpoint *Endpoint) DownloadSegment(ctx context.Context, req *pb.SegmentDo
if exceeded, limit, err := endpoint.projectUsage.ExceedsBandwidthUsage(ctx, keyInfo.ProjectID); err != nil {
endpoint.log.Error("Retrieving project bandwidth total failed; bandwidth limit won't be enforced", zap.Error(err))
} else if exceeded {
endpoint.log.Error("Monthly bandwidth limit exceeded",
endpoint.log.Warn("Monthly bandwidth limit exceeded",
zap.Stringer("Limit", limit),
zap.Stringer("Project ID", keyInfo.ProjectID),
)
@ -2678,7 +2678,7 @@ func (endpoint *Endpoint) checkExceedsStorageUsage(ctx context.Context, projectI
zap.Error(err),
)
} else if exceeded {
endpoint.log.Error("Monthly storage limit exceeded",
endpoint.log.Warn("Monthly storage limit exceeded",
zap.Stringer("Limit", limit),
zap.Stringer("Project ID", projectID),
)