logstash-input-http 4.0.0-java → 4.1.1-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c406f5e0d989c833db3c35529b4012053539955f830fde6ca9e44235f4a39d3b
4
- data.tar.gz: 22916a6402a2c55edfbee1bf3af0a578b630d2fd756356733bfc0c7de3359fdf
3
+ metadata.gz: 5995f6ffdb09de7e3482f265836ce1053be15f8aa2704a4080537be0b2f26abf
4
+ data.tar.gz: 23763ff5feb081d03d0bb899782ba8cd2d26f3c1bbd36fd387b3126f2dc4f671
5
5
  SHA512:
6
- metadata.gz: 2c2616bcde330f2d0a2d0f4273f45e7bd2ad7e09e3a1322d0c759c146c38e13c92f202b45c4a1df6a19b0b9e1ae46eaaa0e3ec1fc81f5e8421a591479122ab3e
7
- data.tar.gz: 1b4d208dc8e180ee5818270f1ceb36625870d4429b9570102f69beb96c253bc5a64fc3837c90d8960b2bca1391b9b93bff76fd648d67ed27cb8b9b366b238ca2
6
+ metadata.gz: b7397f2fbd52c987b057086e4d14ed7e9cbc9228ea3a54d1e57a92f576df33b97140bf1e0860846638d47a7b3625be997fbdf868c312bfa3c3dcfd4cfb035fff
7
+ data.tar.gz: b57c461e6331abb8c87930a1970d1d139d04aad54de3070d1ed97a709fcee4a3f37676cfed3b3657f3534992718a89c7d3f4fedac17d421cc515fc456c35d1d5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 4.1.1
2
+ - Properly naming netty threads [#191](https://github.com/logstash-plugins/logstash-input-http/pull/191)
3
+
4
+ ## 4.1.0
5
+ - add improved proactive rate-limiting, rejecting new requests when queue has been actively blocking for more than 10 seconds [#186](https://github.com/logstash-plugins/logstash-input-http/pull/186)
6
+ - This is a forward-port of functionality also introduced to the 3.x series in v3.10.0
7
+
1
8
  ## 4.0.0
2
9
  - SSL settings that were marked deprecated in version `3.7.0` are now marked obsolete, and will prevent the plugin from starting.
3
10
  - These settings are:
@@ -11,6 +18,9 @@
11
18
  - `verify_mode`, which should bre replaced by `ssl_client_authentication`
12
19
  - [#182](https://github.com/logstash-plugins/logstash-input-http/pull/182)
13
20
 
21
+ ## 3.10.0
22
+ - add improved proactive rate-limiting, rejecting new requests when queue has been actively blocking for more than 10 seconds [#179](https://github.com/logstash-plugins/logstash-input-http/pull/179)
23
+
14
24
  ## 3.9.2
15
25
  - Upgrade netty to 4.1.115 [#183](https://github.com/logstash-plugins/logstash-input-http/pull/183)
16
26
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.0
1
+ 4.1.1
@@ -324,7 +324,8 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
324
324
 
325
325
  def create_http_server(message_handler)
326
326
  org.logstash.plugins.inputs.http.NettyHttpServer.new(
327
- @host, @port, message_handler, build_ssl_params, @threads, @max_pending_requests, @max_content_length, @response_code)
327
+ @id, @host, @port, message_handler, build_ssl_params, @threads,
328
+ @max_pending_requests, @max_content_length, @response_code)
328
329
  end
329
330
 
330
331
  def build_ssl_params
@@ -8,4 +8,4 @@ require_jar('io.netty', 'netty-common', '4.1.115.Final')
8
8
  require_jar('io.netty', 'netty-transport', '4.1.115.Final')
9
9
  require_jar('io.netty', 'netty-handler', '4.1.115.Final')
10
10
  require_jar('io.netty', 'netty-transport-native-unix-common', '4.1.115.Final')
11
- require_jar('org.logstash.plugins.input.http', 'logstash-input-http', '4.0.0')
11
+ require_jar('org.logstash.plugins.input.http', 'logstash-input-http', '4.1.1')
@@ -3,4 +3,8 @@ CERTS_DIR = File.expand_path('../fixtures/certs/generated', File.dirname(__FILE_
3
3
 
4
4
  def certificate_path(filename)
5
5
  File.join(CERTS_DIR, filename)
6
- end
6
+ end
7
+
8
+ RSpec.configure do |config|
9
+ config.formatter = :documentation
10
+ end
@@ -57,7 +57,7 @@ describe LogStash::Inputs::Http do
57
57
  let(:config) { { "port" => port, "threads" => threads, "max_pending_requests" => max_pending_requests } }
58
58
 
59
59
  context "when sending more requests than queue slots" do
60
- it "should block when the queue is full" do
60
+ it "rejects additional incoming requests with HTTP 429" do
61
61
  # these will queue and return 200
62
62
  logstash_queue_size.times.each do |i|
63
63
  response = client.post("http://127.0.0.1:#{port}", :body => '{}').call
@@ -65,15 +65,77 @@ describe LogStash::Inputs::Http do
65
65
  end
66
66
 
67
67
  # these will block
68
- (threads + max_pending_requests).times.each do |i|
69
- expect {
70
- client.post("http://127.0.0.1:#{port}", :body => '{}').call
71
- }.to raise_error(Manticore::SocketTimeout)
68
+ blocked_calls = (threads + max_pending_requests).times.map do
69
+ Thread.new do
70
+ begin
71
+ {:result => client.post("http://127.0.0.1:#{port}", :body => '{}').call}
72
+ rescue Manticore::SocketException, Manticore::SocketTimeout => e
73
+ {:exception => e}
74
+ end
75
+ end
76
+ end
77
+
78
+ sleep 1 # let those requests go, but not so long that our block-detector starts emitting 429's
79
+
80
+ # by now we should be rejecting with 429 since the backlog is full
81
+ response = client.post("http://127.0.0.1:#{port}", :body => '{}').call
82
+ expect(response.code).to eq(429)
83
+
84
+ # ensure that our blocked connections did block
85
+ aggregate_failures do
86
+ blocked_calls.map(&:value).each do |blocked|
87
+ expect(blocked[:result]).to be_nil
88
+ expect(blocked[:exception]).to be_a_kind_of Manticore::SocketTimeout
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+
95
+ describe "observing queue back-pressure" do
96
+ let(:logstash_queue_size) { rand(10) + 1 }
97
+ let(:max_pending_requests) { rand(5) + 1 }
98
+ let(:threads) { rand(4) + 1 }
99
+ let(:logstash_queue) { SizedQueue.new(logstash_queue_size) }
100
+ let(:client_options) { {
101
+ "request_timeout" => 0.1,
102
+ "connect_timeout" => 3,
103
+ "socket_timeout" => 0.1
104
+ } }
105
+
106
+ let(:config) { { "port" => port, "threads" => threads, "max_pending_requests" => max_pending_requests } }
107
+
108
+ context "when sending request to an input that has blocked connections" do
109
+ it "rejects incoming requests with HTTP 429" do
110
+ # these will queue and return 200
111
+ logstash_queue_size.times.each do |i|
112
+ response = client.post("http://127.0.0.1:#{port}", :body => '{}').call
113
+ expect(response.code).to eq(200)
72
114
  end
73
115
 
74
- # by now we should be rejecting with 429
116
+ # these will block
117
+ blocked_call = Thread.new do
118
+ begin
119
+ {:result => client.post("http://127.0.0.1:#{port}", :body => '{}').call}
120
+ rescue Manticore::SocketException, Manticore::SocketTimeout => e
121
+ {:exception => e}
122
+ end
123
+ end
124
+
125
+ sleep 12 # let that requests go, and ensure it is blocking long enough to be problematic
126
+
127
+ # by now we should be rejecting with 429 since at least one existing request is blocked
128
+ # for more than 10s.
75
129
  response = client.post("http://127.0.0.1:#{port}", :body => '{}').call
76
130
  expect(response.code).to eq(429)
131
+
132
+ # ensure that our blocked connections did block
133
+ aggregate_failures do
134
+ blocked_call.value.tap do |blocked|
135
+ expect(blocked[:result]).to be_nil
136
+ expect(blocked[:exception]).to be_a_kind_of Manticore::SocketTimeout
137
+ end
138
+ end
77
139
  end
78
140
  end
79
141
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.1
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-18 00:00:00.000000000 Z
11
+ date: 2025-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -176,7 +176,7 @@ files:
176
176
  - vendor/jar-dependencies/io/netty/netty-handler/4.1.115.Final/netty-handler-4.1.115.Final.jar
177
177
  - vendor/jar-dependencies/io/netty/netty-transport-native-unix-common/4.1.115.Final/netty-transport-native-unix-common-4.1.115.Final.jar
178
178
  - vendor/jar-dependencies/io/netty/netty-transport/4.1.115.Final/netty-transport-4.1.115.Final.jar
179
- - vendor/jar-dependencies/org/logstash/plugins/input/http/logstash-input-http/4.0.0/logstash-input-http-4.0.0.jar
179
+ - vendor/jar-dependencies/org/logstash/plugins/input/http/logstash-input-http/4.1.1/logstash-input-http-4.1.1.jar
180
180
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
181
181
  licenses:
182
182
  - Apache License (2.0)