api-harvester 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +6 -28
- data/.document +0 -5
- data/.gitignore +0 -50
- data/Gemfile +0 -28
- data/Gemfile.lock +0 -154
- data/LICENSE.txt +0 -20
- data/README.md +0 -1
- data/Rakefile +0 -51
- data/api-harvester.gemspec +0 -29
- data/bin/harvester.rb +0 -37
- data/key_transactions.rb +0 -58
- data/lib/harvester/eye_generator.rb +0 -33
- data/lib/harvester/parser.rb +0 -23
- data/lib/harvester/puller.rb +0 -32
- data/lib/harvester/pusher.rb +0 -33
- data/lib/harvester/settings.rb +0 -15
- data/lib/harvester.rb +0 -4
- data/template/default_eye.rb +0 -62
- data/test/helper.rb +0 -34
- data/test/test_harvester.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5b682cb063b69e48cbfeede8e43532baa68e215
|
4
|
+
data.tar.gz: 0ce1ac7b04883ced29df0f87ab33120082de583b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6152657838bec26fe2dba1282f18084ef881da2979e32df86c7961f456687cc0982b53c653a8af30e7128908f557302005f02f5932b0c26867f5a888c2bcda2b
|
7
|
+
data.tar.gz: 6ac7666c38611eb685c2ad10d6055020f1b61f2779e55a4af3d40f1a2a9537c5845d310f246d73c7466e1d2eb79d90697f84b711a3f7d321c1a4b76e756b5630
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api-harvester
|
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
|
- Kinnan Kwok
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ezmq
|
@@ -208,31 +208,11 @@ dependencies:
|
|
208
208
|
version: '0'
|
209
209
|
description:
|
210
210
|
email: kkwoker@gmail.com
|
211
|
-
executables:
|
212
|
-
- harvester.rb
|
211
|
+
executables: []
|
213
212
|
extensions: []
|
214
213
|
extra_rdoc_files: []
|
215
|
-
files:
|
216
|
-
|
217
|
-
- ".gitignore"
|
218
|
-
- Gemfile
|
219
|
-
- Gemfile.lock
|
220
|
-
- LICENSE.txt
|
221
|
-
- README.md
|
222
|
-
- Rakefile
|
223
|
-
- api-harvester.gemspec
|
224
|
-
- bin/harvester.rb
|
225
|
-
- key_transactions.rb
|
226
|
-
- lib/harvester.rb
|
227
|
-
- lib/harvester/eye_generator.rb
|
228
|
-
- lib/harvester/parser.rb
|
229
|
-
- lib/harvester/puller.rb
|
230
|
-
- lib/harvester/pusher.rb
|
231
|
-
- lib/harvester/settings.rb
|
232
|
-
- template/default_eye.rb
|
233
|
-
- test/helper.rb
|
234
|
-
- test/test_harvester.rb
|
235
|
-
homepage:
|
214
|
+
files: []
|
215
|
+
homepage: http://github.com/kkwoker/api-harvester
|
236
216
|
licenses:
|
237
217
|
- MIT
|
238
218
|
metadata: {}
|
@@ -257,7 +237,5 @@ signing_key:
|
|
257
237
|
specification_version: 4
|
258
238
|
summary: Allows you to specify an endpoint to retrieve data from, parse it, and store
|
259
239
|
into any database
|
260
|
-
test_files:
|
261
|
-
- test/helper.rb
|
262
|
-
- test/test_harvester.rb
|
240
|
+
test_files: []
|
263
241
|
has_rdoc:
|
data/.document
DELETED
data/.gitignore
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
# rcov generated
|
2
|
-
coverage
|
3
|
-
coverage.data
|
4
|
-
|
5
|
-
# rdoc generated
|
6
|
-
rdoc
|
7
|
-
|
8
|
-
# yard generated
|
9
|
-
doc
|
10
|
-
.yardoc
|
11
|
-
|
12
|
-
# bundler
|
13
|
-
.bundle
|
14
|
-
vendor
|
15
|
-
# jeweler generated
|
16
|
-
pkg
|
17
|
-
|
18
|
-
harvester.yaml
|
19
|
-
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
20
|
-
#
|
21
|
-
# * Create a file at ~/.gitignore
|
22
|
-
# * Include files you want ignored
|
23
|
-
# * Run: git config --global core.excludesfile ~/.gitignore
|
24
|
-
#
|
25
|
-
# After doing this, these files will be ignored in all your git projects,
|
26
|
-
# saving you from having to 'pollute' every project you touch with them
|
27
|
-
#
|
28
|
-
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
29
|
-
#
|
30
|
-
# For MacOS:
|
31
|
-
#
|
32
|
-
.DS_Store
|
33
|
-
|
34
|
-
# For TextMate
|
35
|
-
#*.tmproj
|
36
|
-
#tmtags
|
37
|
-
|
38
|
-
# For emacs:
|
39
|
-
#*~
|
40
|
-
#\#*
|
41
|
-
#.\#*
|
42
|
-
|
43
|
-
# For vim:
|
44
|
-
#*.swp
|
45
|
-
|
46
|
-
# For redcar:
|
47
|
-
#.redcar
|
48
|
-
|
49
|
-
# For rubinius:
|
50
|
-
#*.rbc
|
data/Gemfile
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
source 'http://rubygems.org'
|
2
|
-
group :development do
|
3
|
-
gem "shoulda", ">= 0"
|
4
|
-
gem "rdoc", "~> 3.12"
|
5
|
-
gem "bundler", "~> 1.0"
|
6
|
-
gem "jeweler", "~> 2.0.1"
|
7
|
-
gem "simplecov", ">= 0"
|
8
|
-
gem 'pry'
|
9
|
-
gem 'pry-nav'
|
10
|
-
end
|
11
|
-
|
12
|
-
|
13
|
-
gem 'faraday'
|
14
|
-
gem 'excon'
|
15
|
-
gem 'commander'
|
16
|
-
gem 'ezmq'
|
17
|
-
gem 'msgpack'
|
18
|
-
|
19
|
-
|
20
|
-
gem 'influxdb', '~> 0.1.9'
|
21
|
-
gem 'eye'
|
22
|
-
gem 'moneta'
|
23
|
-
gem 'sinatra'
|
24
|
-
gem 'rainbow'
|
25
|
-
gem 'oj'
|
26
|
-
|
27
|
-
gem 'terminal-announce'
|
28
|
-
gem 'settingslogic'
|
data/Gemfile.lock
DELETED
@@ -1,154 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
activesupport (4.2.3)
|
5
|
-
i18n (~> 0.7)
|
6
|
-
json (~> 1.7, >= 1.7.7)
|
7
|
-
minitest (~> 5.1)
|
8
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
9
|
-
tzinfo (~> 1.1)
|
10
|
-
addressable (2.3.8)
|
11
|
-
builder (3.2.2)
|
12
|
-
cause (0.1)
|
13
|
-
celluloid (0.15.2)
|
14
|
-
timers (~> 1.1.0)
|
15
|
-
celluloid-io (0.15.0)
|
16
|
-
celluloid (>= 0.15.0)
|
17
|
-
nio4r (>= 0.5.0)
|
18
|
-
coderay (1.1.0)
|
19
|
-
commander (4.3.4)
|
20
|
-
highline (~> 1.7.2)
|
21
|
-
contracts (0.11.0)
|
22
|
-
descendants_tracker (0.0.4)
|
23
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
24
|
-
docile (1.1.5)
|
25
|
-
excon (0.45.4)
|
26
|
-
eye (0.6.4)
|
27
|
-
celluloid (~> 0.15.0)
|
28
|
-
celluloid-io (~> 0.15.0)
|
29
|
-
sigar (~> 0.7.2)
|
30
|
-
state_machine
|
31
|
-
thor
|
32
|
-
ezmq (0.4.4)
|
33
|
-
ffi-rzmq (~> 2.0)
|
34
|
-
faraday (0.9.1)
|
35
|
-
multipart-post (>= 1.2, < 3)
|
36
|
-
ffi (1.9.10)
|
37
|
-
ffi-rzmq (2.0.4)
|
38
|
-
ffi-rzmq-core (>= 1.0.1)
|
39
|
-
ffi-rzmq-core (1.0.3)
|
40
|
-
ffi (~> 1.9)
|
41
|
-
git (1.2.9.1)
|
42
|
-
github_api (0.12.4)
|
43
|
-
addressable (~> 2.3)
|
44
|
-
descendants_tracker (~> 0.0.4)
|
45
|
-
faraday (~> 0.8, < 0.10)
|
46
|
-
hashie (>= 3.4)
|
47
|
-
multi_json (>= 1.7.5, < 2.0)
|
48
|
-
nokogiri (~> 1.6.6)
|
49
|
-
oauth2
|
50
|
-
hashie (3.4.2)
|
51
|
-
highline (1.7.2)
|
52
|
-
i18n (0.7.0)
|
53
|
-
influxdb (0.1.9)
|
54
|
-
cause
|
55
|
-
json
|
56
|
-
jeweler (2.0.1)
|
57
|
-
builder
|
58
|
-
bundler (>= 1.0)
|
59
|
-
git (>= 1.2.5)
|
60
|
-
github_api
|
61
|
-
highline (>= 1.6.15)
|
62
|
-
nokogiri (>= 1.5.10)
|
63
|
-
rake
|
64
|
-
rdoc
|
65
|
-
json (1.8.3)
|
66
|
-
jwt (1.5.1)
|
67
|
-
method_source (0.8.2)
|
68
|
-
mini_portile (0.6.2)
|
69
|
-
minitest (5.8.0)
|
70
|
-
moneta (0.8.0)
|
71
|
-
msgpack (0.6.2)
|
72
|
-
multi_json (1.11.2)
|
73
|
-
multi_xml (0.5.5)
|
74
|
-
multipart-post (2.0.0)
|
75
|
-
nio4r (1.1.1)
|
76
|
-
nokogiri (1.6.6.2)
|
77
|
-
mini_portile (~> 0.6.0)
|
78
|
-
oauth2 (1.0.0)
|
79
|
-
faraday (>= 0.8, < 0.10)
|
80
|
-
jwt (~> 1.0)
|
81
|
-
multi_json (~> 1.3)
|
82
|
-
multi_xml (~> 0.5)
|
83
|
-
rack (~> 1.2)
|
84
|
-
oj (2.12.10)
|
85
|
-
pry (0.10.1)
|
86
|
-
coderay (~> 1.1.0)
|
87
|
-
method_source (~> 0.8.1)
|
88
|
-
slop (~> 3.4)
|
89
|
-
pry-nav (0.2.4)
|
90
|
-
pry (>= 0.9.10, < 0.11.0)
|
91
|
-
rack (1.6.4)
|
92
|
-
rack-protection (1.5.3)
|
93
|
-
rack
|
94
|
-
rainbow (2.0.0)
|
95
|
-
rake (10.4.2)
|
96
|
-
rdoc (3.12.2)
|
97
|
-
json (~> 1.4)
|
98
|
-
settingslogic (2.0.9)
|
99
|
-
shoulda (3.5.0)
|
100
|
-
shoulda-context (~> 1.0, >= 1.0.1)
|
101
|
-
shoulda-matchers (>= 1.4.1, < 3.0)
|
102
|
-
shoulda-context (1.2.1)
|
103
|
-
shoulda-matchers (2.8.0)
|
104
|
-
activesupport (>= 3.0.0)
|
105
|
-
sigar (0.7.3)
|
106
|
-
simplecov (0.10.0)
|
107
|
-
docile (~> 1.1.0)
|
108
|
-
json (~> 1.8)
|
109
|
-
simplecov-html (~> 0.10.0)
|
110
|
-
simplecov-html (0.10.0)
|
111
|
-
sinatra (1.4.6)
|
112
|
-
rack (~> 1.4)
|
113
|
-
rack-protection (~> 1.4)
|
114
|
-
tilt (>= 1.3, < 3)
|
115
|
-
slop (3.6.0)
|
116
|
-
state_machine (1.2.0)
|
117
|
-
terminal-announce (1.0.0)
|
118
|
-
bundler
|
119
|
-
contracts
|
120
|
-
rainbow
|
121
|
-
thor (0.19.1)
|
122
|
-
thread_safe (0.3.5)
|
123
|
-
tilt (2.0.1)
|
124
|
-
timers (1.1.0)
|
125
|
-
tzinfo (1.2.2)
|
126
|
-
thread_safe (~> 0.1)
|
127
|
-
|
128
|
-
PLATFORMS
|
129
|
-
ruby
|
130
|
-
|
131
|
-
DEPENDENCIES
|
132
|
-
bundler (~> 1.0)
|
133
|
-
commander
|
134
|
-
excon
|
135
|
-
eye
|
136
|
-
ezmq
|
137
|
-
faraday
|
138
|
-
influxdb (~> 0.1.9)
|
139
|
-
jeweler (~> 2.0.1)
|
140
|
-
moneta
|
141
|
-
msgpack
|
142
|
-
oj
|
143
|
-
pry
|
144
|
-
pry-nav
|
145
|
-
rainbow
|
146
|
-
rdoc (~> 3.12)
|
147
|
-
settingslogic
|
148
|
-
shoulda
|
149
|
-
simplecov
|
150
|
-
sinatra
|
151
|
-
terminal-announce
|
152
|
-
|
153
|
-
BUNDLED WITH
|
154
|
-
1.10.4
|
data/LICENSE.txt
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2015 kkwoker
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
harvest key_transactions --from https://api.newrelic.com/v2/key_transactions.json --every 5s
|
data/Rakefile
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'bundler'
|
5
|
-
begin
|
6
|
-
Bundler.setup(:default, :development)
|
7
|
-
rescue Bundler::BundlerError => e
|
8
|
-
$stderr.puts e.message
|
9
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
-
exit e.status_code
|
11
|
-
end
|
12
|
-
require 'rake'
|
13
|
-
|
14
|
-
require 'jeweler'
|
15
|
-
Jeweler::Tasks.new do |gem|
|
16
|
-
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
|
-
gem.name = "harvester"
|
18
|
-
gem.homepage = "http://github.com/kkwoker/harvester"
|
19
|
-
gem.license = "MIT"
|
20
|
-
gem.summary = %Q{TODO: one-line summary of your gem}
|
21
|
-
gem.description = %Q{TODO: longer description of your gem}
|
22
|
-
gem.email = "kkwoker@gmail.com"
|
23
|
-
gem.authors = ["kkwoker"]
|
24
|
-
# dependencies defined in Gemfile
|
25
|
-
end
|
26
|
-
Jeweler::RubygemsDotOrgTasks.new
|
27
|
-
|
28
|
-
require 'rake/testtask'
|
29
|
-
Rake::TestTask.new(:test) do |test|
|
30
|
-
test.libs << 'lib' << 'test'
|
31
|
-
test.pattern = 'test/**/test_*.rb'
|
32
|
-
test.verbose = true
|
33
|
-
end
|
34
|
-
|
35
|
-
desc "Code coverage detail"
|
36
|
-
task :simplecov do
|
37
|
-
ENV['COVERAGE'] = "true"
|
38
|
-
Rake::Task['test'].execute
|
39
|
-
end
|
40
|
-
|
41
|
-
task :default => :test
|
42
|
-
|
43
|
-
require 'rdoc/task'
|
44
|
-
Rake::RDocTask.new do |rdoc|
|
45
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
46
|
-
|
47
|
-
rdoc.rdoc_dir = 'rdoc'
|
48
|
-
rdoc.title = "harvester #{version}"
|
49
|
-
rdoc.rdoc_files.include('README*')
|
50
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
51
|
-
end
|
data/api-harvester.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
Gem::Specification.new do |gem|
|
2
|
-
gem.name = 'api-harvester'
|
3
|
-
gem.version = '0.0.1'
|
4
|
-
gem.licenses = 'MIT'
|
5
|
-
gem.authors = ['Kinnan Kwok']
|
6
|
-
gem.email = 'kkwoker@gmail.com'
|
7
|
-
gem.summary = 'Allows you to specify an endpoint to retrieve data from, parse it, and store into any database'
|
8
|
-
|
9
|
-
gem.files = `git ls-files`.split("\n")
|
10
|
-
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
11
|
-
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
12
|
-
gem.require_paths = ['lib']
|
13
|
-
|
14
|
-
gem.add_runtime_dependency 'ezmq', '~> 0.4.4'
|
15
|
-
gem.add_runtime_dependency 'faraday'
|
16
|
-
gem.add_runtime_dependency 'excon'
|
17
|
-
gem.add_runtime_dependency 'commander'
|
18
|
-
gem.add_runtime_dependency 'msgpack'
|
19
|
-
gem.add_runtime_dependency 'influxdb', '~> 0.1.9'
|
20
|
-
gem.add_runtime_dependency 'eye'
|
21
|
-
gem.add_runtime_dependency 'moneta'
|
22
|
-
gem.add_runtime_dependency 'sinatra'
|
23
|
-
gem.add_runtime_dependency 'rainbow'
|
24
|
-
gem.add_runtime_dependency 'oj'
|
25
|
-
gem.add_runtime_dependency 'terminal-announce'
|
26
|
-
gem.add_runtime_dependency 'settingslogic'
|
27
|
-
|
28
|
-
gem.add_development_dependency 'pry'
|
29
|
-
end
|
data/bin/harvester.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'commander'
|
4
|
-
require_relative '../lib/harvester'
|
5
|
-
|
6
|
-
Commander.configure do
|
7
|
-
program :name, 'Harvester'
|
8
|
-
program :version, '0.0.1'
|
9
|
-
program :description, 'harvest from endpoints'
|
10
|
-
program :help, 'Author', 'Kinnan Kwok <kkwoker@gmail.com>'
|
11
|
-
|
12
|
-
default_command :harvest
|
13
|
-
|
14
|
-
command :harvest do |command|
|
15
|
-
command.syntax = 'harvester harvest [options]'
|
16
|
-
command.summary = ''
|
17
|
-
command.description = 'Starts processes for harvesting data'
|
18
|
-
command.example 'description', 'command example'
|
19
|
-
command.option '--from STRING', String, 'Adds an endpoint to harvest from'
|
20
|
-
command.option '--with STRING', String, 'Adds a parsing method ruby file'
|
21
|
-
command.option '--every INTEGER', Integer, 'Adds an interval for polling'
|
22
|
-
command.action do |_args, options|
|
23
|
-
# Do something or c.when_called Harvester::Commands::Harvest
|
24
|
-
abort 'Must provide parameters --from, --with, and --every' unless options.from && options.with && options.every
|
25
|
-
name = options.with
|
26
|
-
endpoint = options.from
|
27
|
-
timeout = options.every
|
28
|
-
|
29
|
-
# Create an eye file.
|
30
|
-
EyeGenerator.initialize name, endpoint, timeout
|
31
|
-
# Load Eye file
|
32
|
-
system "eye load #{name}.d/config.eye"
|
33
|
-
system "eye restart #{name}"
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
data/key_transactions.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
#!/bin/env ruby
|
2
|
-
require 'pry'
|
3
|
-
def key_transactions incoming_data
|
4
|
-
outgoing_data = []
|
5
|
-
transactions = incoming_data['key_transactions']
|
6
|
-
transactions.each do |transaction|
|
7
|
-
transaction['application_summary'] = {} unless transaction['application_summary']
|
8
|
-
transaction['end_user_summary'] = {} unless transaction['end_user_summary']
|
9
|
-
plowed = {
|
10
|
-
"database_name": "NewRelic-transactions",
|
11
|
-
"series_name": transaction['name'],
|
12
|
-
"application-response_time": transaction['application_summary']['response_time'],
|
13
|
-
"application-throughput": transaction['application_summary']['throughput'],
|
14
|
-
"application-error_rate": transaction['application_summary']['error_rate'],
|
15
|
-
"application-apdex_target": transaction['application_summary']['apdex_target'],
|
16
|
-
"application-apdex_score": transaction['application_summary']['apdex_score'],
|
17
|
-
"application-host_count": transaction['application_summary']['host_count'],
|
18
|
-
"application-instance_count": transaction['application_summary']['instance_count'],
|
19
|
-
"application-concurrent_instance_count": transaction['application_summary']['concurrent_instance_count'],
|
20
|
-
"end_user-response_time": transaction['end_user_summary']['response_time'],
|
21
|
-
"end_user-throughput": transaction['end_user_summary']['throughput'],
|
22
|
-
"end_user-apdex_target": transaction['end_user_summary']['apdex_target'],
|
23
|
-
"end_user-apdex_score": transaction['end_user_summary']['apdex_score']
|
24
|
-
}
|
25
|
-
outgoing_data << plowed.keep_if {|_,value| !value.nil?}
|
26
|
-
end
|
27
|
-
outgoing_data
|
28
|
-
end
|
29
|
-
|
30
|
-
# {
|
31
|
-
# "key_transaction": {
|
32
|
-
# "id": "integer",
|
33
|
-
# "name": "string",
|
34
|
-
# "transaction_name": "string",
|
35
|
-
# "health_status": "string",
|
36
|
-
# "reporting": "boolean",
|
37
|
-
# "last_reported_at": "time",
|
38
|
-
# "application_summary": {
|
39
|
-
# "response_time": "float",
|
40
|
-
# "throughput": "float",
|
41
|
-
# "error_rate": "float",
|
42
|
-
# "apdex_target": "float",
|
43
|
-
# "apdex_score": "float",
|
44
|
-
# "host_count": "integer",
|
45
|
-
# "instance_count": "integer",
|
46
|
-
# "concurrent_instance_count": "integer"
|
47
|
-
# },
|
48
|
-
# "end_user_summary": {
|
49
|
-
# "response_time": "float",
|
50
|
-
# "throughput": "float",
|
51
|
-
# "apdex_target": "float",
|
52
|
-
# "apdex_score": "float"
|
53
|
-
# },
|
54
|
-
# "links": {
|
55
|
-
# "application": "integer"
|
56
|
-
# }
|
57
|
-
# }
|
58
|
-
# }
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require_relative '../../template/default_eye'
|
2
|
-
|
3
|
-
module EyeGenerator
|
4
|
-
def self.create_eye_config name
|
5
|
-
config = Default.eye_config name
|
6
|
-
File.open("#{name}.d/config.eye", 'w') { |file| file.write(config)}
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.create_puller name, endpoint, timeout
|
10
|
-
puller = Default.puller name, endpoint, timeout
|
11
|
-
File.open("#{name}.d/puller.rb", 'w') { |file| file.write(puller)}
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.create_parser name, endpoint
|
15
|
-
parser = Default.parser name, endpoint
|
16
|
-
File.open("#{name}.d/parser.rb", 'w') { |file| file.write(parser)}
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.create_pusher name, endpoint
|
20
|
-
pusher = Default.pusher name, endpoint
|
21
|
-
File.open("#{name}.d/pusher.rb", 'w') { |file| file.write(pusher)}
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.initialize name, endpoint, timeout
|
25
|
-
system "mkdir -p #{name}.d"
|
26
|
-
system "mkdir -p #{name}.d/logs"
|
27
|
-
system "mkdir -p #{name}.d/pids"
|
28
|
-
create_eye_config name
|
29
|
-
create_puller name, endpoint, timeout
|
30
|
-
create_parser name, endpoint
|
31
|
-
create_pusher name, endpoint
|
32
|
-
end
|
33
|
-
end
|
data/lib/harvester/parser.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'pry'
|
2
|
-
require 'ezmq'
|
3
|
-
require 'msgpack'
|
4
|
-
require 'oj'
|
5
|
-
require_relative 'settings'
|
6
|
-
require_relative '../../key_transactions'
|
7
|
-
module Parser
|
8
|
-
@broadcaster = EZMQ::Publisher.new :bind, port: 6000, encode: -> m { Oj.dump m }
|
9
|
-
def self.activate topic, endpoint
|
10
|
-
puts topic, endpoint
|
11
|
-
listener = EZMQ::Subscriber.new :connect, port: 5000, topic: topic, decode: -> m { Oj.load m }
|
12
|
-
listener.listen do |message, topic|
|
13
|
-
data = plow message, topic
|
14
|
-
data.each do |item|
|
15
|
-
puts @broadcaster.send item, topic: topic
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.plow message, parse
|
21
|
-
send(parse, message)
|
22
|
-
end
|
23
|
-
end
|
data/lib/harvester/puller.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'ezmq'
|
2
|
-
require 'msgpack'
|
3
|
-
require 'faraday'
|
4
|
-
require 'oj'
|
5
|
-
require 'excon'
|
6
|
-
require_relative 'settings'
|
7
|
-
|
8
|
-
module Puller
|
9
|
-
@broadcaster = EZMQ::Publisher.new :bind, port: 5000
|
10
|
-
def self.fetch_data(endpoint)
|
11
|
-
conn = Faraday.new(url: endpoint) do |faraday|
|
12
|
-
faraday.adapter :excon
|
13
|
-
faraday.headers['X-Api-Key'] = Settings.newrelic_key
|
14
|
-
end
|
15
|
-
conn.get.body
|
16
|
-
# rescue Exception => e
|
17
|
-
# puts "Puller#fetch_data"
|
18
|
-
# puts "#{e.inspect}: #{e.message}"
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.send(data, topic)
|
22
|
-
# puts "Puller#send"
|
23
|
-
@broadcaster.send data, topic: topic
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.activate(name, endpoint, timeout)
|
27
|
-
loop do
|
28
|
-
puts send fetch_data(endpoint), name
|
29
|
-
sleep timeout
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
data/lib/harvester/pusher.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'pry'
|
2
|
-
require 'ezmq'
|
3
|
-
require 'oj'
|
4
|
-
require 'influxdb'
|
5
|
-
require_relative 'settings'
|
6
|
-
|
7
|
-
module Pusher
|
8
|
-
@connection = InfluxDB::Client.new host: Settings.influx_host, username: Settings.influx_user, password: Settings.influx_pass
|
9
|
-
|
10
|
-
def self.activate topic, endpoint
|
11
|
-
listener = EZMQ::Subscriber.new :connect, port: 6000, topic: topic, decode: -> m { Oj.load m }
|
12
|
-
listener.listen do |message, topic|
|
13
|
-
puts write message
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.write data
|
18
|
-
series = data.delete :series_name
|
19
|
-
db = data.delete :database_name
|
20
|
-
use_or_create db
|
21
|
-
@connection.write_point(series, data)
|
22
|
-
data.length
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.use_or_create(db_name)
|
26
|
-
dbs = @connection.get_database_list.map { |db| db["name"] }
|
27
|
-
@connection.create_database db_name unless dbs.include? db_name
|
28
|
-
@connection = InfluxDB::Client.new db_name, host: Settings.influx_host,
|
29
|
-
username: Settings.influx_user,
|
30
|
-
password: Settings.influx_pass
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
data/lib/harvester/settings.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'settingslogic'
|
2
|
-
require 'terminal-announce'
|
3
|
-
class Settings < Settingslogic
|
4
|
-
config_paths = %w(/etc /usr/local/etc ~/.config . ../)
|
5
|
-
|
6
|
-
config_paths.each do |config_path|
|
7
|
-
config_file = File.expand_path "#{ config_path }/harvester.yaml"
|
8
|
-
source config_file if File.exist? config_file
|
9
|
-
end
|
10
|
-
|
11
|
-
load!
|
12
|
-
rescue Errno::ENOENT
|
13
|
-
Announce.failure "Unable to locate configuration in #{ config_paths }."
|
14
|
-
abort
|
15
|
-
end
|
data/lib/harvester.rb
DELETED
data/template/default_eye.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
module Default
|
2
|
-
|
3
|
-
|
4
|
-
def self.puller name, endpoint, timeout
|
5
|
-
%Q(#!/bin/env ruby
|
6
|
-
require_relative '../lib/harvester/puller'
|
7
|
-
Puller.activate("#{name}", "#{endpoint}", #{timeout})
|
8
|
-
)
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.parser name, endpoint
|
12
|
-
%Q(#!/bin/env ruby
|
13
|
-
require_relative '../lib/harvester/parser'
|
14
|
-
Parser.activate("#{name}", "#{endpoint}")
|
15
|
-
)
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.pusher name, endpoint
|
19
|
-
%Q(#!/bin/env ruby
|
20
|
-
require_relative '../lib/harvester/pusher'
|
21
|
-
Pusher.activate("#{name}", "#{endpoint}")
|
22
|
-
)
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.eye_config name
|
26
|
-
%Q(#!/bin/env ruby
|
27
|
-
|
28
|
-
Eye.application 'harvester' do
|
29
|
-
|
30
|
-
working_dir File.expand_path(File.join(File.dirname(__FILE__)))
|
31
|
-
|
32
|
-
group "#{name}" do
|
33
|
-
process :puller do
|
34
|
-
pid_file 'pids/puller.pid'
|
35
|
-
start_command "ruby puller.rb"
|
36
|
-
daemonize true
|
37
|
-
stdout 'logs/puller.log'
|
38
|
-
check :memory, every: 20.seconds, below: 300.megabytes, times: 3
|
39
|
-
end
|
40
|
-
|
41
|
-
process :parser do
|
42
|
-
pid_file 'pids/parser.pid'
|
43
|
-
start_command "ruby parser.rb"
|
44
|
-
daemonize true
|
45
|
-
stdout 'logs/parser.log'
|
46
|
-
check :memory, every: 20.seconds, below: 300.megabytes, times: 3
|
47
|
-
end
|
48
|
-
|
49
|
-
process :pusher do
|
50
|
-
pid_file 'pids/pusher.pid'
|
51
|
-
start_command "ruby pusher.rb"
|
52
|
-
daemonize true
|
53
|
-
stdout 'logs/pusher.log'
|
54
|
-
check :memory, every: 20.seconds, below: 300.megabytes, times: 3
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
58
|
-
end
|
59
|
-
)
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
data/test/helper.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
|
3
|
-
module SimpleCov::Configuration
|
4
|
-
def clean_filters
|
5
|
-
@filters = []
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
SimpleCov.configure do
|
10
|
-
clean_filters
|
11
|
-
load_adapter 'test_frameworks'
|
12
|
-
end
|
13
|
-
|
14
|
-
ENV["COVERAGE"] && SimpleCov.start do
|
15
|
-
add_filter "/.rvm/"
|
16
|
-
end
|
17
|
-
require 'rubygems'
|
18
|
-
require 'bundler'
|
19
|
-
begin
|
20
|
-
Bundler.setup(:default, :development)
|
21
|
-
rescue Bundler::BundlerError => e
|
22
|
-
$stderr.puts e.message
|
23
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
24
|
-
exit e.status_code
|
25
|
-
end
|
26
|
-
require 'test/unit'
|
27
|
-
require 'shoulda'
|
28
|
-
|
29
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
30
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
31
|
-
require 'harvester'
|
32
|
-
|
33
|
-
class Test::Unit::TestCase
|
34
|
-
end
|