Skip to content

Commit 5f8023b

Browse files
author
Juuso Mäyränen
committed
Rename config variables
1 parent 52d5ded commit 5f8023b

File tree

2 files changed

+37
-33
lines changed

2 files changed

+37
-33
lines changed

docs/index.asciidoc

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,18 @@ The unix socket path of your Redis server.
127127

128128
The name of a Redis list or channel.
129129

130-
[id="plugins-{type}s-{plugin}-max_items_per_worker"]
131-
===== `max_items_per_worker`
130+
131+
[id="plugins-{type}s-{plugin}-password"]
132+
===== `password`
133+
134+
* Value type is <<password,password>>
135+
* There is no default value for this setting.
136+
137+
Password to authenticate with. There is no authentication by default.
138+
139+
140+
[id="plugins-{type}s-{plugin}-pattern_list_max_items"]
141+
===== `pattern_list_max_items`
132142

133143
* Value type is <<number,number>>
134144
* Default value is `1000`
@@ -138,13 +148,24 @@ After the list is empty or this number of items have been processed, the thread
138148
new one will be started if there are non-empty lists matching the pattern without a consumer.
139149

140150

141-
[id="plugins-{type}s-{plugin}-password"]
142-
===== `password`
151+
[id="plugins-{type}s-{plugin}-pattern_list_threadpool_sleep"]
152+
===== `pattern_list_threadpool_sleep`
143153

144-
* Value type is <<password,password>>
145-
* There is no default value for this setting.
154+
* Value type is <<number,number>>
155+
* Default value is `0.2`
156+
157+
Time to sleep in main loop after checking if more threads can/need to be spawned.
158+
Applies to `data_type` is `pattern_list`
159+
160+
161+
[id="plugins-{type}s-{plugin}-pattern_list_threads"]
162+
===== `pattern_list_threads`
163+
164+
* Value type is <<number,number>>
165+
* Default value is `20`
166+
167+
Maximum number of worker threads to spawn when using `data_type` `pattern_list`.
146168

147-
Password to authenticate with. There is no authentication by default.
148169

149170
[id="plugins-{type}s-{plugin}-port"]
150171
===== `port`
@@ -154,6 +175,7 @@ Password to authenticate with. There is no authentication by default.
154175

155176
The port to connect on.
156177

178+
157179
[id="plugins-{type}s-{plugin}-ssl"]
158180
===== `ssl`
159181

@@ -163,16 +185,6 @@ The port to connect on.
163185
Enable SSL support.
164186

165187

166-
[id="plugins-{type}s-{plugin}-threadpool_queue_sleep"]
167-
===== `threadpool_queue_sleep`
168-
169-
* Value type is <<number,number>>
170-
* Default value is `0.2`
171-
172-
Time to sleep in main loop after checking if more threads can/need to be spawned.
173-
Applies to `data_type` is `pattern_list`
174-
175-
176188
[id="plugins-{type}s-{plugin}-threads"]
177189
===== `threads`
178190

@@ -189,14 +201,6 @@ Applies to `data_type` is `pattern_list`
189201
Initial connection timeout in seconds.
190202

191203

192-
[id="plugins-{type}s-{plugin}-worker_thread_count"]
193-
===== `worker_thread_count`
194-
195-
* Value type is <<number,number>>
196-
* Default value is `20`
197-
198-
Maximum number of worker threads to spawn when using `data_type` `pattern_list`.
199-
200204

201205
[id="plugins-{type}s-{plugin}-common-options"]
202206
include::{include_path}/{type}.asciidoc[]

lib/logstash/inputs/redis.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@ module LogStash module Inputs class Redis < LogStash::Inputs::Threadable
6565
config :command_map, :validate => :hash, :default => {}
6666

6767
# Maximum number of worker threads to spawn when using `data_type` `pattern_list`.
68-
config :worker_thread_count, :validate => :number, :default => 20
68+
config :pattern_list_threads, :validate => :number, :default => 20
6969

7070
# Maximum number of items for a single worker thread to process when `data_type` is `pattern_list`.
7171
# After the list is empty or this number of items have been processed, the thread will exit and a
7272
# new one will be started if there are non-empty lists matching the pattern without a consumer.
73-
config :max_items_per_worker, :validate => :number, :default => 1000
73+
config :pattern_list_max_items, :validate => :number, :default => 1000
7474

7575
# Time to sleep in main loop after checking if more threads can/need to be spawned.
7676
# Applies to `data_type` is `pattern_list`
77-
config :threadpool_queue_sleep, :validate => :number, :default => 0.2
77+
config :pattern_list_threadpool_sleep, :validate => :number, :default => 0.2
7878

7979
public
8080
# public API
@@ -95,10 +95,10 @@ def new_redis_instance
9595
end
9696

9797
def init_threadpool
98-
@threadpool_queue_max ||= 2 * @worker_thread_count
98+
@threadpool_queue_max ||= 2 * @pattern_list_threads
9999
@threadpool ||= Concurrent::ThreadPoolExecutor.new(
100-
min_threads: @worker_thread_count,
101-
max_threads: @worker_thread_count,
100+
min_threads: @pattern_list_threads,
101+
max_threads: @pattern_list_threads,
102102
max_queue: @threadpool_queue_max
103103
)
104104
@items_processed ||= Concurrent::AtomicFixnum.new
@@ -263,7 +263,7 @@ def worker_consume(output_queue, key)
263263
@logger.debug("Launched worker for #{key}")
264264
redis = new_redis_instance
265265
begin
266-
(0..@max_items_per_worker-1).each do
266+
(0..@pattern_list_max_items-1).each do
267267
if stop?
268268
@logger.debug("Breaking from thread #{key} as it was requested to stop")
269269
break
@@ -320,7 +320,7 @@ def list_pattern_runner(output_queue)
320320
begin
321321
init_list_pattern_runner if @redis.nil?
322322
ensure_workers(output_queue)
323-
sleep(@threadpool_queue_sleep)
323+
sleep(@pattern_list_threadpool_sleep)
324324
rescue ::Redis::BaseError => e
325325
@logger.warn("Redis connection problem", :exception => e)
326326
@redis = nil

0 commit comments

Comments
 (0)