logstash-input-azure_event_hubs 1.1.4 → 1.3.0
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 +16 -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 -0
- 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: 7d4912fed67f958fd8ae63335bea88a35cea37b9dd42acfbd57a053544ccfa14
|
4
|
+
data.tar.gz: 4dc5b535f4498f09ccd8c5487637b5f480d6ab41bdf6c8ce48f1f1b3f7d87cff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7867920f3d3a00106d69a1ad3c94b8577b441addd6f2cddcf65c36f73835e4ee82d0db4cefd2962598c9d75cbfbfbab726dec437c2b7ffc82537a8e95ea1f2f6
|
7
|
+
data.tar.gz: cd2590603352dfd1207ab02ee4f5b4413de332d66ef58a3c3efcdde8d89046c3e8d9b923f04b13ce4e9b6fd12b39e52c25c32374ce40e7dbc27017414f887f22
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
## 1.3.0
|
2
|
+
- Add EventHub `user properties` in `@metadata` object [#66](https://github.com/logstash-plugins/logstash-input-azure_event_hubs/pull/66)
|
3
|
+
|
4
|
+
## 1.2.3
|
5
|
+
- Fixed missing configuration of `prefetch_count` and `receive_timeout` [#61](https://github.com/logstash-plugins/logstash-input-azure_event_hubs/pull/61)
|
6
|
+
|
7
|
+
## 1.2.2
|
8
|
+
- Refactor: scope and review global java_imports [#57](https://github.com/logstash-plugins/logstash-input-azure_event_hubs/pull/57)
|
9
|
+
|
10
|
+
## 1.2.1
|
11
|
+
- [DOC] Changed documentation to update the default number of threads [#55](https://github.com/logstash-plugins/logstash-input-azure_event_hubs/pull/55)
|
12
|
+
|
13
|
+
## 1.2.0
|
14
|
+
- 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)
|
15
|
+
|
1
16
|
## 1.1.4
|
2
17
|
- Fixed missing configuration of the `max_batch_size`setting [#52](https://github.com/logstash-plugins/logstash-input-azure_event_hubs/pull/52)
|
3
18
|
|
@@ -28,6 +43,6 @@
|
|
28
43
|
## 1.0.1
|
29
44
|
- Fixed logging for exception handler
|
30
45
|
|
31
|
-
## 1.0.0
|
46
|
+
## 1.0.0
|
32
47
|
- Initial release of `logstash-input-azure_event_hubs` supersedes `logstash-input-azureeventhub`
|
33
48
|
- 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.3.0
|
@@ -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
|
|
@@ -410,6 +410,9 @@ class LogStash::Inputs::AzureEventHubs < LogStash::Inputs::Base
|
|
410
410
|
end
|
411
411
|
options = EventProcessorOptions.new
|
412
412
|
options.setMaxBatchSize(max_batch_size)
|
413
|
+
options.setPrefetchCount(prefetch_count)
|
414
|
+
options.setReceiveTimeOut(Duration.ofSeconds(receive_timeout))
|
415
|
+
|
413
416
|
options.setExceptionNotification(LogStash::Inputs::Azure::ErrorNotificationHandler.new)
|
414
417
|
case @initial_position
|
415
418
|
when 'beginning'
|
@@ -476,5 +479,3 @@ class LogStash::Inputs::AzureEventHubs < LogStash::Inputs::Base
|
|
476
479
|
end
|
477
480
|
end
|
478
481
|
end
|
479
|
-
|
480
|
-
|
@@ -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)
|
@@ -48,6 +48,7 @@ module LogStash
|
|
48
48
|
event.set("[@metadata][azure_event_hubs][sequence]", payload.getSystemProperties.getSequenceNumber)
|
49
49
|
event.set("[@metadata][azure_event_hubs][timestamp]",payload.getSystemProperties.getEnqueuedTime.getEpochSecond)
|
50
50
|
event.set("[@metadata][azure_event_hubs][event_size]", bytes.size)
|
51
|
+
event.set("[@metadata][azure_event_hubs][user_properties]", payload.getProperties)
|
51
52
|
end
|
52
53
|
@queue << event
|
53
54
|
if @checkpoint_interval > 0
|
@@ -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.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-02 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
|