Skip to content

Commit c3e64c2

Browse files
authored
chore(span): bump traceback limit from 20 to 30 (backports #5807 to 1.13) (#5862)
Currently we truncate the error.stack tag to 20 frames. Some ddtrace integrations (ex: flask) can produce stacktraces that add almost 10-15 frames that reference the ddtrace libraries. A limit of 20 frames is clearly not enough visibility to debug errors in customers application code. This PR bumps the limit to 30 (another arbitrary value). ## Checklist - [x] Change(s) are motivated and described in the PR description. - [x] Testing strategy is described if automated tests are not included in the PR. - [x] Risk is outlined (performance impact, potential for breakage, maintainability, etc). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/contributing.html#Release-Note-Guidelines) are followed. - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)). - [x] OPTIONAL: PR description includes explicit acknowledgement of the performance implications of the change as reported in the benchmarks PR comment. ## Checklist - [x] Title is accurate. - [x] No unnecessary changes are introduced. - [x] Description motivates each change. - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [x] Testing strategy adequately addresses listed risk(s). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] Release note makes sense to a user of the library. - [x] Reviewer has explicitly acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment.
1 parent 37ced2d commit c3e64c2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

ddtrace/span.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ def get_metrics(self):
446446
"""Return all metrics."""
447447
return self._metrics.copy()
448448

449-
def set_traceback(self, limit=20):
449+
def set_traceback(self, limit=30):
450450
# type: (int) -> None
451451
"""If the current stack has an exception, tag the span with the
452452
relevant error info. If not, set the span to the current python stack.
@@ -474,7 +474,7 @@ def set_exc_info(self, exc_type, exc_val, exc_tb):
474474
def _set_exc_tags(self, exc_type, exc_val, exc_tb):
475475
# get the traceback
476476
buff = StringIO()
477-
traceback.print_exception(exc_type, exc_val, exc_tb, file=buff, limit=20)
477+
traceback.print_exception(exc_type, exc_val, exc_tb, file=buff, limit=30)
478478
tb = buff.getvalue()
479479

480480
# readable version of type (e.g. exceptions.ZeroDivisionError)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
other:
3+
- |
4+
span: Increases the traceback limit in ``error.stack`` tags from 20 to 30

0 commit comments

Comments
 (0)