Skip to content

Commit

Permalink
PI-2608 Record exceptions in current span (#4354)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-bcl authored Oct 29, 2024
1 parent b8efa6a commit 1917b50
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import io.awspring.cloud.sqs.listener.AsyncAdapterBlockingExecutionFailedExcepti
import io.awspring.cloud.sqs.listener.ListenerExecutionFailedException
import io.opentelemetry.api.trace.Span
import io.opentelemetry.api.trace.SpanKind
import io.opentelemetry.api.trace.StatusCode
import io.sentry.Sentry
import io.sentry.spring.jakarta.tracing.SentryTransaction
import org.springframework.beans.factory.annotation.Value
Expand Down Expand Up @@ -53,9 +54,11 @@ class AwsNotificationListener(
}
try {
retry(3, RETRYABLE_EXCEPTIONS) { handler.handle(message) }
} catch (e: Throwable) {
Sentry.captureException(unwrapSqsExceptions(e))
throw e
} catch (t: Throwable) {
val e = unwrapSqsExceptions(t)
Span.current().recordException(e).setStatus(StatusCode.ERROR)
Sentry.captureException(e)
throw t
}
}
}
Expand Down

0 comments on commit 1917b50

Please sign in to comment.