norikra-client 1.0.0 → 1.1.0

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
  SHA1:
3
- metadata.gz: 5ab50ee595ff981f30dc0370dc59c31677e5188d
4
- data.tar.gz: d608b25da6f9f2c336f96832c6811a1595f003f1
3
+ metadata.gz: 2c97f34d9428d3773874fcae5c7c4052dc391328
4
+ data.tar.gz: f36dd333eff9e2f42808eba49d8a610fb07ee3e3
5
5
  SHA512:
6
- metadata.gz: 23011edddb54a46bfcb360b54bd11e134f06751c1e532222c2141a3a956166bb83f094d635d0c79486c96fb9760c8118f0c79a3468e20afe9f52479dd4f64f8e
7
- data.tar.gz: 22ba861774898c0a57bced7d169ae48af6529688cedc74b32524add0a526fb0b49fc2966cd08a76845d2df70902004cae05694b699133dc53f7f94145ba93fc4
6
+ metadata.gz: 82fbf075f20e32e8844132946ce53cbcd9a120c9ab1e7f77b87a9972bc90f0ee2b3011d50af7efc12037b4922ef8a13ee761ed84ed45db02191899ad7ebdf259
7
+ data.tar.gz: dd1142adc5b11b1c347f83c1387a5e26588e714ef114032ccfef657499fa1bac0ddb71a0ee027fd7eb044fe153f68861d0d74950b053031641bc7204cdbc51d4
data/README.md CHANGED
@@ -120,6 +120,18 @@ Stop and remove specified query immediately.
120
120
 
121
121
  client.deregister('q1') #=> true
122
122
 
123
+ ### Norikra::Client#suspend(query_name)
124
+
125
+ Stop but does NOT remove specified query. Suspended queries are not recorded in stats file.
126
+
127
+ client.suspend('q1') #=> true
128
+
129
+ ### Norikra::Client#resume(query_name)
130
+
131
+ Re-run specified query, which is suspended previously.
132
+
133
+ client.resume('q1') #=> true
134
+
123
135
  ### Norikra::Client#fields(target)
124
136
 
125
137
  Returns the list of fields definitions, which contains `name`(string), `type`(string) and `optional`(true/false).
@@ -159,8 +171,8 @@ The second value is output record of query as Hash.
159
171
 
160
172
  Fetch all output events of queries of specified group. `query_group: nil` means default query group. Returns Hash instance like `'query_name' => [list of output (same as #event)]`
161
173
 
162
- client.fetch() #=> for default group
163
- client.fetch('my_secret_group')
174
+ client.sweep() #=> for default group
175
+ client.sweep('my_secret_group')
164
176
 
165
177
  ## Versions
166
178
 
@@ -48,6 +48,14 @@ module Norikra
48
48
  @client.call(:deregister, query_name)
49
49
  end
50
50
 
51
+ def suspend(query_name)
52
+ @client.call(:suspend, query_name)
53
+ end
54
+
55
+ def resume(query_name)
56
+ @client.call(:resume, query_name)
57
+ end
58
+
51
59
  def fields(target)
52
60
  @client.call(:fields, target)
53
61
  end
@@ -78,13 +78,14 @@ class Norikra::Client
78
78
  option :simple, :type => :boolean, :default => false, :desc => "suppress header/footer", :aliases => "-s"
79
79
  def list
80
80
  wrap do
81
- puts ["NAME", "GROUP", "TARGETS", "QUERY"].join("\t") unless options[:simple]
81
+ puts ["NAME", "GROUP", "TARGETS", "SUSPENDED", "QUERY"].join("\t") unless options[:simple]
82
82
  queries = client(parent_options).queries
83
83
  queries.sort{|a,b| (a['targets'].first <=> b['targets'].first).nonzero? || a['name'] <=> b['name']}.each do |q|
84
84
  puts [
85
85
  q['name'],
86
86
  (q['group'] || 'default'),
87
87
  q['targets'].join(','),
88
+ q['suspended'].to_s,
88
89
  q['expression'].split("\n").map(&:strip).join(" ")
89
90
  ].join("\t")
90
91
  end
@@ -106,6 +107,20 @@ class Norikra::Client
106
107
  client(parent_options).deregister(query_name)
107
108
  end
108
109
  end
110
+
111
+ desc "suspend QUERY_NAME", "specify to stop (but not removed)"
112
+ def suspend(query_name)
113
+ wrap do
114
+ client(parent_options).suspend(query_name)
115
+ end
116
+ end
117
+
118
+ desc "resume QUERY_NAME", "specify to re-run query suspended before"
119
+ def resume(query_name)
120
+ wrap do
121
+ client(parent_options).resume(query_name)
122
+ end
123
+ end
109
124
  end
110
125
 
111
126
  class Field < Thor
@@ -1,5 +1,5 @@
1
1
  module Norikra
2
2
  class Client
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: norikra-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - TAGOMORI Satoshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-20 00:00:00.000000000 Z
11
+ date: 2014-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack-rpc-over-http