Skip to content
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

Backport PR #16313 to 8.14: Json normalization performance #16315

Draft
wants to merge 1 commit into
base: 8.14
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions logstash-core/lib/logstash/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# under the License.

require "logstash/environment"
require "logstash/util/unicode_normalizer"
require "jrjackson"

module LogStash
Expand Down Expand Up @@ -51,7 +50,12 @@ def jruby_dump(o, options = {})
def normalize_encoding(data)
case data
when String
LogStash::UnicodeNormalizer.normalize_string_encoding(data)
if data.encoding == Encoding::ASCII_8BIT
# when given BINARY-flagged string, assume it is UTF-8 so that
# subsequent cleanup retains valid UTF-8 sequences
data = data.dup.force_encoding(Encoding::UTF_8)
end
data
when Array
data.map { |item| normalize_encoding(item) }
when Hash
Expand Down
38 changes: 0 additions & 38 deletions logstash-core/lib/logstash/util/unicode_normalizer.rb

This file was deleted.

2 changes: 1 addition & 1 deletion spec/compliance/license_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/ruby/,
/lgpl/,
/epl/,
/elastic/i
/elastic|elv2/i
])
}

Expand Down