norikra-client 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -2
- data/lib/norikra/client.rb +8 -0
- data/lib/norikra/client/cli.rb +16 -1
- data/lib/norikra/client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c97f34d9428d3773874fcae5c7c4052dc391328
|
4
|
+
data.tar.gz: f36dd333eff9e2f42808eba49d8a610fb07ee3e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
163
|
-
client.
|
174
|
+
client.sweep() #=> for default group
|
175
|
+
client.sweep('my_secret_group')
|
164
176
|
|
165
177
|
## Versions
|
166
178
|
|
data/lib/norikra/client.rb
CHANGED
@@ -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
|
data/lib/norikra/client/cli.rb
CHANGED
@@ -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
|
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.
|
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-
|
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
|