Use JSON serialization for DLQ error messages instead of Ruby object inspection#1251
Draft
Use JSON serialization for DLQ error messages instead of Ruby object inspection#1251
Conversation
Replace Ruby's to_s representation with LogStash::Json.dump for action_params and response in handle_dlq_response, producing consistent JSON output across JRuby 9 and 10. Update tests to use simple include assertions on JSON key-value pairs instead of complex version-sensitive regexes. Co-authored-by: jsvd <31809+jsvd@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update regex for reason matching in Elasticsearch spec to support JRuby 10
Use JSON serialization for DLQ error messages instead of Ruby object inspection
Mar 20, 2026
💚 Build Succeeded
Historycc @jsvd @Copilot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The DLQ error message in
handle_dlq_responseused Ruby'sto_son hashes, which changed format between JRuby 9 ("key"=>"value") and JRuby 10 ("key": "value"), causing brittle regex-based test assertions.Changes
lib/logstash/plugin_mixins/elasticsearch/common.rb: Replace string interpolation ofaction_paramsandresponsewithLogStash::Json.dump(...), producing stable JSON output across JRuby versions:spec/unit/outputs/elasticsearch_spec.rb: Replace the version-sensitive regex with straightforwardincludeassertions on JSON key-value pairs:✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.