embulk-plugin-input-jstat 0.0.1 → 0.0.2
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 +4 -4
- data/README.md +6 -0
- data/embulk-plugin-input-jstat.gemspec +1 -1
- data/lib/embulk/{input_jstat.rb → input/jstat.rb} +12 -9
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d477ee468201f419b4772ddbcfcb340eaf5432e
|
4
|
+
data.tar.gz: 0cddb23fcb0f2adfd7047acdb918012afa2aecab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18e58c022f29364a1b9b749d3b5feabf4ae82b9c03c2a16fd3cd8dc30fd708206518fa7accff4544dc7b08cbf64085b7463919047715bc0f2e9cc68802925e0f
|
7
|
+
data.tar.gz: 39a118f10cf10d291ee6d6f80f4a385a788a22578afed431218a3b46a0dca7811cd7ec7eac37f4a578718e450bfa9b02f451739cdb605693a27d79fcdb03d471
|
data/README.md
CHANGED
@@ -3,6 +3,12 @@
|
|
3
3
|
[Embulk](https://github.com/embulk/embulk) input plugin for [jstat](http://docs.oracle.com/javase/8/docs/technotes/tools/unix/jstat.html).
|
4
4
|
Now, this plugin supports only JDK8.
|
5
5
|
|
6
|
+
## Requirements
|
7
|
+
|
8
|
+
- Embulk 0.4.1 or later.
|
9
|
+
- bundler 1.7 or later.
|
10
|
+
- rake 10.0 or later.
|
11
|
+
|
6
12
|
## Installation
|
7
13
|
|
8
14
|
Run this command with your embulk binary.
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "embulk-plugin-input-jstat"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.2"
|
8
8
|
spec.authors = ["KUBOTA Yuji"]
|
9
9
|
spec.email = ["kubota.yuji@gmail.com"]
|
10
10
|
spec.summary = %q{Embulk plugin for jstat input}
|
@@ -137,20 +137,22 @@ module Embulk
|
|
137
137
|
|
138
138
|
def self.transaction(config, &control)
|
139
139
|
# find jstat files and push to "task".
|
140
|
-
paths = config.param('paths', :array, default: ['/tmp']).map
|
140
|
+
paths = config.param('paths', :array, default: ['/tmp']).map do |path|
|
141
141
|
next [] unless Dir.exists?(path)
|
142
|
-
Dir.entries(path).sort.select
|
142
|
+
Dir.entries(path).sort.select do |f|
|
143
|
+
f =~ /^.+\.log$/
|
144
|
+
end.map do |file|
|
143
145
|
File.expand_path(File.join(path, file))
|
144
146
|
end
|
145
|
-
|
147
|
+
end.flatten
|
146
148
|
# remove checked jstat files by other threads.
|
147
|
-
paths
|
149
|
+
paths -= config.param('done', :array, default: [])
|
148
150
|
task = {'paths' => paths}
|
149
151
|
|
150
152
|
# generate schema by parsing a given options of jstat.
|
151
153
|
option = config.param('option', :string, default: 'gcutil')
|
152
154
|
option[0] = '' if option =~ /^\-/
|
153
|
-
|
155
|
+
unless JSTAT_COLUMNS.has_key?(option.to_sym)
|
154
156
|
raise "Wrong configuration: \"option: #{option}\". Specify a stat option of jstat correctly."
|
155
157
|
end
|
156
158
|
|
@@ -160,17 +162,17 @@ module Embulk
|
|
160
162
|
columns = JSTAT_COLUMNS[option.to_sym].each.with_index(i).map do |column, index|
|
161
163
|
stat, type = column
|
162
164
|
case type
|
163
|
-
when
|
165
|
+
when 'string'
|
164
166
|
Column.new(index, stat.to_s, :string)
|
165
|
-
when
|
167
|
+
when 'int', 'long'
|
166
168
|
Column.new(index, stat.to_s, :long)
|
167
|
-
when
|
169
|
+
when 'double', 'float'
|
168
170
|
Column.new(index, stat.to_s, :double)
|
169
171
|
end
|
170
172
|
end
|
171
173
|
|
172
174
|
if timestamp
|
173
|
-
columns.unshift(Column.new(0,
|
175
|
+
columns.unshift(Column.new(0, 'Timestamp', :double))
|
174
176
|
end
|
175
177
|
|
176
178
|
#TODO: Now, force to set threads as amount of found files. Need a better idea.
|
@@ -186,6 +188,7 @@ module Embulk
|
|
186
188
|
end
|
187
189
|
|
188
190
|
def run
|
191
|
+
# if no path, returns empty.
|
189
192
|
unless path = @task['paths'][@index]
|
190
193
|
return { 'done' => [] }
|
191
194
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-plugin-input-jstat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KUBOTA Yuji
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -51,7 +51,7 @@ files:
|
|
51
51
|
- README.md
|
52
52
|
- Rakefile
|
53
53
|
- embulk-plugin-input-jstat.gemspec
|
54
|
-
- lib/embulk/
|
54
|
+
- lib/embulk/input/jstat.rb
|
55
55
|
homepage: https://github.com/ykubota/embulk-plugin-input-jstat
|
56
56
|
licenses:
|
57
57
|
- MIT
|