logstash-input-azure_event_hubs 1.1.3 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -1
- data/LICENSE +2 -1
- data/VERSION +1 -1
- data/lib/logstash/inputs/azure_event_hubs.rb +17 -15
- data/lib/logstash/inputs/error_notification_handler.rb +3 -4
- data/lib/logstash/inputs/look_back_position_provider.rb +5 -4
- data/lib/logstash/inputs/processor.rb +1 -1
- data/lib/logstash/inputs/processor_factory.rb +1 -3
- data/logstash-input-azure_event_hubs.gemspec +1 -1
- data/spec/inputs/azure_event_hub_spec.rb +12 -20
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 504e5a3185917fb8bad235bc1c9198919be6186d2ce5c40b4a26679fb4cd2a6a
|
4
|
+
data.tar.gz: 3b50e6b5485c8af058624264881a9c0ba43f916861774582d1e021e98339305d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c9307f7a58a4cb971f1a3417740e47aec017de26c4554df0f5ddeb18d1cd44e3f1220f00e2dd3dfb1a228402cf06c810d8840998bdef9f985ac17fa4d69004c
|
7
|
+
data.tar.gz: 4bad8dbe16d7169093fd93d644957ce10dfbde9ff3898cb4b408ef82f6befc494a77c9aa7bf9ba53904acb77dbdf80b4d3465288fb9d40653f3a330df107428d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
## 1.2.3
|
2
|
+
- Fixed missing configuration of `prefetch_count` and `receive_timeout` [#61](https://github.com/logstash-plugins/logstash-input-azure_event_hubs/pull/61)
|
3
|
+
|
4
|
+
## 1.2.2
|
5
|
+
- Refactor: scope and review global java_imports [#57](https://github.com/logstash-plugins/logstash-input-azure_event_hubs/pull/57)
|
6
|
+
|
7
|
+
## 1.2.1
|
8
|
+
- [DOC] Changed documentation to update the default number of threads [#55](https://github.com/logstash-plugins/logstash-input-azure_event_hubs/pull/55)
|
9
|
+
|
10
|
+
## 1.2.0
|
11
|
+
- Changed the default number of threads from `4` to `16` to match the default number from the Azure-Sdk EventProcessorHost [#54](https://github.com/logstash-plugins/logstash-input-azure_event_hubs/pull/54)
|
12
|
+
|
13
|
+
## 1.1.4
|
14
|
+
- Fixed missing configuration of the `max_batch_size`setting [#52](https://github.com/logstash-plugins/logstash-input-azure_event_hubs/pull/52)
|
15
|
+
|
1
16
|
## 1.1.3
|
2
17
|
- [DOC] Added clarification for threads parameter [#50](https://github.com/logstash-plugins/logstash-input-azure_event_hubs/pull/50)
|
3
18
|
|
@@ -25,6 +40,6 @@
|
|
25
40
|
## 1.0.1
|
26
41
|
- Fixed logging for exception handler
|
27
42
|
|
28
|
-
## 1.0.0
|
43
|
+
## 1.0.0
|
29
44
|
- Initial release of `logstash-input-azure_event_hubs` supersedes `logstash-input-azureeventhub`
|
30
45
|
- Re-implementation that uses Event Processor Host API and new configuration options.
|
data/LICENSE
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
Apache License
|
2
3
|
Version 2.0, January 2004
|
3
4
|
http://www.apache.org/licenses/
|
@@ -186,7 +187,7 @@
|
|
186
187
|
same "printed page" as the copyright notice for easier
|
187
188
|
identification within third-party archives.
|
188
189
|
|
189
|
-
Copyright
|
190
|
+
Copyright 2020 Elastic and contributors
|
190
191
|
|
191
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
192
193
|
you may not use this file except in compliance with the License.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.3
|
@@ -8,18 +8,18 @@ require "logstash/inputs/error_notification_handler"
|
|
8
8
|
require "logstash/inputs/named_thread_factory"
|
9
9
|
require "logstash/inputs/look_back_position_provider"
|
10
10
|
|
11
|
+
class LogStash::Inputs::AzureEventHubs < LogStash::Inputs::Base
|
11
12
|
|
12
|
-
java_import com.microsoft.azure.eventprocessorhost.EventProcessorHost
|
13
|
-
java_import com.microsoft.azure.eventprocessorhost.EventProcessorOptions
|
14
|
-
java_import com.microsoft.azure.eventprocessorhost.InMemoryCheckpointManager
|
15
|
-
java_import com.microsoft.azure.eventprocessorhost.InMemoryLeaseManager
|
16
|
-
java_import com.microsoft.azure.eventprocessorhost.HostContext
|
17
|
-
java_import com.microsoft.azure.eventhubs.ConnectionStringBuilder
|
18
|
-
java_import java.util.concurrent.Executors
|
19
|
-
java_import java.util.concurrent.TimeUnit
|
20
|
-
|
13
|
+
java_import com.microsoft.azure.eventprocessorhost.EventProcessorHost
|
14
|
+
java_import com.microsoft.azure.eventprocessorhost.EventProcessorOptions
|
15
|
+
java_import com.microsoft.azure.eventprocessorhost.InMemoryCheckpointManager
|
16
|
+
java_import com.microsoft.azure.eventprocessorhost.InMemoryLeaseManager
|
17
|
+
java_import com.microsoft.azure.eventprocessorhost.HostContext
|
18
|
+
java_import com.microsoft.azure.eventhubs.ConnectionStringBuilder
|
19
|
+
java_import java.util.concurrent.Executors
|
20
|
+
java_import java.util.concurrent.TimeUnit
|
21
|
+
java_import java.time.Duration
|
21
22
|
|
22
|
-
class LogStash::Inputs::AzureEventHubs < LogStash::Inputs::Base
|
23
23
|
config_name "azure_event_hubs"
|
24
24
|
|
25
25
|
# This plugin supports two styles of configuration
|
@@ -111,9 +111,9 @@ class LogStash::Inputs::AzureEventHubs < LogStash::Inputs::Base
|
|
111
111
|
|
112
112
|
# Total threads used process events. Requires at minimum 2 threads. This option can not be set per Event Hub.
|
113
113
|
# azure_event_hubs {
|
114
|
-
# threads =>
|
114
|
+
# threads => 16
|
115
115
|
# }
|
116
|
-
config :threads, :validate => :number, :default =>
|
116
|
+
config :threads, :validate => :number, :default => 16
|
117
117
|
|
118
118
|
# Consumer group used to read the Event Hub(s). It is recommended to change from the $Default to a consumer group specifically for Logstash, and ensure that all instances of Logstash use that consumer group.
|
119
119
|
# basic Example:
|
@@ -291,7 +291,7 @@ class LogStash::Inputs::AzureEventHubs < LogStash::Inputs::Base
|
|
291
291
|
# }
|
292
292
|
config :decorate_events, :validate => :boolean, :default => false
|
293
293
|
|
294
|
-
attr_reader :count
|
294
|
+
attr_reader :count
|
295
295
|
|
296
296
|
def initialize(params)
|
297
297
|
|
@@ -409,6 +409,10 @@ class LogStash::Inputs::AzureEventHubs < LogStash::Inputs::Base
|
|
409
409
|
checkpoint_manager.java_send :initialize, [HostContext], event_processor_host.getHostContext
|
410
410
|
end
|
411
411
|
options = EventProcessorOptions.new
|
412
|
+
options.setMaxBatchSize(max_batch_size)
|
413
|
+
options.setPrefetchCount(prefetch_count)
|
414
|
+
options.setReceiveTimeOut(Duration.ofSeconds(receive_timeout))
|
415
|
+
|
412
416
|
options.setExceptionNotification(LogStash::Inputs::Azure::ErrorNotificationHandler.new)
|
413
417
|
case @initial_position
|
414
418
|
when 'beginning'
|
@@ -475,5 +479,3 @@ class LogStash::Inputs::AzureEventHubs < LogStash::Inputs::Base
|
|
475
479
|
end
|
476
480
|
end
|
477
481
|
end
|
478
|
-
|
479
|
-
|
@@ -1,12 +1,11 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "logstash/util/loggable"
|
3
|
-
java_import java.util.function.Consumer
|
4
3
|
|
5
4
|
module LogStash
|
6
5
|
module Inputs
|
7
6
|
module Azure
|
8
7
|
class ErrorNotificationHandler
|
9
|
-
include Consumer
|
8
|
+
include java.util.function.Consumer
|
10
9
|
include LogStash::Util::Loggable
|
11
10
|
|
12
11
|
def initialize
|
@@ -14,9 +13,9 @@ module LogStash
|
|
14
13
|
end
|
15
14
|
|
16
15
|
def accept(exception_received_event_args)
|
17
|
-
@logger.error("Error with Event Processor Host. ",
|
16
|
+
@logger.error("Error with Event Processor Host. ",
|
18
17
|
:host_name => exception_received_event_args.getHostname(),
|
19
|
-
:action => exception_received_event_args.getAction(),
|
18
|
+
:action => exception_received_event_args.getAction(),
|
20
19
|
:exception => exception_received_event_args.getException().toString())
|
21
20
|
end
|
22
21
|
end
|
@@ -1,14 +1,15 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "logstash/util/loggable"
|
3
|
-
java_import java.util.function.Function
|
4
|
-
java_import com.microsoft.azure.eventhubs.EventPosition
|
5
|
-
java_import java.time.Instant
|
6
3
|
|
7
4
|
module LogStash
|
8
5
|
module Inputs
|
9
6
|
module Azure
|
10
7
|
class LookBackPositionProvider
|
11
|
-
|
8
|
+
|
9
|
+
java_import com.microsoft.azure.eventhubs.EventPosition
|
10
|
+
java_import java.time.Instant
|
11
|
+
|
12
|
+
include java.util.function.Function
|
12
13
|
include LogStash::Util::Loggable
|
13
14
|
|
14
15
|
def initialize(look_back_seconds)
|
@@ -26,7 +26,7 @@ module LogStash
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def onEvents(context, batch)
|
29
|
-
@logger.debug("Event Hub: #{context.getEventHubPath.to_s}, Partition: #{context.getPartitionId.to_s} is processing a batch.") if @logger.debug?
|
29
|
+
@logger.debug("Event Hub: #{context.getEventHubPath.to_s}, Partition: #{context.getPartitionId.to_s} is processing a batch of size #{batch.size}.") if @logger.debug?
|
30
30
|
last_payload = nil
|
31
31
|
batch_size = 0
|
32
32
|
batch.each do |payload|
|
@@ -24,5 +24,5 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_runtime_dependency 'logstash-codec-plain'
|
25
25
|
s.add_runtime_dependency 'logstash-codec-json'
|
26
26
|
s.add_runtime_dependency 'stud', '>= 0.0.22'
|
27
|
-
s.add_development_dependency 'logstash-devutils', '>= 0.0
|
27
|
+
s.add_development_dependency 'logstash-devutils', '>= 1.0.0'
|
28
28
|
end
|
@@ -2,16 +2,9 @@
|
|
2
2
|
require "logstash/devutils/rspec/spec_helper"
|
3
3
|
require "logstash/inputs/azure_event_hubs"
|
4
4
|
|
5
|
-
|
6
5
|
java_import com.microsoft.azure.eventprocessorhost.EventProcessorHost
|
7
|
-
java_import com.microsoft.azure.eventprocessorhost.EventProcessorOptions
|
8
6
|
java_import com.microsoft.azure.eventprocessorhost.InMemoryCheckpointManager
|
9
7
|
java_import com.microsoft.azure.eventprocessorhost.InMemoryLeaseManager
|
10
|
-
java_import java.util.concurrent.ScheduledThreadPoolExecutor
|
11
|
-
java_import java.util.concurrent.CompletableFuture
|
12
|
-
java_import java.util.concurrent.TimeUnit
|
13
|
-
java_import java.util.concurrent.atomic.AtomicInteger
|
14
|
-
|
15
8
|
|
16
9
|
describe LogStash::Inputs::AzureEventHubs do
|
17
10
|
|
@@ -28,7 +21,7 @@ describe LogStash::Inputs::AzureEventHubs do
|
|
28
21
|
expect(exploded_config[i]['event_hub_connections'][0].value).to start_with('Endpoint=sb://...')
|
29
22
|
expect(exploded_config[i]['storage_connection'].value).to eql('DefaultEndpointsProtocol=https;AccountName=...')
|
30
23
|
expect(exploded_config[i]['threads']).to be == 9
|
31
|
-
expect(exploded_config[i]['codec']).to
|
24
|
+
expect(exploded_config[i]['codec'].class.to_s).to eq("LogStash::Codecs::Plain")
|
32
25
|
expect(exploded_config[i]['consumer_group']).to eql('cg')
|
33
26
|
expect(exploded_config[i]['max_batch_size']).to be == 20
|
34
27
|
expect(exploded_config[i]['prefetch_count']).to be == 30
|
@@ -67,7 +60,7 @@ describe LogStash::Inputs::AzureEventHubs do
|
|
67
60
|
mock_queue = double("queue")
|
68
61
|
mock_host = double("event_processor_host")
|
69
62
|
mock_host_context = double("host_context")
|
70
|
-
completable_future = CompletableFuture.new
|
63
|
+
completable_future = java.util.concurrent.CompletableFuture.new
|
71
64
|
#simulate work being done before completing the future
|
72
65
|
Thread.new do
|
73
66
|
sleep 2
|
@@ -75,10 +68,10 @@ describe LogStash::Inputs::AzureEventHubs do
|
|
75
68
|
end
|
76
69
|
|
77
70
|
# rspec has issues with counters and concurrent code, so use threadsafe counters instead
|
78
|
-
host_counter = AtomicInteger.new
|
79
|
-
register_counter = AtomicInteger.new
|
80
|
-
unregister_counter = AtomicInteger.new
|
81
|
-
assertion_count = AtomicInteger.new
|
71
|
+
host_counter = java.util.concurrent.atomic.AtomicInteger.new
|
72
|
+
register_counter = java.util.concurrent.atomic.AtomicInteger.new
|
73
|
+
unregister_counter = java.util.concurrent.atomic.AtomicInteger.new
|
74
|
+
assertion_count = java.util.concurrent.atomic.AtomicInteger.new
|
82
75
|
|
83
76
|
allow(mock_host).to receive(:getHostContext) {mock_host_context}
|
84
77
|
allow(mock_host_context).to receive(:getEventHubPath) {"foo"}
|
@@ -186,7 +179,7 @@ describe LogStash::Inputs::AzureEventHubs do
|
|
186
179
|
expect(exploded_config[1]['event_hub_connections'][0].value).to eql('1Endpoint=sb://...')
|
187
180
|
expect(exploded_config[1]['storage_connection'].value).to eql('1DefaultEndpointsProtocol=https;AccountName=...')
|
188
181
|
expect(exploded_config[1]['threads']).to be == 9
|
189
|
-
expect(exploded_config[1]['codec']).to
|
182
|
+
expect(exploded_config[1]['codec'].class.to_s).to eq("LogStash::Codecs::JSON") # different between configs
|
190
183
|
expect(exploded_config[1]['consumer_group']).to eql('cg1') # override global
|
191
184
|
expect(exploded_config[1]['max_batch_size']).to be == 21 # filled from global
|
192
185
|
expect(exploded_config[1]['prefetch_count']).to be == 300 # default
|
@@ -202,7 +195,7 @@ describe LogStash::Inputs::AzureEventHubs do
|
|
202
195
|
mock_queue = double("queue")
|
203
196
|
mock_host = double("event_processor_host")
|
204
197
|
mock_host_context = double("host_context")
|
205
|
-
completable_future = CompletableFuture.new
|
198
|
+
completable_future = java.util.concurrent.CompletableFuture.new
|
206
199
|
#simulate work being done before completing the future
|
207
200
|
Thread.new do
|
208
201
|
sleep 2
|
@@ -210,10 +203,10 @@ describe LogStash::Inputs::AzureEventHubs do
|
|
210
203
|
end
|
211
204
|
|
212
205
|
# rspec has issues with counters and concurrent code, so use threadsafe counters instead
|
213
|
-
host_counter = AtomicInteger.new
|
214
|
-
register_counter = AtomicInteger.new
|
215
|
-
unregister_counter = AtomicInteger.new
|
216
|
-
assertion_count = AtomicInteger.new
|
206
|
+
host_counter = java.util.concurrent.atomic.AtomicInteger.new
|
207
|
+
register_counter = java.util.concurrent.atomic.AtomicInteger.new
|
208
|
+
unregister_counter = java.util.concurrent.atomic.AtomicInteger.new
|
209
|
+
assertion_count = java.util.concurrent.atomic.AtomicInteger.new
|
217
210
|
allow_any_instance_of(InMemoryLeaseManager).to receive(:java_send)
|
218
211
|
allow_any_instance_of(InMemoryCheckpointManager).to receive(:java_send)
|
219
212
|
|
@@ -319,4 +312,3 @@ describe LogStash::Inputs::AzureEventHubs do
|
|
319
312
|
end
|
320
313
|
end
|
321
314
|
end
|
322
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-azure_event_hubs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,7 +71,7 @@ dependencies:
|
|
71
71
|
requirements:
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.0
|
74
|
+
version: 1.0.0
|
75
75
|
name: logstash-devutils
|
76
76
|
prerelease: false
|
77
77
|
type: :development
|
@@ -79,7 +79,7 @@ dependencies:
|
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.0
|
82
|
+
version: 1.0.0
|
83
83
|
description: This gem is a Logstash plugin required to be installed on top of the
|
84
84
|
Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
|
85
85
|
gem is not a stand-alone program
|