Skip to content

Commit

Permalink
fix(s3stream/wal): record metrics on WAL full (#1968)
Browse files Browse the repository at this point in the history
Signed-off-by: Ning Yu <[email protected]>
  • Loading branch information
Chillax-0v0 authored Aug 30, 2024
1 parent 6259864 commit 98b23b4
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,15 @@ public WALMetadata metadata() {
public AppendResult append(TraceContext context, ByteBuf buf, int crc) throws OverCapacityException {
// get current method name
TraceContext.Scope scope = TraceUtils.createAndStartSpan(context, "BlockWALService::append");
final long startTime = System.nanoTime();
try {
AppendResult result = append0(buf, crc);
result.future().whenComplete((nil, ex) -> TraceUtils.endSpan(scope, ex));
return result;
} catch (Throwable t) {
if (t instanceof OverCapacityException) {
StorageOperationStats.getInstance().appendWALFullStats.record(TimerUtil.timeElapsedSince(startTime, TimeUnit.NANOSECONDS));
}
buf.release();
TraceUtils.endSpan(scope, t);
throw t;
Expand Down

0 comments on commit 98b23b4

Please sign in to comment.