-
Notifications
You must be signed in to change notification settings - Fork 13
Logging improvements when plugin version mismatches with connected ES version #247
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
Logging improvements when plugin version mismatches with connected ES version #247
Conversation
…ding this plugin version, when plugin and connected ES versions do not match warn/inform incompatibility risk and show the guidance.
215fc61
to
e373d9e
Compare
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.
The approach makes sense. +1 to absorbing this into the existing http call.
I left a comment and suggestion for making the guidance composition for version alignments less D.R.Y., so that we can make it more accurately descriptive.
|
||
es_version_parts = connected_es_version_info["number"].split('.') | ||
es_major_version = es_version_parts[0].to_i | ||
es_minor_version = es_version_parts[1].to_i |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
…h is warning and connected ES minor ahead is warning as well. Co-authored-by: Ry Biesemeyer <[email protected]>
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.
LGTM. One comment about code readability that is a result of my prior suggestion, but feel free to resolve or ignore at your discretion.
logger.warn <<~WARNING | ||
This plugin v#{VERSION} is connected to a newer MAJOR version of Elasticsearch v#{es_full_version}, and may have trouble loading or running pipelines that use new features; for the best experience, update this plugin to at least v#{es_major_version}.#{es_minor_version} | ||
WARNING |
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.
The intent of my prior suggestion to use heredocs was to enable the text to be readable with line-breaks, but I missed an important bit where even squiggle-heredocs keep the newlines 🤦🏼.
I don't think that the squiggle-heredocs are inherently more readable though, so it might be worth going back to normal strings.
logger.warn <<~WARNING | |
This plugin v#{VERSION} is connected to a newer MAJOR version of Elasticsearch v#{es_full_version}, and may have trouble loading or running pipelines that use new features; for the best experience, update this plugin to at least v#{es_major_version}.#{es_minor_version} | |
WARNING | |
logger.warn "This plugin v#{VERSION} is connected to a newer MAJOR version of Elasticsearch v#{es_full_version}, and may have trouble loading or running pipelines that use new features; for the best experience, update this plugin to at least v#{es_major_version}.#{es_minor_version}" |
or with concatenation (each needs a trailing space)
logger.warn <<~WARNING | |
This plugin v#{VERSION} is connected to a newer MAJOR version of Elasticsearch v#{es_full_version}, and may have trouble loading or running pipelines that use new features; for the best experience, update this plugin to at least v#{es_major_version}.#{es_minor_version} | |
WARNING | |
logger.warn "This plugin v#{VERSION} is connected to a newer MAJOR " + | |
"version of Elasticsearch v#{es_full_version}, and may " + | |
"have trouble loading or running pipelines that use new " + | |
"features; for the best experience, update this plugin " + | |
"to at least v#{es_major_version}.#{es_minor_version}" |
or a heredoc, but with trickery to turn the newlines into spaces:
logger.warn <<~WARNING | |
This plugin v#{VERSION} is connected to a newer MAJOR version of Elasticsearch v#{es_full_version}, and may have trouble loading or running pipelines that use new features; for the best experience, update this plugin to at least v#{es_major_version}.#{es_minor_version} | |
WARNING | |
logger.warn(<<~WARNING.tr("\n", " ")) | |
This plugin v#{VERSION} is connected to a newer MAJOR version of | |
Elasticsearch v#{es_full_version}, and may have trouble loading or | |
running pipelines that use new features; for the best experience, | |
update this plugin to at least v#{es_major_version}.#{es_minor_version} | |
WARNING |
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.
This was the hardest part actually!
heredocs had a power here to highlight the warnings with multiline texts. However, when I did an actual test
- the console look so ugly-cut-sentenced, especially when I made a half screen console - sentences alignment;
- logs didn't align with our logging standard, in a kind of jumpy way - easy to lose concentration;
Overall, it looks to me our current standard loggings has a better readability (smooth reading experience) and concentration (not jump words) points.
In case of readability, yes a) I forgot to remove heredocs styles b) made unit tests readable instead actual logic (had a sleep disorder 5AM commit, sorry) - thank you for revisiting
My last commit rearranges (your 2nd suggestion, concatenation with trailing space) and removes heredocs style!
…e source readability.
💚 Build Succeeded
History
cc @mashhurs |
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.
👍 LGTM
@logstashmachine backport 8.x |
… version (#247) * Logging improvements: informing which ES version considered when building this plugin version, when plugin and connected ES versions do not match warn/inform incompatibility risk and show the guidance. * Preflight check initialization optimization. * Refactored messages in a way for better visibility. Any major mismatch is warning and connected ES minor ahead is warning as well. Co-authored-by: Ry Biesemeyer <[email protected]> * Standardize log outputs on console. --------- Co-authored-by: Ry Biesemeyer <[email protected]> (cherry picked from commit 021e8c7)
@logstashmachine backport 8.16 |
… version (#247) * Logging improvements: informing which ES version considered when building this plugin version, when plugin and connected ES versions do not match warn/inform incompatibility risk and show the guidance. * Preflight check initialization optimization. * Refactored messages in a way for better visibility. Any major mismatch is warning and connected ES minor ahead is warning as well. Co-authored-by: Ry Biesemeyer <[email protected]> * Standardize log outputs on console. --------- Co-authored-by: Ry Biesemeyer <[email protected]> (cherry picked from commit 021e8c7)
@logstashmachine backport 8.17 |
… version (#247) * Logging improvements: informing which ES version considered when building this plugin version, when plugin and connected ES versions do not match warn/inform incompatibility risk and show the guidance. * Preflight check initialization optimization. * Refactored messages in a way for better visibility. Any major mismatch is warning and connected ES minor ahead is warning as well. Co-authored-by: Ry Biesemeyer <[email protected]> * Standardize log outputs on console. --------- Co-authored-by: Ry Biesemeyer <[email protected]> (cherry picked from commit 021e8c7)
… version (#247) (#250) * Logging improvements: informing which ES version considered when building this plugin version, when plugin and connected ES versions do not match warn/inform incompatibility risk and show the guidance. * Preflight check initialization optimization. * Refactored messages in a way for better visibility. Any major mismatch is warning and connected ES minor ahead is warning as well. Co-authored-by: Ry Biesemeyer <[email protected]> * Standardize log outputs on console. --------- Co-authored-by: Ry Biesemeyer <[email protected]> (cherry picked from commit 021e8c7) Co-authored-by: Mashhur <[email protected]>
… version (#247) (#253) * Logging improvements: informing which ES version considered when building this plugin version, when plugin and connected ES versions do not match warn/inform incompatibility risk and show the guidance. * Preflight check initialization optimization. * Refactored messages in a way for better visibility. Any major mismatch is warning and connected ES minor ahead is warning as well. Co-authored-by: Ry Biesemeyer <[email protected]> * Standardize log outputs on console. --------- Co-authored-by: Ry Biesemeyer <[email protected]> (cherry picked from commit 021e8c7) Co-authored-by: Mashhur <[email protected]>
… version (#247) (#255) * Logging improvements: informing which ES version considered when building this plugin version, when plugin and connected ES versions do not match warn/inform incompatibility risk and show the guidance. * Preflight check initialization optimization. * Refactored messages in a way for better visibility. Any major mismatch is warning and connected ES minor ahead is warning as well. Co-authored-by: Ry Biesemeyer <[email protected]> * Standardize log outputs on console. --------- Co-authored-by: Ry Biesemeyer <[email protected]> (cherry picked from commit 021e8c7) Co-authored-by: Mashhur <[email protected]>
Description
Plugin aligns with stack
{major.minor}
now. This gives an opportunity to highlight in the logs if plugin is running against the different ES version from the version plugin is built.This PR considers:
Example results