Skip to content

Commit 636ffa1

Browse files
authored
feat(er): add in-product enablement support (#13610)
We add in-product enablement support for Exception Replay. ## Checklist - [ ] 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 140c2b9 commit 636ffa1

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed
Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import enum
2+
13
from ddtrace.debugging._config import er_config as config
24

35

@@ -9,23 +11,41 @@ def post_preload():
911
pass
1012

1113

14+
def _start():
15+
from ddtrace.debugging._exception.replay import SpanExceptionHandler
16+
17+
SpanExceptionHandler.enable()
18+
19+
1220
def start():
1321
if config.enabled:
14-
from ddtrace.debugging._exception.replay import SpanExceptionHandler
15-
16-
SpanExceptionHandler.enable()
22+
_start()
1723

1824

1925
def restart(join=False):
2026
pass
2127

2228

29+
def _stop():
30+
from ddtrace.debugging._exception.replay import SpanExceptionHandler
31+
32+
SpanExceptionHandler.disable()
33+
34+
2335
def stop(join=False):
2436
if config.enabled:
25-
from ddtrace.debugging._exception.replay import SpanExceptionHandler
26-
27-
SpanExceptionHandler.disable()
37+
_stop()
2838

2939

3040
def at_exit(join=False):
3141
stop(join=join)
42+
43+
44+
class APMCapabilities(enum.IntFlag):
45+
APM_TRACING_ENABLE_EXCEPTION_REPLAY = 1 << 39
46+
47+
48+
def apm_tracing_rc(lib_config, _config):
49+
if (enabled := lib_config.get("exception_replay_enabled")) is not None:
50+
should_start = (config.spec.enabled.full_name not in config.source or config.enabled) and enabled
51+
_start() if should_start else _stop()
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
features:
3+
- |
4+
exception replay: added in-product enablement support.

0 commit comments

Comments
 (0)