Modules
Integration for attaching loaded libraries and their versions to events, populating the event modules field.
The Modules integration attaches a list of loaded libraries (packages, modules) and their versions to events. This populates the modules field on the event payload, which Sentry displays in the event detail view to help users identify dependency-related issues.
This integration SHOULD be a default integration.
The integration MUST use the processEvent lifecycle hook to attach module information to events.
The integration MUST populate event.modules as a map of module name to version string:
{ "modules": { "flask": "2.3.1", "requests": "2.31.0", "sqlalchemy": "2.0.19" } } The integration SHOULD cache the module list, since installed packages rarely change during a process lifetime.
How modules are discovered is platform-specific. SDKs SHOULD use the most reliable mechanism available on their platform. Common strategies include:
- Package manager metadata — reading installed package registries (e.g.,
pkg_resourcesorimportlib.metadatain Python,package.jsondependencies in Node.js) - Runtime module cache — inspecting loaded modules from the runtime (e.g.,
require.cachein Node.js CJS) - Build-time injection — embedding module information at build time when runtime discovery is unavailable or incomplete (e.g., bundled environments)
SDKs MAY combine multiple sources to produce the most complete list. When the same module appears in multiple sources, the more specific version (e.g., from a lockfile or runtime cache) SHOULD take precedence.
SDKs MAY skip attaching modules to certain event types (e.g., transactions) where the information is less useful, to reduce payload size.
// modulesIntegration is a default integration in @sentry/node Sentry.init({ dsn: "https://examplePublicKey@o0.ingest.sentry.io/0", }); // Modules are automatically attached to error events. // The integration reads from package.json and require.cache (CJS). import sentry_sdk # ModulesIntegration is a default integration sentry_sdk.init(dsn="https://examplePublicKey@o0.ingest.sentry.io/0") # Modules are automatically attached to error events. # The integration reads from importlib.metadata / pkg_resources. | Version | Date | Summary |
|---|---|---|
1.0.0 | 2026-03-04 | Initial spec, extracted from expected features |
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").