Skip to content

Fix: Downgrade optional plugin dependency warning to a single info log (#21322)#21891

Open
lazyfetch wants to merge 4 commits into
opensearch-project:mainfrom
lazyfetch:fix/optional-plugin-logging
Open

Fix: Downgrade optional plugin dependency warning to a single info log (#21322)#21891
lazyfetch wants to merge 4 commits into
opensearch-project:mainfrom
lazyfetch:fix/optional-plugin-logging

Conversation

@lazyfetch
Copy link
Copy Markdown

Description

Changed a multi-line WARN log to a single INFO log when an optional plugin is missing during startup. This prevents confusing, fragmented output and explicitly identifies the dependency as "optional", as requested by the maintainers.

Taking this over with permission from @dzane17.

Related Issues

Resolves #21322

Check List

  • Functionality includes testing. (Note: Trivial logging string change, no new tests required).
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

lazyfetch added 2 commits May 23, 2026 19:51
opensearch-project#21322)

Signed-off-by: Vedant Bothra <237130889+lazyfetch@users.noreply.github.com>
opensearch-project#21322)

Signed-off-by: Vedant Bothra <237130889+lazyfetch@users.noreply.github.com>
@lazyfetch lazyfetch requested a review from a team as a code owner May 29, 2026 19:16
@github-actions github-actions Bot added bug Something isn't working good first issue Good for newcomers Plugins labels May 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

PR Reviewer Guide 🔍

(Review updated until commit 4e333fb)

Here are some key observations to aid the review process:

🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

PR Code Suggestions ✨

Latest suggestions up to 4e333fb

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Simplify multi-line log message

The log message uses string concatenation with the '+' operator for a multi-line
message. Consider using a single string literal or text blocks (Java 13+) for better
readability and to avoid potential issues with string concatenation in logging
statements.

server/src/main/java/org/opensearch/plugins/PluginsService.java [628-633]

 logger.info(
-    "Missing optional plugin [{}], dependency of [{}]. "
-        + "Some features of this plugin may not function without the dependencies being installed.",
+    "Missing optional plugin [{}], dependency of [{}]. Some features of this plugin may not function without the dependencies being installed.",
     dependency,
     name
 );
Suggestion importance[1-10]: 4

__

Why: The suggestion correctly identifies that the string concatenation with + can be simplified into a single string literal. While this improves readability slightly, the impact is minimal since both approaches are functionally equivalent and the current code is already clear.

Low

Previous suggestions

Suggestions up to commit 2c54bae
CategorySuggestion                                                                                                                                    Impact
General
Simplify multi-line log message

The log message uses string concatenation with the '+' operator for a multi-line
string. Consider using a single string literal or text blocks (Java 15+) for better
readability and to avoid potential issues with string concatenation in logging
statements.

server/src/main/java/org/opensearch/plugins/PluginsService.java [628-633]

 logger.info(
-    "Missing optional plugin [{}], dependency of [{}]. "
-        + "Some features of this plugin may not function without the dependencies being installed.",
+    "Missing optional plugin [{}], dependency of [{}]. Some features of this plugin may not function without the dependencies being installed.",
     dependency,
     name
 );
Suggestion importance[1-10]: 4

__

Why: The suggestion correctly identifies that the string concatenation with + can be simplified into a single string literal. However, this is a minor style improvement that doesn't significantly impact functionality, readability, or performance. The existing code is already clear and functional.

Low
Suggestions up to commit d404403
CategorySuggestion                                                                                                                                    Impact
General
Use parameterized logging for performance

Use parameterized logging instead of string concatenation to improve performance and
avoid unnecessary string creation when the log level is disabled. This is a best
practice for logging frameworks.

server/src/main/java/org/opensearch/plugins/PluginsService.java [628-629]

-logger.info("Missing optional plugin [" + dependency + "], dependency of [" + name + "]. " +
-            "Some features of this plugin may not function without the dependencies being installed.");
+logger.info("Missing optional plugin [{}], dependency of [{}]. Some features of this plugin may not function without the dependencies being installed.", dependency, name);
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies that parameterized logging is a best practice that avoids unnecessary string concatenation and object creation. The existing_code matches lines 628-629 in the PR diff, and the improved_code accurately shows the parameterized version. This is a valid performance and maintainability improvement.

Medium

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for d404403: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Signed-off-by: Vedant Bothra <237130889+lazyfetch@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 2c54bae

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 2c54bae: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

… plugin

Signed-off-by: Vedant Bothra <237130889+lazyfetch@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 4e333fb

@github-actions
Copy link
Copy Markdown
Contributor

✅ Gradle check result for 4e333fb: SUCCESS

@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.45%. Comparing base (3d1fd3f) to head (4e333fb).
⚠️ Report is 46 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #21891      +/-   ##
============================================
- Coverage     73.51%   73.45%   -0.07%     
+ Complexity    75357    75268      -89     
============================================
  Files          6028     6026       -2     
  Lines        342003   341906      -97     
  Branches      49185    49181       -4     
============================================
- Hits         251434   251143     -291     
- Misses        70554    70751     +197     
+ Partials      20015    20012       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working good first issue Good for newcomers Plugins

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] optional plugin dependency still leads to warning if dependent plugin is not present

1 participant