Skip to content

Commit 4cbb1ed

Browse files
mniewrzalStorj Robot
authored andcommitted
satellite/orders: log bandwidth values we are dropping
When we have problem with inserting bandwidth amounts into cache or DB we are logging information about it but log entries are not very detailed. This change adds bandwidth amounts to the log entry. #5470 Change-Id: I55ccad837d17b141501d3def1dec7ad5f3acdb0b
1 parent 8d69837 commit 4cbb1ed

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

satellite/orders/rollups_write_cache.go

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,18 @@ func (cache *RollupsWriteCache) flush(ctx context.Context, pendingRollups Rollup
147147
err := cache.DB.UpdateBandwidthBatch(ctx, rollups)
148148
if err != nil {
149149
mon.Event("rollups_write_cache_flush_lost")
150-
cache.log.Error("MONEY LOST! Bucket bandwidth rollup batch flush failed", zap.Error(err))
150+
151+
// With error log only GET bandwidth because it's what we care most as we charge users for this.
152+
var settled int64
153+
var inline int64
154+
for _, rollup := range rollups {
155+
if rollup.Action == pb.PieceAction_GET {
156+
settled += rollup.Settled
157+
inline += rollup.Inline
158+
}
159+
}
160+
161+
cache.log.Error("MONEY LOST! Bucket bandwidth rollup batch flush failed", zap.Int64("settled", settled), zap.Int64("inline", inline), zap.Error(err))
151162
}
152163
}
153164

@@ -176,12 +187,18 @@ func (cache *RollupsWriteCache) updateCacheValue(ctx context.Context, projectID
176187
IntervalStart: time.Date(intervalStart.Year(), intervalStart.Month(), intervalStart.Day(), intervalStart.Hour(), 0, 0, 0, intervalStart.Location()).Unix(),
177188
}
178189

179-
// pevent unbounded memory memory growth if we're not flushing fast enough
190+
// prevent unbounded memory growth if we're not flushing fast enough
180191
// to keep up with incoming writes.
181192
data, ok := cache.pendingRollups[key]
182193
if !ok && len(cache.pendingRollups) >= cache.batchSize {
183194
mon.Event("rollups_write_cache_update_lost")
184-
cache.log.Error("MONEY LOST! Flushing too slow to keep up with demand")
195+
cache.log.Error("MONEY LOST! Flushing too slow to keep up with demand",
196+
zap.Stringer("ProjectID", projectID),
197+
zap.Stringer("Action", action),
198+
zap.Int64("Allocated", allocated),
199+
zap.Int64("Inline", inline),
200+
zap.Int64("Settled", settled),
201+
)
185202
} else {
186203

187204
data.Allocated += allocated

0 commit comments

Comments
 (0)