-
Notifications
You must be signed in to change notification settings - Fork 994
Additional logging to plugin registration process #8544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,10 +113,13 @@ public <T extends BesuService> Optional<T> getService(final Class<T> serviceType | |
| } | ||
|
|
||
| private List<BesuPlugin> detectPlugins(final PluginConfiguration config) { | ||
| LOG.debug("detecting plugin in configured besu.plugins.dir {}", config.getPluginsDir()); | ||
| ClassLoader pluginLoader = | ||
| pluginDirectoryLoader(config.getPluginsDir()).orElse(getClass().getClassLoader()); | ||
| ServiceLoader<BesuPlugin> serviceLoader = ServiceLoader.load(BesuPlugin.class, pluginLoader); | ||
| return StreamSupport.stream(serviceLoader.spliterator(), false).toList(); | ||
| return StreamSupport.stream(serviceLoader.spliterator(), false) | ||
| .peek(l -> LOG.info("found besu-plugin {}", l.getName().orElse("noName"))) | ||
| .toList(); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -155,11 +158,21 @@ public void registerPlugins() { | |
| } else { | ||
| // Register only the plugins that were explicitly requested and validated | ||
| requestedPlugins = config.getRequestedPlugins(); | ||
|
|
||
| // Match and validate the requested plugins against the detected plugins | ||
| try { | ||
| List<BesuPlugin> registeringPlugins = | ||
| matchAndValidateRequestedPlugins(requestedPlugins, detectedPlugins); | ||
|
|
||
| registerPlugins(registeringPlugins); | ||
| registerPlugins(registeringPlugins); | ||
|
|
||
| } catch (final Exception e) { | ||
| if (config.isContinueOnPluginError()) { | ||
| LOG.error("Error matching or registering plugins. Plugins will not start.", e); | ||
| } else { | ||
| throw new RuntimeException("Error matching or registering plugins. Plugins will not start", e); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Error matching or registering plugins. |
||
| } | ||
| } | ||
| } | ||
| } else { | ||
| LOG.debug("External plugins are disabled. Skipping plugins registration."); | ||
|
|
@@ -362,6 +375,7 @@ private Optional<ClassLoader> pluginDirectoryLoader(final Path pluginsDir) { | |
| final URL[] pluginJarURLs = | ||
| pluginFilesList | ||
| .filter(p -> p.getFileName().toString().endsWith(".jar")) | ||
| .peek(p -> LOG.debug("plugin jar url: {}", p)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, |
||
| .map(BesuPluginContextImpl::pathToURIOrNull) | ||
| .toArray(URL[]::new); | ||
| return Optional.of(new URLClassLoader(pluginJarURLs, this.getClass().getClassLoader())); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,7 +108,10 @@ private BlockAwareOperationTracer getBlockImportTracer( | |
| Optional.ofNullable(protocolContext.getPluginServiceManager()) | ||
| .flatMap(serviceManager -> serviceManager.getService(BlockImportTracerProvider.class)) | ||
| // if block import tracer provider is not specified by plugin, default to no tracing | ||
| .orElse((__) -> BlockAwareOperationTracer.NO_TRACING); | ||
| .orElse((__) -> { | ||
| LOG.info("Block Import uses NO_TRACING"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will be logged every time that a block is processed. Maybe move the log outside of the lambda body or change it to |
||
| return BlockAwareOperationTracer.NO_TRACING; | ||
| }); | ||
| } | ||
|
|
||
| return blockImportTracerProvider.getBlockImportTracer(header); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to get this to log with "DEBUG"