Skip to content

Commit

Permalink
Log grpc error to custom logger (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
xinlili-statsig authored Sep 16, 2024
1 parent 1e19505 commit 33d7d58
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/main/kotlin/com/statsig/sdk/ErrorBoundary.kt
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@ internal class ErrorBoundary(private val apiKey: String, private val options: St
throw ex
}

options.customLogger.warning("[Statsig]: An unexpected exception occurred: $ex")

logException(tag, ex, configName)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,12 @@ internal class GRPCWebsocketWorker(
streamingFallback?.startBackup(dcsFlowBacker)
}
if (shouldRetry) {
options.customLogger.warning("[Statsig]: grpcWebSocket: connection error: $throwable")
errorBoundary.logException("grpcWebSocket: connection error", throwable ?: Exception("connection closed"), bypassDedupe = true)
streamConfigSpecWithBackoff()
connected = false
} else {
options.customLogger.warning("failed to connect to forward proxy using gRPC streaming")
options.customLogger.warning("[Statsig]: grpcWebSocket: connection error: retry exhausted")
errorBoundary.logException(
"grpcWebSocket: retry exhausted",
Exception("Remaining retry is $remainingRetries, exception is ${throwable?.message}"),
Expand All @@ -162,6 +163,7 @@ internal class GRPCWebsocketWorker(
if (response.lastUpdated >= lastUpdateTime) {
lastUpdateTime = response.lastUpdated
if (!dcsFlowBacker.tryEmit(response.spec)) {
options.customLogger.warning("[Statsig]: grpcWebSocket: Failed to emit response")
errorBoundary.logException(
"grpcWebSocket: Failed to emit response",
Exception("${response.lastUpdated}"),
Expand Down

0 comments on commit 33d7d58

Please sign in to comment.