From 288452d1354889771b3b333e352e878a1a47e656 Mon Sep 17 00:00:00 2001 From: Sergei Starostin Date: Sat, 25 Apr 2026 19:11:41 +0300 Subject: [PATCH] feat(taskbroker): add TaskError to SetTaskStatusRequest --- .../taskbroker/v1/taskbroker.proto | 17 ++++++++++++++++ rust/src/sentry_protos.taskbroker.v1.rs | 20 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/proto/sentry_protos/taskbroker/v1/taskbroker.proto b/proto/sentry_protos/taskbroker/v1/taskbroker.proto index e0466174..fb623a5e 100644 --- a/proto/sentry_protos/taskbroker/v1/taskbroker.proto +++ b/proto/sentry_protos/taskbroker/v1/taskbroker.proto @@ -117,6 +117,16 @@ message FetchNextTask { optional string application = 2; } +message TaskError { + // Fully qualified exception class, e.g. "django.db.utils.OperationalError". + string exception_type = 1; + // str(exc), worker-truncated to a bounded character count (~2000 chars). + string exception_message = 2; + // Formatted traceback (tail), worker-truncated to a bounded character count + // (~8000 chars). + optional string traceback = 3; +} + message SetTaskStatusRequest { string id = 1; @@ -124,6 +134,13 @@ message SetTaskStatusRequest { // If fetch_next is provided, receive a new task in the response optional FetchNextTask fetch_next_task = 3; + + // Populated when the worker caught an exception while executing the task. + // Typically set with status == TASK_ACTIVATION_STATUS_FAILURE, and may be set + // with TASK_ACTIVATION_STATUS_RETRY when the retry was triggered by a caught + // exception (rather than by an explicit retry_task() call with no context). + // Used by the broker only for structured logging; not persisted. + optional TaskError error = 4; } message SetTaskStatusResponse { diff --git a/rust/src/sentry_protos.taskbroker.v1.rs b/rust/src/sentry_protos.taskbroker.v1.rs index e247796a..16c50c0c 100644 --- a/rust/src/sentry_protos.taskbroker.v1.rs +++ b/rust/src/sentry_protos.taskbroker.v1.rs @@ -98,6 +98,19 @@ pub struct FetchNextTask { pub application: ::core::option::Option<::prost::alloc::string::String>, } #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct TaskError { + /// Fully qualified exception class, e.g. "django.db.utils.OperationalError". + #[prost(string, tag = "1")] + pub exception_type: ::prost::alloc::string::String, + /// str(exc), worker-truncated to a bounded character count (~2000 chars). + #[prost(string, tag = "2")] + pub exception_message: ::prost::alloc::string::String, + /// Formatted traceback (tail), worker-truncated to a bounded character count + /// (~8000 chars). + #[prost(string, optional, tag = "3")] + pub traceback: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct SetTaskStatusRequest { #[prost(string, tag = "1")] pub id: ::prost::alloc::string::String, @@ -106,6 +119,13 @@ pub struct SetTaskStatusRequest { /// If fetch_next is provided, receive a new task in the response #[prost(message, optional, tag = "3")] pub fetch_next_task: ::core::option::Option, + /// Populated when the worker caught an exception while executing the task. + /// Typically set with status == TASK_ACTIVATION_STATUS_FAILURE, and may be set + /// with TASK_ACTIVATION_STATUS_RETRY when the retry was triggered by a caught + /// exception (rather than by an explicit retry_task() call with no context). + /// Used by the broker only for structured logging; not persisted. + #[prost(message, optional, tag = "4")] + pub error: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct SetTaskStatusResponse {