@@ -145,19 +145,26 @@ public <T> Optional<T> getInstance(Class<T> extension) {
145145 @ Override
146146 public void startUp () {
147147 // load and start all enabled plugins of application
148- integrationTypeRepository .findAll ()
148+ List < IntegrationType > pluginsToLoad = integrationTypeRepository .findAll ()
149149 .stream ()
150150 .filter (IntegrationType ::isEnabled )
151151 .filter (it -> it .getPluginType () == EXTENSION )
152- .forEach (integrationType -> ofNullable (integrationType .getDetails ()).ifPresent (
153- integrationTypeDetails -> {
154- try {
155- loadPlugin (integrationType .getName (), integrationTypeDetails );
156- } catch (Exception ex ) {
157- LOGGER .error ("Unable to load plugin '{}'" , integrationType .getName ());
158- }
159- }));
152+ .toList ();
160153
154+ LOGGER .info ("Plugin startup: loading {} enabled extension plugin(s)" , pluginsToLoad .size ());
155+ long startUpBegin = System .currentTimeMillis ();
156+
157+ pluginsToLoad .forEach (integrationType -> ofNullable (integrationType .getDetails ()).ifPresent (
158+ integrationTypeDetails -> {
159+ try {
160+ loadPlugin (integrationType .getName (), integrationTypeDetails );
161+ } catch (Exception ex ) {
162+ LOGGER .error ("Unable to load plugin '{}'" , integrationType .getName ());
163+ }
164+ }));
165+
166+ LOGGER .info ("Plugin startup: finished loading {} plugin(s) in {} ms" , pluginsToLoad .size (),
167+ System .currentTimeMillis () - startUpBegin );
161168 }
162169
163170 @ Override
@@ -180,6 +187,7 @@ public PluginState startUpPlugin(String pluginId) {
180187
181188 @ Override
182189 public boolean loadPlugin (String pluginId , IntegrationTypeDetails integrationTypeDetails ) {
190+ long loadBegin = System .currentTimeMillis ();
183191 return ofNullable (integrationTypeDetails .getDetails ()).map (details -> {
184192 String fileName = IntegrationTypeProperties .FILE_NAME .getValue (details )
185193 .map (String ::valueOf )
@@ -189,7 +197,8 @@ public boolean loadPlugin(String pluginId, IntegrationTypeDetails integrationTyp
189197 ));
190198
191199 Path pluginPath = Paths .get (pluginsDir , fileName );
192- if (Files .notExists (pluginPath )) {
200+ boolean cached = Files .exists (pluginPath );
201+ if (!cached ) {
193202 String fileId = IntegrationTypeProperties .FILE_ID .getValue (details )
194203 .map (String ::valueOf )
195204 .orElseThrow (() -> new ReportPortalException (ErrorType .PLUGIN_UPLOAD_ERROR ,
@@ -208,7 +217,7 @@ public boolean loadPlugin(String pluginId, IntegrationTypeDetails integrationTyp
208217 copyPluginResources (pluginPath , pluginId );
209218 }
210219
211- return ofNullable (pluginManager .loadPlugin (pluginPath )).map (id -> {
220+ boolean result = ofNullable (pluginManager .loadPlugin (pluginPath )).map (id -> {
212221 if (PluginState .STARTED == pluginManager .startPlugin (pluginId )) {
213222 initPlugin (pluginId );
214223 applicationEventPublisher .publishEvent (
@@ -219,10 +228,25 @@ public boolean loadPlugin(String pluginId, IntegrationTypeDetails integrationTyp
219228 return false ;
220229 }
221230 }).orElse (Boolean .FALSE );
231+
232+ LOGGER .info (
233+ "Plugin '{}' load finished: success={} cached={} sizeBytes={} tookMs={}" ,
234+ pluginId , result , cached , fileSizeOrUnknown (pluginPath ),
235+ System .currentTimeMillis () - loadBegin
236+ );
237+ return result ;
222238 }).orElse (Boolean .FALSE );
223239
224240 }
225241
242+ private long fileSizeOrUnknown (Path path ) {
243+ try {
244+ return Files .size (path );
245+ } catch (IOException e ) {
246+ return -1 ;
247+ }
248+ }
249+
226250 private void initPlugin (String pluginId ) {
227251 try {
228252 Optional <org .pf4j .ExtensionPoint > extensionPoint = this .getInstance (pluginId ,
0 commit comments