lib/fluent/plugin/in_gcloud_pubsub.rb in fluent-plugin-gcloud-pubsub-custom-0.4.2 vs lib/fluent/plugin/in_gcloud_pubsub.rb in fluent-plugin-gcloud-pubsub-custom-0.4.3
- old
+ new
@@ -90,19 +90,22 @@
def render_json(code, obj)
[code, {'Content-Type' => 'application/json'}, obj.to_json]
end
def process(req, res)
+ ret = {'ok' => true}
case req.path_info
when '/stop'
@plugin.stop_pull
when '/start'
@plugin.start_pull
+ when '/status'
+ ret['status'] = @plugin.status_of_pull
else
raise Error.new "Invalid path_info: #{req.path_info}"
end
- render_json(200, {'ok' => true})
+ render_json(200, ret)
end
end
def configure(conf)
super
@@ -155,9 +158,13 @@
end
def start_pull
@stop_pull = false
log.info "start pull from subscription:#{@subscription}"
+ end
+
+ def status_of_pull
+ @stop_pull ? 'stopped' : 'started'
end
private
def static_tag(record)