diff --git a/ddtrace/debugging/_exception/replay.py b/ddtrace/debugging/_exception/replay.py index 5b9f1a9f330..080b4cbfc61 100644 --- a/ddtrace/debugging/_exception/replay.py +++ b/ddtrace/debugging/_exception/replay.py @@ -40,7 +40,8 @@ CAPTURE_TRACE_TAG = "_dd.debug.error.trace_captured" # unique exception id -EXCEPTION_ID_TAG = "_dd.debug.error.exception_id" +EXCEPTION_HASH_TAG = "_dd.debug.error.exception_hash" +EXCEPTION_ID_TAG = "_dd.debug.error.exception_capture_id" # link to matching snapshot for every frame in the traceback FRAME_SNAPSHOT_ID_TAG = "_dd.debug.error.%d.snapshot_id" @@ -80,9 +81,8 @@ def exception_chain_ident(chain: ExceptionChain) -> int: return h -def limit_exception(chain: ExceptionChain) -> bool: +def limit_exception(exc_ident: int) -> bool: try: - exc_ident = exception_chain_ident(chain) hg = EXCEPTION_IDENT_LIMITER.get(exc_ident) if hg is None: # We haven't seen this exception yet, or it's been evicted @@ -218,7 +218,8 @@ def on_span_exception( # No exceptions to capture return - if limit_exception(chain): + exc_ident = exception_chain_ident(chain) + if limit_exception(exc_ident): # We have seen this exception recently return @@ -272,6 +273,7 @@ def on_span_exception( _tb = _tb.tb_next span.set_tag_str(DEBUG_INFO_TAG, "true") + span.set_tag_str(EXCEPTION_HASH_TAG, str(exc_ident)) span.set_tag_str(EXCEPTION_ID_TAG, str(exc_id)) @classmethod