Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔉[RUMF-1423] Add debug log for retry issue #1790

Merged
merged 2 commits into from
Oct 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions packages/core/src/transport/sendWithRetryStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const enum RetryReason {

export interface RetryState {
transportStatus: TransportStatus
lastFailureStatus: number
currentBackoffTime: number
bandwidthMonitor: ReturnType<typeof newBandwidthMonitor>
queuedPayloads: ReturnType<typeof newPayloadQueue>
Expand Down Expand Up @@ -71,14 +70,21 @@ 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()
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)
},
Expand Down Expand Up @@ -108,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()
}
})
Expand Down Expand Up @@ -143,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(),
Expand Down