Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion skywalking/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def install():
if sys.version_info < (3, 12):
plugin = importer.find_module(modname).load_module(modname)
else:
plugin = importlib.util.module_from_spec(importer.find_spec(modname))
spec = importer.find_spec(modname)
Copy link

Copilot AI Jun 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a check to ensure 'spec' is not None before invoking 'spec.loader.exec_module(plugin)' to prevent a potential AttributeError if the module spec is not found.

Suggested change
spec = importer.find_spec(modname)
spec = importer.find_spec(modname)
if spec is None:
logger.warning("Module spec for plugin %s could not be found, skipping installation.", modname)
continue

Copilot uses AI. Check for mistakes.
plugin = importlib.util.module_from_spec(spec)
spec.loader.exec_module(plugin)

# todo: refactor the version checker, currently it doesn't really work as intended
supported = pkg_version_check(plugin)
Expand Down
Loading