logstash-input-http 4.0.0-java → 4.1.0-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c406f5e0d989c833db3c35529b4012053539955f830fde6ca9e44235f4a39d3b
4
- data.tar.gz: 22916a6402a2c55edfbee1bf3af0a578b630d2fd756356733bfc0c7de3359fdf
3
+ metadata.gz: fe102365f0992c7be2664c393bb5678e17980fe6f66d35d8027a3b2a90d572d9
4
+ data.tar.gz: 52408f65829a38c1737ed7bb06a7b01ec1f1b1038bf36cd1e610d8c490ac723c
5
5
  SHA512:
6
- metadata.gz: 2c2616bcde330f2d0a2d0f4273f45e7bd2ad7e09e3a1322d0c759c146c38e13c92f202b45c4a1df6a19b0b9e1ae46eaaa0e3ec1fc81f5e8421a591479122ab3e
7
- data.tar.gz: 1b4d208dc8e180ee5818270f1ceb36625870d4429b9570102f69beb96c253bc5a64fc3837c90d8960b2bca1391b9b93bff76fd648d67ed27cb8b9b366b238ca2
6
+ metadata.gz: eed5f4bde55202f473b37a0743dc4995c675980fdc365c0b0df230ae209477d6e108ecfb028387cc1c57f826cfd38f9c7e295d30f8ebb07a3d0d6c6819790fe2
7
+ data.tar.gz: 7d72588d9a877920e22d37d7870999ea22b81680f0834179bdef3ab0ebac355337285b2db2c58ee97aaa7f3722ecd8f866770cded3660fef5872921e81f0895a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 4.1.0
2
+ - 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)
3
+ - This is a forward-port of functionality also introduced to the 3.x series in v3.10.0
4
+
1
5
  ## 4.0.0
2
6
  - SSL settings that were marked deprecated in version `3.7.0` are now marked obsolete, and will prevent the plugin from starting.
3
7
  - These settings are:
@@ -11,6 +15,9 @@
11
15
  - `verify_mode`, which should bre replaced by `ssl_client_authentication`
12
16
  - [#182](https://github.com/logstash-plugins/logstash-input-http/pull/182)
13
17
 
18
+ ## 3.10.0
19
+ - 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)
20
+
14
21
  ## 3.9.2
15
22
  - Upgrade netty to 4.1.115 [#183](https://github.com/logstash-plugins/logstash-input-http/pull/183)
16
23
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.0
1
+ 4.1.0
@@ -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.0')
@@ -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.0
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: 2024-12-19 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.0/logstash-input-http-4.1.0.jar
180
180
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
181
181
  licenses:
182
182
  - Apache License (2.0)