Skip to content

Commit 3dd9bb2

Browse files
authored
Remove traceback.format_exception call that was to handle older OTel versions (#1456)
1 parent 135ed88 commit 3dd9bb2

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

logfire/_internal/tracer.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import json
44
import sys
5-
import traceback
65
from collections import defaultdict
76
from collections.abc import Mapping, Sequence
87
from dataclasses import dataclass, field
@@ -468,13 +467,6 @@ def record_exception(
468467
span.set_attribute(ATTRIBUTES_VALIDATION_ERROR_KEY, err_json)
469468
attributes[ATTRIBUTES_VALIDATION_ERROR_KEY] = err_json
470469

471-
if exception is not sys.exc_info()[1]:
472-
# OTEL's record_exception uses `traceback.format_exc()` which is for the current exception,
473-
# ignoring the passed exception.
474-
# So we override the stacktrace attribute with the correct one.
475-
stacktrace = ''.join(traceback.format_exception(type(exception), exception, exception.__traceback__))
476-
attributes['exception.stacktrace'] = stacktrace
477-
478470
if helper.create_issue:
479471
span.set_attribute(ATTRIBUTES_EXCEPTION_FINGERPRINT_KEY, sha256_string(helper.issue_fingerprint_source))
480472

0 commit comments

Comments
 (0)