Commit 07564c8
perf: Avoid scanning installed packages when MCP SDK is not installed (#6769)
When mcp SDK is not installed, module-level package_version('mcp') at
the top of sentry_sdk/integrations/mcp.py scans every installed
distribution, slowing sentry_sdk.init() by ~200ms in environments
with hundreds of packages.
Move the call below the ry/except ImportError guard so it only runs
when import mcp succeeds. Environments without mcp skip the scan
entirely.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 9996734 commit 07564c8
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | 23 | | |
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
| 29 | + | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
0 commit comments