fluent-plugin-gcloud-pubsub-custom 0.4.2 → 0.4.3

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
  SHA1:
3
- metadata.gz: b6a3dc4854e4b3d760150f6ba6e46513fd432d82
4
- data.tar.gz: e79d3538b84e949c8754c4c40f429af5ccfb9b42
3
+ metadata.gz: bc9dc8d4003d063cc4e918c37dbda0ff9d5386be
4
+ data.tar.gz: b2fe919a6ef18270fb4641302318c9a7c60a6b70
5
5
  SHA512:
6
- metadata.gz: 611d5fc134b67c6f51740beeab19fa2ee0fe1a001399fb3cbddb64b71a0187b5bcab8000dac1a007d0758de0d9923f838b424a8e95098e4c95783d6a192141e5
7
- data.tar.gz: 8cd2edd9f32f283ba06686a102ee66af5a7c9d86811a86fe38491d336d431f2c85fc1caa21b387cc9328678897c380b1a00d7fca9610b2d412bf5c97542beb22
6
+ metadata.gz: f788632c81919ef4345813cffbab25299440047e8c4c0b47a1804d3c511fdd1f92b61b8e6f6caaef3d4a69bbfafd2da23e50ff640db94abb2dd1157cf641331d
7
+ data.tar.gz: 64494f35d1b8521982a12accc8ff95b52c5f5ed3718db0fe81a5e783751a72f6393d1d7ef328fa95c800812734d5f211ceab9bc28c93a6546ab9c99edd5a976d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## ChangeLog
2
2
 
3
+ ### Release 0.4.3 - 2017/02/16
4
+
5
+ - Input plugin
6
+ - Add "status" method to the http rpc api
7
+
3
8
  ### Release 0.4.2 - 2017/02/03
4
9
 
5
10
  - Make retry to get topic/subscription when Pub/Sub API returns 50x code
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
7
7
  gem.license = "MIT"
8
8
  gem.homepage = "https://github.com/mia-0032/fluent-plugin-gcloud-pubsub-custom"
9
9
  gem.summary = gem.description
10
- gem.version = "0.4.2"
10
+ gem.version = "0.4.3"
11
11
  gem.authors = ["Yoshihiro MIYAI"]
12
12
  gem.email = "msparrow17@gmail.com"
13
13
  gem.has_rdoc = false
@@ -92,15 +92,18 @@ module Fluent
92
92
  end
93
93
 
94
94
  def process(req, res)
95
+ ret = {'ok' => true}
95
96
  case req.path_info
96
97
  when '/stop'
97
98
  @plugin.stop_pull
98
99
  when '/start'
99
100
  @plugin.start_pull
101
+ when '/status'
102
+ ret['status'] = @plugin.status_of_pull
100
103
  else
101
104
  raise Error.new "Invalid path_info: #{req.path_info}"
102
105
  end
103
- render_json(200, {'ok' => true})
106
+ render_json(200, ret)
104
107
  end
105
108
  end
106
109
 
@@ -159,6 +162,10 @@ module Fluent
159
162
  log.info "start pull from subscription:#{@subscription}"
160
163
  end
161
164
 
165
+ def status_of_pull
166
+ @stop_pull ? 'stopped' : 'started'
167
+ end
168
+
162
169
  private
163
170
 
164
171
  def static_tag(record)
@@ -1,4 +1,5 @@
1
1
  require 'net/http'
2
+ require 'json'
2
3
 
3
4
  require_relative "../test_helper"
4
5
 
@@ -355,5 +356,26 @@ class GcloudPubSubInputTest < Test::Unit::TestCase
355
356
  assert_equal({"foo" => "bar"}, record)
356
357
  end
357
358
  end
359
+
360
+ test 'get status by http rpc when started' do
361
+ d = create_driver("#{CONFIG}\npull_interval 1.0\nenable_rpc true")
362
+ assert_equal(false, d.instance.instance_variable_get(:@stop_pull))
363
+
364
+ d.run {
365
+ res = http_get('/api/in_gcloud_pubsub/pull/status')
366
+ assert_equal({"ok" => true, "status" => "started"}, JSON.parse(res.body))
367
+ }
368
+ end
369
+
370
+ test 'get status by http rpc when stopped' do
371
+ d = create_driver("#{CONFIG}\npull_interval 1.0\nenable_rpc true")
372
+ d.instance.stop_pull
373
+ assert_equal(true, d.instance.instance_variable_get(:@stop_pull))
374
+
375
+ d.run {
376
+ res = http_get('/api/in_gcloud_pubsub/pull/status')
377
+ assert_equal({"ok" => true, "status" => "stopped"}, JSON.parse(res.body))
378
+ }
379
+ end
358
380
  end
359
381
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-gcloud-pubsub-custom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshihiro MIYAI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-03 00:00:00.000000000 Z
11
+ date: 2017-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd