Skip to content
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Copy link
Contributor

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"

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();
}

/**
Expand Down Expand Up @@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

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

Error matching or registering plugins. Besu will not start

}
}
}
} else {
LOG.debug("External plugins are disabled. Skipping plugins registration.");
Expand Down Expand Up @@ -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))
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, DEBUG did not work but maybe it is my configuration

.map(BesuPluginContextImpl::pathToURIOrNull)
.toArray(URL[]::new);
return Optional.of(new URLClassLoader(pluginJarURLs, this.getClass().getClassLoader()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Copy link
Contributor

Choose a reason for hiding this comment

The 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 trace

return BlockAwareOperationTracer.NO_TRACING;
});
}

return blockImportTracerProvider.getBlockImportTracer(header);
Expand Down
Loading