vitals 0.0.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (240) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/.travis.yml +15 -0
  4. data/Gemfile +4 -0
  5. data/Gemfile.lock +157 -0
  6. data/Guardfile +11 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +135 -9
  9. data/Rakefile +17 -31
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/integration/multiverse/grape-on-rack/.gitignore +7 -0
  13. data/integration/multiverse/grape-on-rack/.rspec +2 -0
  14. data/integration/multiverse/grape-on-rack/.rubocop.yml +2 -0
  15. data/integration/multiverse/grape-on-rack/.rubocop_todo.yml +50 -0
  16. data/integration/multiverse/grape-on-rack/.travis.yml +12 -0
  17. data/integration/multiverse/grape-on-rack/Gemfile +28 -0
  18. data/integration/multiverse/grape-on-rack/Gemfile.lock +187 -0
  19. data/integration/multiverse/grape-on-rack/Guardfile +8 -0
  20. data/integration/multiverse/grape-on-rack/LICENSE +21 -0
  21. data/integration/multiverse/grape-on-rack/README.md +88 -0
  22. data/integration/multiverse/grape-on-rack/Rakefile +27 -0
  23. data/integration/multiverse/grape-on-rack/api/content_type.rb +18 -0
  24. data/integration/multiverse/grape-on-rack/api/entities.rb +28 -0
  25. data/integration/multiverse/grape-on-rack/api/get_json.rb +24 -0
  26. data/integration/multiverse/grape-on-rack/api/header_versioning.rb +9 -0
  27. data/integration/multiverse/grape-on-rack/api/path_versioning.rb +9 -0
  28. data/integration/multiverse/grape-on-rack/api/ping.rb +8 -0
  29. data/integration/multiverse/grape-on-rack/api/post_json.rb +11 -0
  30. data/integration/multiverse/grape-on-rack/api/post_put.rb +24 -0
  31. data/integration/multiverse/grape-on-rack/api/rescue_from.rb +11 -0
  32. data/integration/multiverse/grape-on-rack/api/upload_file.rb +22 -0
  33. data/integration/multiverse/grape-on-rack/api/wrap_response.rb +14 -0
  34. data/integration/multiverse/grape-on-rack/api/wrap_response_decorator.rb +15 -0
  35. data/integration/multiverse/grape-on-rack/app/acme_app.rb +49 -0
  36. data/integration/multiverse/grape-on-rack/app/api.rb +18 -0
  37. data/integration/multiverse/grape-on-rack/config/application.rb +23 -0
  38. data/integration/multiverse/grape-on-rack/config/boot.rb +2 -0
  39. data/integration/multiverse/grape-on-rack/config/environment.rb +3 -0
  40. data/integration/multiverse/grape-on-rack/config/newrelic.yml +255 -0
  41. data/integration/multiverse/grape-on-rack/config.ru +11 -0
  42. data/integration/multiverse/grape-on-rack/public/errors/404.html +15 -0
  43. data/integration/multiverse/grape-on-rack/public/errors/500.html +15 -0
  44. data/integration/multiverse/grape-on-rack/public/images/index.html +1 -0
  45. data/integration/multiverse/grape-on-rack/public/images/rack-logo.png +0 -0
  46. data/integration/multiverse/grape-on-rack/public/index.html +23 -0
  47. data/integration/multiverse/grape-on-rack/public/scripts/jquery-1.7.1.min.js +4 -0
  48. data/integration/multiverse/grape-on-rack/public/scripts/ring.js +17 -0
  49. data/integration/multiverse/grape-on-rack/spec/api/post_put_spec.rb +21 -0
  50. data/integration/multiverse/grape-on-rack/spec/fixtures/grape_logo.png +0 -0
  51. data/integration/multiverse/grape-on-rack/spec/spec_helper.rb +24 -0
  52. data/integration/multiverse/grape-on-rails/.gitignore +16 -0
  53. data/integration/multiverse/grape-on-rails/.rspec +2 -0
  54. data/integration/multiverse/grape-on-rails/.rubocop.yml +6 -0
  55. data/integration/multiverse/grape-on-rails/.rubocop_todo.yml +33 -0
  56. data/integration/multiverse/grape-on-rails/.travis.yml +17 -0
  57. data/integration/multiverse/grape-on-rails/Gemfile +22 -0
  58. data/integration/multiverse/grape-on-rails/Gemfile.lock +238 -0
  59. data/integration/multiverse/grape-on-rails/README.md +29 -0
  60. data/integration/multiverse/grape-on-rails/Rakefile +16 -0
  61. data/integration/multiverse/grape-on-rails/app/api/acme/ping.rb +8 -0
  62. data/integration/multiverse/grape-on-rails/app/api/acme/post.rb +10 -0
  63. data/integration/multiverse/grape-on-rails/app/api/acme/protected.rb +13 -0
  64. data/integration/multiverse/grape-on-rails/app/api/acme/raise.rb +8 -0
  65. data/integration/multiverse/grape-on-rails/app/api/api.rb +8 -0
  66. data/integration/multiverse/grape-on-rails/app/assets/images/rails.png +0 -0
  67. data/integration/multiverse/grape-on-rails/app/assets/javascripts/application.js +15 -0
  68. data/integration/multiverse/grape-on-rails/app/assets/javascripts/welcome.js.coffee +3 -0
  69. data/integration/multiverse/grape-on-rails/app/assets/stylesheets/application.css +13 -0
  70. data/integration/multiverse/grape-on-rails/app/assets/stylesheets/welcome.css.scss +3 -0
  71. data/{test/dummy → integration/multiverse/grape-on-rails}/app/controllers/application_controller.rb +0 -0
  72. data/integration/multiverse/grape-on-rails/app/controllers/welcome_controller.rb +4 -0
  73. data/{test/dummy → integration/multiverse/grape-on-rails}/app/helpers/application_helper.rb +0 -0
  74. data/integration/multiverse/grape-on-rails/app/helpers/welcome_helper.rb +2 -0
  75. data/{test/dummy/db/development.sqlite3 → integration/multiverse/grape-on-rails/app/mailers/.gitkeep} +0 -0
  76. data/{test/dummy/db/test.sqlite3 → integration/multiverse/grape-on-rails/app/models/.gitkeep} +0 -0
  77. data/{test/dummy → integration/multiverse/grape-on-rails}/app/views/layouts/application.html.erb +2 -2
  78. data/integration/multiverse/grape-on-rails/app/views/welcome/index.html.erb +6 -0
  79. data/integration/multiverse/grape-on-rails/bin/bundle +3 -0
  80. data/integration/multiverse/grape-on-rails/bin/rails +4 -0
  81. data/integration/multiverse/grape-on-rails/bin/rake +4 -0
  82. data/{test/dummy → integration/multiverse/grape-on-rails}/config/application.rb +26 -6
  83. data/integration/multiverse/grape-on-rails/config/boot.rb +6 -0
  84. data/integration/multiverse/grape-on-rails/config/database.travis.yml +4 -0
  85. data/integration/multiverse/grape-on-rails/config/database.yml +16 -0
  86. data/{test/dummy → integration/multiverse/grape-on-rails}/config/environment.rb +1 -1
  87. data/{test/dummy → integration/multiverse/grape-on-rails}/config/environments/development.rb +4 -5
  88. data/{test/dummy → integration/multiverse/grape-on-rails}/config/environments/production.rb +9 -4
  89. data/{test/dummy → integration/multiverse/grape-on-rails}/config/environments/test.rb +9 -18
  90. data/{test/dummy → integration/multiverse/grape-on-rails}/config/initializers/backtrace_silencers.rb +0 -0
  91. data/{test/dummy → integration/multiverse/grape-on-rails}/config/initializers/inflections.rb +5 -0
  92. data/{test/dummy → integration/multiverse/grape-on-rails}/config/initializers/mime_types.rb +0 -0
  93. data/integration/multiverse/grape-on-rails/config/initializers/reload_api.rb +13 -0
  94. data/integration/multiverse/grape-on-rails/config/initializers/secret_token.rb +1 -0
  95. data/{test/dummy → integration/multiverse/grape-on-rails}/config/initializers/session_store.rb +2 -2
  96. data/integration/multiverse/grape-on-rails/config/initializers/vitals.rb +8 -0
  97. data/{test/dummy → integration/multiverse/grape-on-rails}/config/initializers/wrap_parameters.rb +0 -0
  98. data/{test/dummy → integration/multiverse/grape-on-rails}/config/locales/en.yml +0 -0
  99. data/integration/multiverse/grape-on-rails/config/routes.rb +5 -0
  100. data/integration/multiverse/grape-on-rails/config.ru +4 -0
  101. data/integration/multiverse/grape-on-rails/db/schema.rb +16 -0
  102. data/integration/multiverse/grape-on-rails/db/seeds.rb +7 -0
  103. data/integration/multiverse/grape-on-rails/doc/README_FOR_APP +2 -0
  104. data/{test/dummy/log/test.log → integration/multiverse/grape-on-rails/lib/assets/.gitkeep} +0 -0
  105. data/{test/dummy/public/favicon.ico → integration/multiverse/grape-on-rails/lib/tasks/.gitkeep} +0 -0
  106. data/integration/multiverse/grape-on-rails/log/.gitkeep +0 -0
  107. data/{test/dummy → integration/multiverse/grape-on-rails}/public/404.html +0 -0
  108. data/{test/dummy → integration/multiverse/grape-on-rails}/public/422.html +0 -0
  109. data/{test/dummy → integration/multiverse/grape-on-rails}/public/500.html +0 -1
  110. data/integration/multiverse/grape-on-rails/public/favicon.ico +0 -0
  111. data/integration/multiverse/grape-on-rails/public/robots.txt +5 -0
  112. data/{test/dummy → integration/multiverse/grape-on-rails}/script/rails +2 -2
  113. data/integration/multiverse/grape-on-rails/spec/api/ping_spec.rb +15 -0
  114. data/integration/multiverse/grape-on-rails/spec/spec_helper.rb +15 -0
  115. data/integration/multiverse/rails42_app/.gitignore +18 -0
  116. data/integration/multiverse/rails42_app/Gemfile +49 -0
  117. data/integration/multiverse/rails42_app/Gemfile.lock +167 -0
  118. data/integration/multiverse/rails42_app/README.rdoc +28 -0
  119. data/{test/dummy → integration/multiverse/rails42_app}/Rakefile +1 -2
  120. data/integration/multiverse/rails42_app/app/assets/images/.keep +0 -0
  121. data/integration/multiverse/rails42_app/app/assets/javascripts/application.js +16 -0
  122. data/integration/multiverse/rails42_app/app/assets/javascripts/posts.coffee +3 -0
  123. data/integration/multiverse/rails42_app/app/assets/stylesheets/application.css +15 -0
  124. data/integration/multiverse/rails42_app/app/assets/stylesheets/posts.scss +3 -0
  125. data/integration/multiverse/rails42_app/app/assets/stylesheets/scaffolds.scss +73 -0
  126. data/integration/multiverse/rails42_app/app/controllers/application_controller.rb +5 -0
  127. data/integration/multiverse/rails42_app/app/controllers/concerns/.keep +0 -0
  128. data/integration/multiverse/rails42_app/app/controllers/posts_controller.rb +75 -0
  129. data/integration/multiverse/rails42_app/app/helpers/application_helper.rb +2 -0
  130. data/integration/multiverse/rails42_app/app/helpers/posts_helper.rb +2 -0
  131. data/integration/multiverse/rails42_app/app/jobs/foobar_cleanup_job.rb +7 -0
  132. data/integration/multiverse/rails42_app/app/mailers/.keep +0 -0
  133. data/integration/multiverse/rails42_app/app/models/.keep +0 -0
  134. data/integration/multiverse/rails42_app/app/models/concerns/.keep +0 -0
  135. data/integration/multiverse/rails42_app/app/models/post.rb +2 -0
  136. data/integration/multiverse/rails42_app/app/views/layouts/application.html.erb +14 -0
  137. data/integration/multiverse/rails42_app/app/views/posts/_form.html.erb +21 -0
  138. data/integration/multiverse/rails42_app/app/views/posts/edit.html.erb +6 -0
  139. data/integration/multiverse/rails42_app/app/views/posts/index.html.erb +27 -0
  140. data/integration/multiverse/rails42_app/app/views/posts/index.json.jbuilder +4 -0
  141. data/integration/multiverse/rails42_app/app/views/posts/new.html.erb +5 -0
  142. data/integration/multiverse/rails42_app/app/views/posts/show.html.erb +9 -0
  143. data/integration/multiverse/rails42_app/app/views/posts/show.json.jbuilder +1 -0
  144. data/integration/multiverse/rails42_app/bin/bundle +3 -0
  145. data/integration/multiverse/rails42_app/bin/rails +9 -0
  146. data/integration/multiverse/rails42_app/bin/rake +9 -0
  147. data/integration/multiverse/rails42_app/bin/setup +29 -0
  148. data/integration/multiverse/rails42_app/bin/spring +15 -0
  149. data/integration/multiverse/rails42_app/config/application.rb +26 -0
  150. data/integration/multiverse/rails42_app/config/boot.rb +3 -0
  151. data/{test/dummy → integration/multiverse/rails42_app}/config/database.yml +8 -8
  152. data/integration/multiverse/rails42_app/config/environment.rb +5 -0
  153. data/integration/multiverse/rails42_app/config/environments/development.rb +41 -0
  154. data/integration/multiverse/rails42_app/config/environments/production.rb +79 -0
  155. data/integration/multiverse/rails42_app/config/environments/test.rb +42 -0
  156. data/integration/multiverse/rails42_app/config/initializers/assets.rb +11 -0
  157. data/integration/multiverse/rails42_app/config/initializers/backtrace_silencers.rb +7 -0
  158. data/integration/multiverse/rails42_app/config/initializers/cookies_serializer.rb +3 -0
  159. data/integration/multiverse/rails42_app/config/initializers/filter_parameter_logging.rb +4 -0
  160. data/integration/multiverse/rails42_app/config/initializers/inflections.rb +16 -0
  161. data/integration/multiverse/rails42_app/config/initializers/mime_types.rb +4 -0
  162. data/integration/multiverse/rails42_app/config/initializers/session_store.rb +3 -0
  163. data/integration/multiverse/rails42_app/config/initializers/vitals.rb +12 -0
  164. data/integration/multiverse/rails42_app/config/initializers/wrap_parameters.rb +14 -0
  165. data/integration/multiverse/rails42_app/config/locales/en.yml +23 -0
  166. data/integration/multiverse/rails42_app/config/routes.rb +57 -0
  167. data/integration/multiverse/rails42_app/config/secrets.yml +22 -0
  168. data/integration/multiverse/rails42_app/config.ru +4 -0
  169. data/integration/multiverse/rails42_app/db/migrate/20160321140358_create_posts.rb +9 -0
  170. data/integration/multiverse/rails42_app/db/schema.rb +22 -0
  171. data/integration/multiverse/rails42_app/db/seeds.rb +7 -0
  172. data/integration/multiverse/rails42_app/lib/assets/.keep +0 -0
  173. data/integration/multiverse/rails42_app/lib/tasks/.keep +0 -0
  174. data/integration/multiverse/rails42_app/log/.keep +0 -0
  175. data/integration/multiverse/rails42_app/public/404.html +67 -0
  176. data/integration/multiverse/rails42_app/public/422.html +67 -0
  177. data/integration/multiverse/rails42_app/public/500.html +66 -0
  178. data/integration/multiverse/rails42_app/public/favicon.ico +0 -0
  179. data/integration/multiverse/rails42_app/public/robots.txt +5 -0
  180. data/integration/multiverse/rails42_app/test/controllers/.keep +0 -0
  181. data/integration/multiverse/rails42_app/test/controllers/posts_controller_test.rb +49 -0
  182. data/integration/multiverse/rails42_app/test/fixtures/.keep +0 -0
  183. data/integration/multiverse/rails42_app/test/fixtures/posts.yml +7 -0
  184. data/integration/multiverse/rails42_app/test/helpers/.keep +0 -0
  185. data/integration/multiverse/rails42_app/test/integration/.keep +0 -0
  186. data/integration/multiverse/rails42_app/test/integration/vitals_flow_test.rb +78 -0
  187. data/integration/multiverse/rails42_app/test/jobs/foobar_cleanup_job_test.rb +7 -0
  188. data/integration/multiverse/rails42_app/test/mailers/.keep +0 -0
  189. data/integration/multiverse/rails42_app/test/models/.keep +0 -0
  190. data/{test/dummy/test/unit/task_test.rb → integration/multiverse/rails42_app/test/models/post_test.rb} +1 -1
  191. data/integration/multiverse/rails42_app/test/test_helper.rb +11 -0
  192. data/integration/multiverse_helper.rb +16 -0
  193. data/integration/multiverse_spec.rb +40 -0
  194. data/lib/vitals/configuration.rb +35 -0
  195. data/lib/vitals/formats/host_last_format.rb +26 -0
  196. data/lib/vitals/formats/production_format.rb +21 -0
  197. data/lib/vitals/integrations/notifications/action_controller.rb +26 -0
  198. data/lib/vitals/integrations/notifications/active_job.rb +18 -0
  199. data/lib/vitals/integrations/notifications/base.rb +20 -0
  200. data/lib/vitals/integrations/notifications/grape.rb +30 -0
  201. data/lib/vitals/integrations/rack/requests.rb +23 -0
  202. data/lib/vitals/reporters/base_reporter.rb +9 -0
  203. data/lib/vitals/reporters/console_reporter.rb +23 -0
  204. data/lib/vitals/reporters/inmem_reporter.rb +31 -0
  205. data/lib/vitals/reporters/multi_reporter.rb +24 -0
  206. data/lib/vitals/reporters/statsd_reporter.rb +27 -0
  207. data/lib/vitals/utils.rb +15 -0
  208. data/lib/vitals/version.rb +1 -1
  209. data/lib/vitals.rb +46 -23
  210. data/vitals.gemspec +48 -0
  211. metadata +404 -147
  212. data/MIT-LICENSE +0 -20
  213. data/lib/generators/vitals/templates/vitals_initializer.rb +0 -7
  214. data/lib/generators/vitals/vitals_generator.rb +0 -12
  215. data/lib/tasks/vitals_tasks.rake +0 -4
  216. data/lib/vitals/reporter.rb +0 -23
  217. data/test/dummy/app/assets/javascripts/application.js +0 -9
  218. data/test/dummy/app/assets/javascripts/tasks.js +0 -2
  219. data/test/dummy/app/assets/stylesheets/application.css +0 -7
  220. data/test/dummy/app/assets/stylesheets/scaffold.css +0 -56
  221. data/test/dummy/app/assets/stylesheets/tasks.css +0 -4
  222. data/test/dummy/app/controllers/tasks_controller.rb +0 -83
  223. data/test/dummy/app/helpers/tasks_helper.rb +0 -2
  224. data/test/dummy/app/models/task.rb +0 -2
  225. data/test/dummy/app/views/tasks/_form.html.erb +0 -21
  226. data/test/dummy/app/views/tasks/edit.html.erb +0 -6
  227. data/test/dummy/app/views/tasks/index.html.erb +0 -23
  228. data/test/dummy/app/views/tasks/new.html.erb +0 -5
  229. data/test/dummy/app/views/tasks/show.html.erb +0 -10
  230. data/test/dummy/config/boot.rb +0 -10
  231. data/test/dummy/config/initializers/secret_token.rb +0 -7
  232. data/test/dummy/config/routes.rb +0 -60
  233. data/test/dummy/config.ru +0 -4
  234. data/test/dummy/db/migrate/20110917182114_create_tasks.rb +0 -9
  235. data/test/dummy/log/development.log +0 -55
  236. data/test/dummy/test/fixtures/tasks.yml +0 -7
  237. data/test/dummy/test/functional/tasks_controller_test.rb +0 -49
  238. data/test/dummy/test/unit/helpers/tasks_helper_test.rb +0 -4
  239. data/test/test_helper.rb +0 -10
  240. data/test/vitals_test.rb +0 -7
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 144354fc633911fa91781b4ceefc10e9e8b0f7f7
4
+ data.tar.gz: 72b1133aa8c4ac7aa9bdcc59d69781f946ef9551
5
+ SHA512:
6
+ metadata.gz: 037a86c00abc7b8e1206f3ce651538a93d177b26853c57dda4f0d1511f57555b293bb72da24f9e930c8bfa1099686d92face5faf397b5de925e4877f34432e71
7
+ data.tar.gz: 0abeedcabd6f8a33403b5c894555b5729bb3b2fd1d960eaa01d22469217837d98ba6c3a976a0373bc9b5e39fe772a9839953cb6e82dec4002b079e1cf37dacc2
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ test/dummy/db/*.sqlite3
5
+ test/dummy/log/*.log
6
+ test/dummy/tmp/coverage/
7
+ coverage/
data/.travis.yml ADDED
@@ -0,0 +1,15 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.1.0
5
+ - 2.2.0
6
+ - 2.3.0
7
+ # - ruby-head
8
+ # use latest bundler because of ruby-head exposing a bundler bug.
9
+ # see https://github.com/bundler/bundler/pull/3559
10
+ # So, that didn't work. so let's not use ruby-head for a while
11
+ before_install: gem install bundler
12
+ matrix:
13
+ include:
14
+ - rvm: 2.3.0
15
+ script: bundle exec rake multiverse
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vitals.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,157 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ vitals (0.3.0)
5
+ statsd-ruby (~> 1.3.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (4.2.6)
11
+ i18n (~> 0.7)
12
+ json (~> 1.7, >= 1.7.7)
13
+ minitest (~> 5.1)
14
+ thread_safe (~> 0.3, >= 0.3.4)
15
+ tzinfo (~> 1.1)
16
+ ast (2.2.0)
17
+ axiom-types (0.1.1)
18
+ descendants_tracker (~> 0.0.4)
19
+ ice_nine (~> 0.11.0)
20
+ thread_safe (~> 0.3, >= 0.3.1)
21
+ benchmark-ips (2.5.0)
22
+ builder (3.2.2)
23
+ coderay (1.1.1)
24
+ coercible (1.0.0)
25
+ descendants_tracker (~> 0.0.1)
26
+ coveralls (0.8.13)
27
+ json (~> 1.8)
28
+ simplecov (~> 0.11.0)
29
+ term-ansicolor (~> 1.3)
30
+ thor (~> 0.19.1)
31
+ tins (~> 1.6.0)
32
+ descendants_tracker (0.0.4)
33
+ thread_safe (~> 0.3, >= 0.3.1)
34
+ docile (1.1.5)
35
+ equalizer (0.0.11)
36
+ ffi (1.9.10)
37
+ formatador (0.2.5)
38
+ grape (0.15.0)
39
+ activesupport
40
+ builder
41
+ hashie (>= 2.1.0)
42
+ multi_json (>= 1.3.2)
43
+ multi_xml (>= 0.5.2)
44
+ rack (>= 1.3.0)
45
+ rack-accept
46
+ rack-mount
47
+ virtus (>= 1.0.0)
48
+ guard (2.13.0)
49
+ formatador (>= 0.2.4)
50
+ listen (>= 2.7, <= 4.0)
51
+ lumberjack (~> 1.0)
52
+ nenv (~> 0.1)
53
+ notiffany (~> 0.0)
54
+ pry (>= 0.9.12)
55
+ shellany (~> 0.0)
56
+ thor (>= 0.18.1)
57
+ guard-compat (1.2.1)
58
+ guard-minitest (2.4.4)
59
+ guard-compat (~> 1.2)
60
+ minitest (>= 3.0)
61
+ guard-rubocop (1.2.0)
62
+ guard (~> 2.0)
63
+ rubocop (~> 0.20)
64
+ hashie (3.4.3)
65
+ i18n (0.7.0)
66
+ ice_nine (0.11.2)
67
+ json (1.8.3)
68
+ listen (3.0.6)
69
+ rb-fsevent (>= 0.9.3)
70
+ rb-inotify (>= 0.9.7)
71
+ lumberjack (1.0.10)
72
+ memory_profiler (0.9.6)
73
+ method_source (0.8.2)
74
+ minitest (5.8.4)
75
+ multi_json (1.11.2)
76
+ multi_xml (0.5.5)
77
+ nenv (0.3.0)
78
+ notiffany (0.0.8)
79
+ nenv (~> 0.1)
80
+ shellany (~> 0.0)
81
+ parser (2.3.0.6)
82
+ ast (~> 2.2)
83
+ powerpack (0.1.1)
84
+ pry (0.10.3)
85
+ coderay (~> 1.1.0)
86
+ method_source (~> 0.8.1)
87
+ slop (~> 3.4)
88
+ rack (1.6.4)
89
+ rack-accept (0.4.5)
90
+ rack (>= 0.4)
91
+ rack-mount (0.8.3)
92
+ rack (>= 1.0.0)
93
+ rack-protection (1.5.3)
94
+ rack
95
+ rack-test (0.6.3)
96
+ rack (>= 1.0)
97
+ rainbow (2.1.0)
98
+ rake (10.5.0)
99
+ rb-fsevent (0.9.7)
100
+ rb-inotify (0.9.7)
101
+ ffi (>= 0.5.0)
102
+ rr (1.1.2)
103
+ rubocop (0.38.0)
104
+ parser (>= 2.3.0.6, < 3.0)
105
+ powerpack (~> 0.1)
106
+ rainbow (>= 1.99.1, < 3.0)
107
+ ruby-progressbar (~> 1.7)
108
+ unicode-display_width (~> 1.0, >= 1.0.1)
109
+ ruby-progressbar (1.7.5)
110
+ shellany (0.0.1)
111
+ simplecov (0.11.2)
112
+ docile (~> 1.1.0)
113
+ json (~> 1.8)
114
+ simplecov-html (~> 0.10.0)
115
+ simplecov-html (0.10.0)
116
+ sinatra (1.4.7)
117
+ rack (~> 1.5)
118
+ rack-protection (~> 1.4)
119
+ tilt (>= 1.3, < 3)
120
+ slop (3.6.0)
121
+ statsd-ruby (1.3.0)
122
+ term-ansicolor (1.3.2)
123
+ tins (~> 1.0)
124
+ thor (0.19.1)
125
+ thread_safe (0.3.5)
126
+ tilt (2.0.2)
127
+ tins (1.6.0)
128
+ tzinfo (1.2.2)
129
+ thread_safe (~> 0.1)
130
+ unicode-display_width (1.0.2)
131
+ virtus (1.0.5)
132
+ axiom-types (~> 0.1)
133
+ coercible (~> 1.0)
134
+ descendants_tracker (~> 0.0, >= 0.0.3)
135
+ equalizer (~> 0.0, >= 0.0.9)
136
+
137
+ PLATFORMS
138
+ ruby
139
+
140
+ DEPENDENCIES
141
+ activesupport (~> 4.2.6)
142
+ benchmark-ips (~> 2.5.0)
143
+ bundler (~> 1.11)
144
+ coveralls (~> 0.8.13)
145
+ grape (~> 0.15.0)
146
+ guard-minitest (~> 2.4.4)
147
+ guard-rubocop (~> 1.2.0)
148
+ memory_profiler (~> 0.9.6)
149
+ minitest (~> 5.0)
150
+ rack-test (~> 0.6.3)
151
+ rake (~> 10.0)
152
+ rr (~> 1.1.2)
153
+ sinatra (~> 1.4.7)
154
+ vitals!
155
+
156
+ BUNDLED WITH
157
+ 1.11.2
data/Guardfile ADDED
@@ -0,0 +1,11 @@
1
+ guard :minitest do
2
+ # with Minitest::Spec
3
+ watch(%r{^spec/(.*)_spec\.rb$})
4
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
5
+ watch(%r{^spec/spec_helper\.rb$}) { 'spec' }
6
+ end
7
+
8
+ #guard :rubocop do
9
+ # watch(%r{.+\.rb$})
10
+ # watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
11
+ #end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Dotan Nahum
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,22 +1,148 @@
1
1
  # Vitals
2
2
 
3
- Vitals is a very simple rails 3 plugin which reports `ActiveSupport` `Notification`s
4
- back to `statsd`.
3
+ [![Build Status](https://travis-ci.org/jondot/vitals.svg?branch=master)](https://travis-ci.org/jondot/vitals.svg)
4
+ [![Coverage Status](https://coveralls.io/repos/github/jondot/vitals/badge.svg?branch=master)](https://coveralls.io/github/jondot/vitals?branch=master)
5
5
 
6
- ## Getting Started
6
+ Vitals is the one stop shop to doing metrics in Ruby. It currently support Rails,
7
+ Rack (Sinatra and any Rack-supported frameworks), and Grape.
7
8
 
8
- Add `vitals` to your `Gemfile`. Then, run:
9
9
 
10
- $ rails g vitals
10
+ ## Installation
11
11
 
12
- or, if you're not running `statsd` at the default configuration
13
- (localhost/8125) try:
12
+ Add this line to your application's Gemfile:
14
13
 
15
- $ rails g vitals --statsd-host=<YOURHOST> --port=<PORT>
14
+ ```ruby
15
+ gem 'vitals'
16
+ ```
16
17
 
17
- Which places a convenience initializer for you; and you're done!
18
+ And then execute:
18
19
 
20
+ $ bundle
19
21
 
22
+ Or install it yourself as:
20
23
 
24
+ $ gem install vitals
21
25
 
26
+ ## Usage
22
27
 
28
+ ### Rails or Grape
29
+
30
+ Make an `initializers/vitals.rb` initializer, and cofigure Vitals as you'd like:
31
+ ```ruby
32
+ require 'vitals'
33
+ Vitals.configure! do |c|
34
+ c.facility = 'my_service'
35
+ c.reporter = Vitals::Reporters::StatsdReporter.new(host: 'statsd-host', port: 8125)
36
+ end
37
+
38
+ #
39
+ # Rails
40
+ #
41
+ require 'vitals/integrations/notifications/action_controller'
42
+ Vitals::Integrations::Notifications::ActionController.subscribe!
43
+
44
+ # if you also want ActiveJob metrics
45
+ require 'vitals/integrations/notifications/action_job'
46
+ Vitals::Integrations::Notifications::ActiveJob.subscribe!
47
+
48
+
49
+ #
50
+ # Grape
51
+ #
52
+ require 'vitals/integrations/notifications/grape'
53
+ Vitals::Integrations::Notifications::Grapej.subscribe!
54
+ ```
55
+
56
+ ### Rack
57
+
58
+ Here, you can use the `Requests` middleware. Here is a sample Sinatra app:
59
+
60
+ ```ruby
61
+ require 'vitals'
62
+ require 'vitals/integrations/rack/requests'
63
+
64
+ class SinatraTestAPI < Sinatra::Base
65
+ use Vitals::Integrations::Rack::Requests
66
+
67
+ get '/foo/bar/baz' do
68
+ sleep 0.1
69
+ "hello get"
70
+ end
71
+
72
+ post '/foo/bar/:name' do
73
+ sleep 0.1
74
+ "hello post"
75
+ end
76
+ end
77
+ ```
78
+
79
+ ### Ruby
80
+
81
+ You can emit metrics from anywhere:
82
+
83
+ ```ruby
84
+ Vitals.inc('my_metric')
85
+
86
+ Vitals.gauge('my_metric', 42)
87
+
88
+ Vitals.timing('my_metric', 500) # milliseconds
89
+
90
+ Vitals.time('my_metric'){
91
+ # so something slow
92
+ }
93
+
94
+ # Use a dot to logically separate segments
95
+
96
+ Vitals.timing('category.my_metric', 500) # milliseconds
97
+ ```
98
+
99
+ ### Configuration Options
100
+
101
+ The Vitals API is extensible. It should resemble the standard `Logger` look and feel,
102
+ and it revolves around 3 concepts:
103
+
104
+ 1. `Reporter` - the thing that takes your metrics and flushes them to a metrics agent. Use `StatsdReporter` in production
105
+ and `ConsoleReporter` in development. `ConsoleReporter` will spit out metrics to `stdout` as they come. You can also
106
+ wire them _both_ with `MultiReporter`. Check the [specs](/spec/reporters) for how to do that.
107
+ 2. `Format` - takes the contextual information (host, service, environment) and your metric, and formats them in an
108
+ order that makes sense for working with Graphite. You have the `ProductionFormat` and `HostLastFormat`.
109
+ 3. `Integrations` - integrations hook things that we're able to instrument with Vitals. Check [integrations](/lib/vitals/integrations) for more.
110
+
111
+ Here's what's available to you at configuration time:
112
+
113
+ ```ruby
114
+ Vitals.configure! do |c|
115
+ # Set your service name (default: 'default')
116
+ c.facility = 'my_service'
117
+
118
+ # Set environment (default: taken from RACK_ENV)
119
+ # c.environment = 'env'
120
+
121
+ # Set a host (default: taken from hostname)
122
+ # c.host = 'foohost'
123
+
124
+ # Use a specific reporter (default: InmemReporter)
125
+ # c.reporter = Vitals::Reporters::ConsoleReporter.new
126
+
127
+ # Use a different format perhaps? (default: ProductionFormat)
128
+ # c.format = Vitals::Formats::HostLastFormat
129
+ end
130
+ ```
131
+
132
+
133
+
134
+ ## Development
135
+
136
+ Tests and benchmarks should be run with at least Ruby 2.1 (because of memory profiling API)
137
+
138
+ ```
139
+ $ bundle install && rake spec && rake bench
140
+ ```
141
+
142
+ # Contributing
143
+
144
+ Fork, implement, add tests, pull request, get my everlasting thanks and a respectable place here :).
145
+
146
+ # Copyright
147
+
148
+ Copyright (c) 2011-2016 [Dotan Nahum](http://gplus.to/dotan) [@jondot](http://twitter.com/jondot). See [LICENSE](LICENSE.txt) for further details.
data/Rakefile CHANGED
@@ -1,37 +1,23 @@
1
- #!/usr/bin/env rake
2
- begin
3
- require 'bundler/setup'
4
- rescue LoadError
5
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
- end
7
- begin
8
- require 'rdoc/task'
9
- rescue LoadError
10
- require 'rdoc/rdoc'
11
- require 'rake/rdoctask'
12
- RDoc::Task = Rake::RDocTask
13
- end
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
14
3
 
15
- RDoc::Task.new(:rdoc) do |rdoc|
16
- rdoc.rdoc_dir = 'rdoc'
17
- rdoc.title = 'Vitals'
18
- rdoc.options << '--line-numbers'
19
- rdoc.rdoc_files.include('README.rdoc')
20
- rdoc.rdoc_files.include('lib/**/*.rb')
4
+ Rake::TestTask.new(:spec) do |t|
5
+ t.libs << "spec"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['spec/**/*_spec.rb']
21
8
  end
