-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Refresh Schema error messages (#12131)
- Loading branch information
Showing
5 changed files
with
89 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
airbyte-commons-worker/src/main/kotlin/io/airbyte/workers/temporal/FailureConverter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package io.airbyte.workers.temporal | ||
|
||
import io.airbyte.commons.temporal.utils.ActivityFailureClassifier | ||
import io.airbyte.config.ActorType | ||
import io.airbyte.config.FailureReason | ||
import org.apache.commons.lang3.exception.ExceptionUtils | ||
import org.slf4j.LoggerFactory | ||
import java.lang.String | ||
import kotlin.time.Duration | ||
import kotlin.time.toKotlinDuration | ||
|
||
class FailureConverter { | ||
@JvmOverloads | ||
fun getFailureReason( | ||
commandName: String, | ||
actorType: ActorType, | ||
e: Exception, | ||
timeout: java.time.Duration? = null, | ||
): FailureReason = getFailureReason(commandName, actorType, e, timeout?.toKotlinDuration()) | ||
|
||
fun getFailureReason( | ||
commandName: String, | ||
actorType: ActorType, | ||
e: Exception, | ||
timeout: Duration?, | ||
): FailureReason { | ||
val failureReason = | ||
FailureReason() | ||
.withFailureOrigin(if (actorType == ActorType.SOURCE) FailureReason.FailureOrigin.SOURCE else FailureReason.FailureOrigin.DESTINATION) | ||
.withStacktrace(ExceptionUtils.getStackTrace(e)) | ||
val classifiedExc = ActivityFailureClassifier.classifyException(e) | ||
LoggerFactory.getLogger("test").error("exception classified as $classifiedExc") | ||
when (classifiedExc) { | ||
ActivityFailureClassifier.TemporalFailureReason.HEARTBEAT -> | ||
failureReason | ||
.withFailureOrigin(FailureReason.FailureOrigin.AIRBYTE_PLATFORM) | ||
.withFailureType(FailureReason.FailureType.SYSTEM_ERROR) | ||
.withExternalMessage("$commandName connection failed because of an internal error.") | ||
.withInternalMessage("$commandName pod failed to heartbeat, verify resource and heath of the worker/check pods.") | ||
|
||
ActivityFailureClassifier.TemporalFailureReason.SCHEDULER_OVERLOADED -> | ||
failureReason | ||
.withFailureOrigin(FailureReason.FailureOrigin.AIRBYTE_PLATFORM) | ||
.withFailureType(FailureReason.FailureType.TRANSIENT_ERROR) | ||
.withExternalMessage("Airbyte Platform is experiencing a higher than usual load, please try again later.") | ||
.withInternalMessage("$commandName wasn't able to start within the expected time, verify scheduler and worker load.") | ||
|
||
ActivityFailureClassifier.TemporalFailureReason.OPERATION_TIMEOUT -> | ||
failureReason | ||
.withExternalMessage("$commandName took too long.") | ||
.withInternalMessage("$commandName exceeded the timeout${timeout?.let { " of ${it.inWholeMinutes} minutes" }.orEmpty()}.") | ||
|
||
ActivityFailureClassifier.TemporalFailureReason.UNKNOWN, ActivityFailureClassifier.TemporalFailureReason.NOT_A_TIMEOUT -> | ||
failureReason | ||
.withFailureOrigin(FailureReason.FailureOrigin.AIRBYTE_PLATFORM) | ||
.withExternalMessage("$commandName failed because of an internal error") | ||
.withInternalMessage("$commandName failed because of an internal error") | ||
|
||
else -> | ||
failureReason | ||
.withFailureOrigin(FailureReason.FailureOrigin.AIRBYTE_PLATFORM) | ||
.withExternalMessage("$commandName failed because of an internal error") | ||
.withInternalMessage("$commandName failed because of an internal error") | ||
} | ||
return failureReason | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters