Skip to content

Commit d943273

Browse files
authored
Fix msg not found error. (#13)
1 parent 3dfd208 commit d943273

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/fluent/plugin/in_protobuf_http.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,10 @@ def get_msg_types(compiled_proto)
116116
log.debug("Extracting message types [#{compiled_proto}]...")
117117
msg_types = []
118118
File.foreach(compiled_proto) do |line|
119-
if line.lstrip.start_with?('add_message')
120-
msg_type = line[/"([^"]*)"/, 1] # regex: <add_message> 'msg_type' <do>
121-
msg_types.push(msg_type) unless msg_type.nil?
119+
line.strip!
120+
if line.include?('::Google::Protobuf::DescriptorPool.generated_pool.lookup') && line.end_with?('.msgclass')
121+
extracted_msg_type = line[/"([^"]*)"/, 1].freeze
122+
msg_types.push(extracted_msg_type) unless extracted_msg_type.nil?
122123
end
123124
end
124125

0 commit comments

Comments
 (0)