22
9
 
23
-
24
-
25
- Bundler::GemHelper.install_tasks
26
-
27
- require 'rake/testtask'
28
-
29
- Rake::TestTask.new(:test) do |t|
30
- t.libs << 'lib'
31
- t.libs << 'test'
32
- t.pattern = 'test/**/*_test.rb'
33
- t.verbose = false
10
+ Rake::TestTask.new(:multiverse) do |t|
11
+ t.libs << "integration"
12
+ t.libs << "spec"
13
+ t.libs << "lib"
14
+ t.test_files = FileList['integration/multiverse_spec.rb']
34
15
  end
35
16
 
17
+ Rake::TestTask.new(:bench) do |t|
18
+ t.libs << "spec"
19
+ t.libs << "lib"
20
+ t.test_files = FileList['spec/**/*_bench.rb']
21
+ end
36
22
 
37
- task :default => :test
23
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "vitals"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,7 @@
1
+ .DS_Store
2
+ .rvmrc
3
+ .redcar
4
+ .irbrc
5
+ .bundle
6
+ log
7
+ vendor/
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format=progress
@@ -0,0 +1,2 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
@@ -0,0 +1,50 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2015-08-28 08:52:35 -0400 using RuboCop version 0.33.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ Metrics/AbcSize:
11
+ Max: 19
12
+
13
+ # Offense count: 27
14
+ # Configuration parameters: AllowURI, URISchemes.
15
+ Metrics/LineLength:
16
+ Max: 126
17
+
18
+ # Offense count: 1
19
+ # Configuration parameters: CountComments.
20
+ Metrics/MethodLength:
21
+ Max: 15
22
+
23
+ # Offense count: 15
24
+ Style/Documentation:
25
+ Exclude:
26
+ - 'api/content_type.rb'
27
+ - 'api/entities.rb'
28
+ - 'api/get_json.rb'
29
+ - 'api/header_versioning.rb'
30
+ - 'api/path_versioning.rb'
31
+ - 'api/ping.rb'
32
+ - 'api/post_json.rb'
33
+ - 'api/post_put.rb'
34
+ - 'api/rescue_from.rb'
35
+ - 'api/upload_file.rb'
36
+ - 'api/wrap_response.rb'
37
+ - 'api/wrap_response_decorator.rb'
38
+ - 'app/acme_app.rb'
39
+ - 'app/api.rb'
40
+
41
+ # Offense count: 1
42
+ # Cop supports --auto-correct.
43
+ Style/Lambda:
44
+ Exclude:
45
+ - 'app/acme_app.rb'
46
+
47
+ # Offense count: 1
48
+ Style/RescueModifier:
49
+ Exclude:
50
+ - 'api/get_json.rb'
@@ -0,0 +1,12 @@
1
+ sudo: false
2
+
3
+ rvm:
4
+ - 2.2.4
5
+
6
+ language: ruby
7
+
8
+ cache: bundler
9
+
10
+ before_install:
11
+ - "export DISPLAY=:99.0"
12
+ - "sh -e /etc/init.d/xvfb start"
@@ -0,0 +1,28 @@
1
+ source 'http://rubygems.org'
2
+
3
+
4
+ gem 'grape'
5
+ gem 'grape-entity'
6
+ gem 'json'
7
+ gem 'newrelic_rpm'
8
+ gem 'rack-cors'
9
+ gem 'grape-swagger'
10
+ gem 'mime-types'
11
+ gem 'nokogiri'
12
+
13
+ group :development do
14
+ gem 'rake'
15
+ gem 'guard'
16
+ gem 'guard-bundler'
17
+ gem 'guard-rack'
18
+ gem 'rubocop'
19
+ end
20
+
21
+ group :test do
22
+ gem 'rspec'
23
+ gem 'rack-test'
24
+ gem 'capybara'
25
+ gem 'selenium-webdriver'
26
+ end
27
+
28
+ gem 'vitals', path: '../../../'