File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,10 @@ def csv_for_thread
112
112
def csv_thread_key
113
113
raise NotImplementedError , "Compat CsvFormatter does not support CSV cache. Do not use this method."
114
114
end
115
+
116
+ def csv_cacheable?
117
+ false
118
+ end
115
119
end
116
120
117
121
class SingleValueFormatter < Fluent ::Plugin ::SingleValueFormatter
Original file line number Diff line number Diff line change @@ -35,12 +35,20 @@ class CsvFormatter < Formatter
35
35
config_param :fields , :array , value_type : :string
36
36
config_param :add_newline , :bool , default : true
37
37
38
+ def csv_cacheable?
39
+ owner ? true : false
40
+ end
41
+
38
42
def csv_thread_key
39
- "#{ owner . plugin_id } _csv_formatter_#{ @usage } _csv"
43
+ csv_cacheable? ? "#{ owner . plugin_id } _csv_formatter_#{ @usage } _csv" : nil
40
44
end
41
45
42
46
def csv_for_thread
43
- Thread . current [ csv_thread_key ] ||= CSV . new ( "" . force_encoding ( Encoding ::ASCII_8BIT ) , **@generate_opts )
47
+ if csv_cacheable?
48
+ Thread . current [ csv_thread_key ] ||= CSV . new ( "" . force_encoding ( Encoding ::ASCII_8BIT ) , **@generate_opts )
49
+ else
50
+ CSV . new ( "" . force_encoding ( Encoding ::ASCII_8BIT ) , **@generate_opts )
51
+ end
44
52
end
45
53
46
54
def configure ( conf )
You can’t perform that action at this time.
0 commit comments