From dcb02dd7e6143c4e6128d92e0466c8f83f27d67c Mon Sep 17 00:00:00 2001 From: Bastien Caudan Date: Tue, 25 Oct 2022 11:45:52 +0200 Subject: [PATCH 1/2] Add debug log when no payload to retry --- packages/core/src/transport/sendWithRetryStrategy.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/core/src/transport/sendWithRetryStrategy.ts b/packages/core/src/transport/sendWithRetryStrategy.ts index 8f40c3160c..0cfaa9d06f 100644 --- a/packages/core/src/transport/sendWithRetryStrategy.ts +++ b/packages/core/src/transport/sendWithRetryStrategy.ts @@ -71,6 +71,18 @@ function scheduleRetry( setTimeout( monitor(() => { const payload = state.queuedPayloads.first() + if (!payload) { + addTelemetryDebug('no payload to retry', { + debug: { + queue: { + size: state.queuedPayloads.size(), + is_full: state.queuedPayloads.isFull(), + bytes_count: state.queuedPayloads.bytesCount, + }, + transport_status: state.transportStatus, + }, + }) + } send(payload, state, sendStrategy, { onSuccess: () => { state.queuedPayloads.dequeue() From 81caf70d863737878cef8539c042715882e13df5 Mon Sep 17 00:00:00 2001 From: Bastien Caudan Date: Tue, 25 Oct 2022 11:48:40 +0200 Subject: [PATCH 2/2] Remove 'resume after transport down' debug log --- packages/core/src/transport/sendWithRetryStrategy.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/packages/core/src/transport/sendWithRetryStrategy.ts b/packages/core/src/transport/sendWithRetryStrategy.ts index 0cfaa9d06f..ef02aebbc7 100644 --- a/packages/core/src/transport/sendWithRetryStrategy.ts +++ b/packages/core/src/transport/sendWithRetryStrategy.ts @@ -26,7 +26,6 @@ const enum RetryReason { export interface RetryState { transportStatus: TransportStatus - lastFailureStatus: number currentBackoffTime: number bandwidthMonitor: ReturnType queuedPayloads: ReturnType @@ -86,11 +85,6 @@ function scheduleRetry( send(payload, state, sendStrategy, { onSuccess: () => { state.queuedPayloads.dequeue() - if (state.lastFailureStatus !== 0) { - addTelemetryDebug('resuming after transport down', { - failureStatus: state.lastFailureStatus, - }) - } state.currentBackoffTime = INITIAL_BACKOFF_TIME retryQueuedPayloads(RetryReason.AFTER_RESUME, state, sendStrategy, endpointType, reportError) }, @@ -120,7 +114,6 @@ function send( // do not consider transport down if another ongoing request could succeed state.transportStatus = state.bandwidthMonitor.ongoingRequestCount > 0 ? TransportStatus.FAILURE_DETECTED : TransportStatus.DOWN - state.lastFailureStatus = response.status onFailure() } }) @@ -155,7 +148,6 @@ function shouldRetryRequest(response: HttpResponse) { export function newRetryState(): RetryState { return { transportStatus: TransportStatus.UP, - lastFailureStatus: 0, currentBackoffTime: INITIAL_BACKOFF_TIME, bandwidthMonitor: newBandwidthMonitor(), queuedPayloads: newPayloadQueue(),