Skip to content

Commit 315a48f

Browse files
authored
chore(er): include exception hash (#11772)
We include the span tag that carries the exception hash, according to the RFC. ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [ ] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
1 parent 0035bfe commit 315a48f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

ddtrace/debugging/_exception/replay.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
CAPTURE_TRACE_TAG = "_dd.debug.error.trace_captured"
4141

4242
# unique exception id
43-
EXCEPTION_ID_TAG = "_dd.debug.error.exception_id"
43+
EXCEPTION_HASH_TAG = "_dd.debug.error.exception_hash"
44+
EXCEPTION_ID_TAG = "_dd.debug.error.exception_capture_id"
4445

4546
# link to matching snapshot for every frame in the traceback
4647
FRAME_SNAPSHOT_ID_TAG = "_dd.debug.error.%d.snapshot_id"
@@ -80,9 +81,8 @@ def exception_chain_ident(chain: ExceptionChain) -> int:
8081
return h
8182

8283

83-
def limit_exception(chain: ExceptionChain) -> bool:
84+
def limit_exception(exc_ident: int) -> bool:
8485
try:
85-
exc_ident = exception_chain_ident(chain)
8686
hg = EXCEPTION_IDENT_LIMITER.get(exc_ident)
8787
if hg is None:
8888
# We haven't seen this exception yet, or it's been evicted
@@ -218,7 +218,8 @@ def on_span_exception(
218218
# No exceptions to capture
219219
return
220220

221-
if limit_exception(chain):
221+
exc_ident = exception_chain_ident(chain)
222+
if limit_exception(exc_ident):
222223
# We have seen this exception recently
223224
return
224225

@@ -272,6 +273,7 @@ def on_span_exception(
272273
_tb = _tb.tb_next
273274

274275
span.set_tag_str(DEBUG_INFO_TAG, "true")
276+
span.set_tag_str(EXCEPTION_HASH_TAG, str(exc_ident))
275277
span.set_tag_str(EXCEPTION_ID_TAG, str(exc_id))
276278

277279
@classmethod

0 commit comments

Comments
 (0)