logstash-filter-empowclassifier 0.3.15 → 0.3.16

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: f2b80bd475e12f3e0e88a74a1fa718782e83b26f07b4a89a5c88b625e9adf863
4
- data.tar.gz: d4a09d4b8c26ab17e64f3a99ff5dbaf12f6fc18ef7e84acc198b13aa9563ca87
3
+ metadata.gz: 5fdc06daca07dd3f23c88ea8e939c71ac00971e3dc7cba06a616b54462aec62b
4
+ data.tar.gz: 755b86a17e1d4ae18bc14d7d4f32c04a6785e52a0873acf94bbe54f8ceb9c589
5
5
  SHA512:
6
- metadata.gz: 95b93a9f5b54a078d0723c5472513a3f50fbb4e52b16893838f2f69901f982f71f3e9b96297014d29dd3b0664d65090f3030e1e35d64d95579ad357ce10ff81f
7
- data.tar.gz: 2c5330ff79e5f2b2f819957a16892459bb48cd6907bd2388101e77d565bf1a4ad6f2b038731c098ef0f1feab7933d33429a8a413ed078b7d66637b6f2504d4f7
6
+ metadata.gz: 602b67ab1b4e680a7baaaca336f72b8187106e6f90ab4bdab4797fd4bc8145112c42c7cf7076e1468166f93c4d6ad269a4f3f570a0d9eb0b6f5e82a5409a53a1
7
+ data.tar.gz: a6085a4ca9d744ff670f00346e1fdf00985989106719849ffa3a5e5b5c29cf7d05732c3f15ea5c2396c166d866cb6584ceba8763ef7e6b3f44a60adc562f1e03
@@ -81,7 +81,7 @@ module LogStash
81
81
  begin
82
82
  res = classify_online(requests)
83
83
  rescue StandardError => e
84
- @logger.debug("encountered an unexpected error on the 2nd attempt. #{e}", :error => e)
84
+ @logger.debug("encountered an unexpected error on the 2nd attempt", :error => e)
85
85
 
86
86
  error_message = rescue_http_error_result(e)
87
87
 
@@ -89,7 +89,7 @@ module LogStash
89
89
  end
90
90
 
91
91
  rescue StandardError => e
92
- @logger.error("encountered an unexpected error while query the center. #{e}")
92
+ @logger.error("encountered an unexpected error while querying the center", :error => e)
93
93
 
94
94
  error_message = rescue_http_error_result(e)
95
95
 
@@ -271,7 +271,7 @@ module LogStash; module Filters; module Empow;
271
271
  begin
272
272
  results = @online_classifer.classify(batch)
273
273
  rescue StandardError => e
274
- @logger.error("bulk request ended with a failure, all requests will be removed from queue", :error => e, :backtrace => e.backtrace)
274
+ @logger.debug("bulk request ended with a failure, all requests will be removed from queue", :error => e, :backtrace => e.backtrace)
275
275
 
276
276
  batch.each do |req|
277
277
  @requests_queue.delete(request)
@@ -185,13 +185,13 @@ class LogStash::Filters::EmpowClassifier < LogStash::Filters::Base
185
185
  parked_events = @plugin_core.flush(options)
186
186
 
187
187
  parked_events.each do |event|
188
- # need to clone as original event was canceled
189
- cloned_event = event.clone
190
- events_to_flush << cloned_event
188
+ event.uncancel
189
+
190
+ events_to_flush << event
191
191
  end
192
192
 
193
193
  rescue StandardError => e
194
- @logger.error("encountered an exception while processing flush. #{e}")
194
+ @logger.error("encountered an exception while processing flush", :error => e)
195
195
  end
196
196
 
197
197
  @logger.debug("flush ended", :flushed_event_count => events_to_flush.length)
@@ -206,28 +206,27 @@ class LogStash::Filters::EmpowClassifier < LogStash::Filters::Base
206
206
  res = @plugin_core.classify(event)
207
207
 
208
208
  if res.nil?
209
- event.cancel # don't stream this event just yet ...
210
209
  return
211
210
  end
212
211
 
213
212
  # event was classified and returned, not some overflow event
214
213
  if res.equal? event
215
- filter_matched(event)
214
+ filter_matched(event)
215
+
216
216
  return
217
217
  end
218
218
 
219
219
  # got here with a parked event
220
- res = res.clone
221
220
  filter_matched(res)
222
-
221
+
223
222
  @logger.debug("filter matched for overflow event", :event => res)
224
223
 
224
+ yield res
225
+
225
226
  rescue StandardError => e
226
227
  @logger.error("encountered an exception while classifying", :error => e, :event => event, :backtrace => e.backtrace)
227
228
 
228
229
  @tag_on_error.each{|tag| event.tag(tag)}
229
-
230
- return res
231
230
  end
232
231
  end # def filter
233
232
 
@@ -45,8 +45,9 @@ module LogStash; module Filters; module Empow;
45
45
  tuple = @parked_events.shift
46
46
 
47
47
  if !tuple.nil?
48
- # todo: consider classifying the unparked event one last time
49
- return tuple[:event]
48
+ unparked_event = tuple[:event]
49
+ unparked_event.uncancel
50
+ return unparked_event
50
51
  end
51
52
  end
52
53
 
@@ -152,6 +153,8 @@ module LogStash; module Filters; module Empow;
152
153
  tuple[:time] = Time.now
153
154
 
154
155
  @parked_events << tuple
156
+
157
+ event.cancel # don't stream this event just yet ...
155
158
  end
156
159
 
157
160
  private
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-filter-empowclassifier'
3
- s.version = '0.3.15'
3
+ s.version = '0.3.16'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = 'Logstash intent classification plugin client for accessing empow''s classifiction cloud'
6
6
  #s.description = 'Write a longer description or delete this line.'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-empowclassifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.15
4
+ version: 0.3.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - empow
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-01-30 00:00:00.000000000 Z
13
+ date: 2019-01-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  requirement: !ruby/object:Gem::Requirement