Skip to content

Commit b058dee

Browse files
committed
perf: disable Sentry subprocess instrumentation and tracing
StdlibIntegration monkeypatches subprocess.Popen, adding span/breadcrumb overhead to every subprocess call. Profiling showed ~342k samples (~8.9% of total runtime) in sentry_sdk.integrations.stdlib and sentry_sdk.utils. Disable subprocess instrumentation and set traces/profiles sample rates to 0 since codeflash is a CLI tool that doesn't need performance tracing. Error capturing (capture_exception, capture_message, LoggingIntegration) remains fully functional.
1 parent f816502 commit b058dee

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

codeflash/telemetry/sentry.py

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

33
import sentry_sdk
44
from sentry_sdk.integrations.logging import LoggingIntegration
5+
from sentry_sdk.integrations.stdlib import StdlibIntegration
56

67

78
def init_sentry(*, enabled: bool = False, exclude_errors: bool = False) -> None:
@@ -15,13 +16,8 @@ def init_sentry(*, enabled: bool = False, exclude_errors: bool = False) -> None:
1516

1617
sentry_sdk.init(
1718
dsn="https://4b9a1902f9361b48c04376df6483bc96@o4506833230561280.ingest.sentry.io/4506833262477312",
18-
integrations=[sentry_logging],
19-
# Set traces_sample_rate to 1.0 to capture 100%
20-
# of transactions for performance monitoring.
21-
traces_sample_rate=1.0,
22-
# Set profiles_sample_rate to 1.0 to profile 100%
23-
# of sampled transactions.
24-
# We recommend adjusting this value in production.
25-
profiles_sample_rate=1.0,
19+
integrations=[sentry_logging, StdlibIntegration(subprocess_instrumentation=False)],
20+
traces_sample_rate=0,
21+
profiles_sample_rate=0,
2622
ignore_errors=[KeyboardInterrupt],
2723
)

0 commit comments

Comments
 (0)