Skip to content

Conversation

mashhurs
Copy link
Collaborator

@mashhurs mashhurs commented Jan 23, 2025

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:

  • Connected ES is newer major (warn: pipelines using new features won't work)
  • Connected ES is older major (warn: pipelines using deprecated-in-old-major removed-in-new-major options will fail to load)
  • Connected ES is same major, but:
    • Connected ES is newer minor (warn: pipelines using new features won't work)
    • Connected ES is older minor (info: low-risk mismatch)
    • Connected ES is same minor (debug: everything is okay)

Example results

  • When plugin and ES major.minor versions are same
[2025-01-22T15:11:12,861][INFO ][logstash.filters.elasticintegration][main] This 8.17.0 version of plugin embedded Ingest node components from Elasticsearch 8.17
  • When plugin minor version is ahead of ES minor version
2025-01-22T15:16:57,997][INFO ][logstash.filters.elasticintegration][main] This 8.18.0 version of plugin embedded Ingest node components from Elasticsearch 8.18
[2025-01-22T15:16:57,997][INFO ][logstash.filters.elasticintegration][main] This 8.18.0 version of plugin is compiled with newer Elasticsearch version than currently connected Elasticsearch 8.17 version
  • When plugin major version is ahead of ES major version
[2025-01-22T15:27:06,285][INFO ][logstash.filters.elasticintegration][main] This 9.0.0 version of plugin embedded Ingest node components from Elasticsearch 9.0
[2025-01-22T15:27:06,285][INFO ][logstash.filters.elasticintegration][main] This 9.0.0 version of plugin is compiled with newer Elasticsearch version than currently connected Elasticsearch 8.17 version. Upgrade the plugin and/or stack to the same `major.minor` to get the minimal disruptive experience.

- When plugin major version is behind of ES major version
[2025-01-22T15:28:59,232][INFO ][logstash.filters.elasticintegration][main] This 8.17.0 version of plugin embedded Ingest node components from Elasticsearch 8.17
[2025-01-22T15:28:59,233][WARN ][logstash.filters.elasticintegration][main] This 8.17.0 version of plugin is compiled with older Elasticsearch version than currently connected Elasticsearch 9.0 version. Upgrade the plugin and/or stack to the same `major.minor` to get the minimal disruptive experience.
  • When plugin minor version is behind of ES minor version
[2025-01-23T07:23:26,577][INFO ][logstash.filters.elasticintegration][main] This 8.16.0 version of plugin embedded Ingest node components from Elasticsearch 8.16
[2025-01-23T07:23:26,595][INFO ][logstash.filters.elasticintegration][main] This 8.16.0 version of plugin is compiled with older Elasticsearch version than currently connected Elasticsearch 8.17 version. Upgrade the plugin and/or stack to the same `major.minor` to get the minimal disruptive experience

…ding this plugin version, when plugin and connected ES versions do not match warn/inform incompatibility risk and show the guidance.
@mashhurs mashhurs linked an issue Jan 23, 2025 that may be closed by this pull request
@mashhurs mashhurs force-pushed the log-improvements-when-versions-mismatch branch from 215fc61 to e373d9e Compare January 23, 2025 17:23
@mashhurs mashhurs self-assigned this Jan 23, 2025
@mashhurs mashhurs marked this pull request as ready for review January 23, 2025 23:12
@mashhurs mashhurs changed the title Logging improvements when plugin version mismatch with connected ES version Logging improvements when plugin version mismatches with connected ES version Jan 23, 2025
Copy link
Member

@yaauie yaauie left a 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.

mashhurs and others added 2 commits January 23, 2025 18:56
…h is warning and connected ES minor ahead is warning as well.

Co-authored-by: Ry Biesemeyer <[email protected]>
@mashhurs mashhurs requested a review from yaauie January 24, 2025 13:52
yaauie
yaauie previously approved these changes Jan 24, 2025
Copy link
Member

@yaauie yaauie left a 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.

Comment on lines 478 to 480
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
Copy link
Member

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.

Suggested change
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)

Suggested change
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:

Suggested change
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

Copy link
Collaborator Author

@mashhurs mashhurs Jan 24, 2025

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!
image

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mashhurs

@mashhurs mashhurs requested a review from yaauie January 24, 2025 20:36
Copy link
Member

@yaauie yaauie left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@mashhurs mashhurs merged commit 021e8c7 into elastic:main Jan 27, 2025
2 checks passed
@mashhurs mashhurs deleted the log-improvements-when-versions-mismatch branch January 27, 2025 21:49
@mashhurs
Copy link
Collaborator Author

@logstashmachine backport 8.x

github-actions bot pushed a commit that referenced this pull request Jan 27, 2025
… 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)
@mashhurs
Copy link
Collaborator Author

@logstashmachine backport 8.16

github-actions bot pushed a commit that referenced this pull request Jan 27, 2025
… 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)
@mashhurs
Copy link
Collaborator Author

@logstashmachine backport 8.17

github-actions bot pushed a commit that referenced this pull request Jan 28, 2025
… 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)
mashhurs added a commit that referenced this pull request Jan 28, 2025
… 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]>
mashhurs added a commit that referenced this pull request Jan 28, 2025
… 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]>
mashhurs added a commit that referenced this pull request Jan 28, 2025
… 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logging improvements when embedded vs querying ES version mismatch

3 participants