Skip to content

Commit 4e46d3e

Browse files
committed
perf: reuse inner packforward payload unpacker
1 parent 8555a42 commit 4e46d3e

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 3.4.3
2+
- Fix: reduce overhead of unpacking packforward-payloads by reusing a single instance
3+
14
## 3.4.2
25
- Fix: Convert LogStash::Timestamp values to iso-8601 to resolve crash issue with `msgpack` serialization [#30](https://github.com/logstash-plugins/logstash-codec-fluent/pull/30)
36

lib/logstash/codecs/fluent.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def register
5454
end
5555
@packer = @factory.packer
5656
@decoder = @factory.unpacker
57+
@packforward_decoder = nil
5758
end
5859

5960
def decode(data, &block)
@@ -116,7 +117,7 @@ def decode_event(data, &block)
116117
raise(LogStash::Error, "PackedForward with compression is not supported")
117118
end
118119

119-
entries_decoder = @factory.unpacker
120+
entries_decoder = (@packforward_decoder ||= @factory.unpacker).tap(&:reset)
120121
entries_decoder.feed_each(entries) do |entry|
121122
yield generate_event(entry[1], entry[0], tag)
122123
end

logstash-codec-fluent.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Gem::Specification.new do |s|
22

33
s.name = 'logstash-codec-fluent'
4-
s.version = '3.4.2'
4+
s.version = '3.4.3'
55
s.licenses = ['Apache License (2.0)']
66
s.summary = "Reads the `fluentd` `msgpack` schema"
77
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"

0 commit comments

Comments
 (0)