def METHOD_NAME(
    self, producer: ProducerT, exc: BaseException, state: Any
) -> None:
    span = state.get("span")
    if span is not None:
        span.set_tag(tags.ERROR, "true")
        span.log_kv(
            {
                "python.exception.type": type(exc),
                "python.exception.val": exc,
                "python.exception.tb": traceback.format_stack(),
            }
        )
        span.finish(exception=exc)