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

fix(logging): Wrap all of RunTaskHandler in a withAuth for context #3825

Merged
merged 1 commit into from
Jul 18, 2020
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
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ class RunTaskHandler(
message.withTask { origStage, taskModel, task -> message.withTask { origStage, taskModel, task ->
var stage = origStage var stage = origStage


stage.withAuth {
stage.withLoggingContext(taskModel) {
val thisInvocationStartTimeMs = clock.millis() val thisInvocationStartTimeMs = clock.millis()
val execution = stage.execution val execution = stage.execution
var taskResult: TaskResult? = null var taskResult: TaskResult? = null
Expand Down Expand Up @@ -125,8 +127,6 @@ class RunTaskHandler(
} }
} }


stage.withAuth {
stage.withLoggingContext(taskModel) {
if (taskResult == null) { if (taskResult == null) {
taskResult = task.execute(stage.withMergedContext()) taskResult = task.execute(stage.withMergedContext())
taskExecutionInterceptors.forEach { t -> taskResult = t.afterTaskExecution(task, stage, taskResult) } taskExecutionInterceptors.forEach { t -> taskResult = t.afterTaskExecution(task, stage, taskResult) }
Expand Down Expand Up @@ -160,8 +160,6 @@ class RunTaskHandler(
} }
} }
} }
}
}
} catch (e: Exception) { } catch (e: Exception) {
val exceptionDetails = exceptionHandlers.shouldRetry(e, taskModel.name) val exceptionDetails = exceptionHandlers.shouldRetry(e, taskModel.name)
if (exceptionDetails?.shouldRetry == true) { if (exceptionDetails?.shouldRetry == true) {
Expand All @@ -184,6 +182,8 @@ class RunTaskHandler(
} }
} }
} }
}
}


private fun trackResult(stage: StageExecution, thisInvocationStartTimeMs: Long, taskModel: TaskExecution, status: ExecutionStatus) { private fun trackResult(stage: StageExecution, thisInvocationStartTimeMs: Long, taskModel: TaskExecution, status: ExecutionStatus) {
val commonTags = MetricsTagHelper.commonTags(stage, taskModel, status) val commonTags = MetricsTagHelper.commonTags(stage, taskModel, status)
Expand Down