appsignal 2.5.0.alpha.1-java

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.
Files changed (211) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +33 -0
  3. data/.rspec +4 -0
  4. data/.rubocop.yml +66 -0
  5. data/.rubocop_todo.yml +124 -0
  6. data/.travis.yml +72 -0
  7. data/.yardopts +8 -0
  8. data/CHANGELOG.md +639 -0
  9. data/Gemfile +3 -0
  10. data/LICENSE +20 -0
  11. data/README.md +264 -0
  12. data/Rakefile +214 -0
  13. data/appsignal.gemspec +42 -0
  14. data/benchmark.rake +77 -0
  15. data/bin/appsignal +13 -0
  16. data/ext/Rakefile +27 -0
  17. data/ext/agent.yml +64 -0
  18. data/ext/appsignal_extension.c +692 -0
  19. data/ext/base.rb +79 -0
  20. data/ext/extconf.rb +35 -0
  21. data/gemfiles/capistrano2.gemfile +7 -0
  22. data/gemfiles/capistrano3.gemfile +7 -0
  23. data/gemfiles/grape.gemfile +7 -0
  24. data/gemfiles/no_dependencies.gemfile +5 -0
  25. data/gemfiles/padrino.gemfile +7 -0
  26. data/gemfiles/que.gemfile +5 -0
  27. data/gemfiles/rails-3.2.gemfile +6 -0
  28. data/gemfiles/rails-4.0.gemfile +6 -0
  29. data/gemfiles/rails-4.1.gemfile +6 -0
  30. data/gemfiles/rails-4.2.gemfile +10 -0
  31. data/gemfiles/rails-5.0.gemfile +5 -0
  32. data/gemfiles/rails-5.1.gemfile +5 -0
  33. data/gemfiles/resque.gemfile +12 -0
  34. data/gemfiles/sequel-435.gemfile +11 -0
  35. data/gemfiles/sequel.gemfile +11 -0
  36. data/gemfiles/sinatra.gemfile +6 -0
  37. data/gemfiles/webmachine.gemfile +5 -0
  38. data/lib/appsignal.rb +804 -0
  39. data/lib/appsignal/auth_check.rb +65 -0
  40. data/lib/appsignal/capistrano.rb +10 -0
  41. data/lib/appsignal/cli.rb +108 -0
  42. data/lib/appsignal/cli/demo.rb +63 -0
  43. data/lib/appsignal/cli/diagnose.rb +500 -0
  44. data/lib/appsignal/cli/helpers.rb +72 -0
  45. data/lib/appsignal/cli/install.rb +277 -0
  46. data/lib/appsignal/cli/notify_of_deploy.rb +113 -0
  47. data/lib/appsignal/config.rb +287 -0
  48. data/lib/appsignal/demo.rb +107 -0
  49. data/lib/appsignal/event_formatter.rb +74 -0
  50. data/lib/appsignal/event_formatter/action_view/render_formatter.rb +24 -0
  51. data/lib/appsignal/event_formatter/active_record/instantiation_formatter.rb +14 -0
  52. data/lib/appsignal/event_formatter/active_record/sql_formatter.rb +14 -0
  53. data/lib/appsignal/event_formatter/elastic_search/search_formatter.rb +32 -0
  54. data/lib/appsignal/event_formatter/faraday/request_formatter.rb +19 -0
  55. data/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter.rb +89 -0
  56. data/lib/appsignal/event_formatter/moped/query_formatter.rb +80 -0
  57. data/lib/appsignal/extension.rb +63 -0
  58. data/lib/appsignal/extension/jruby.rb +460 -0
  59. data/lib/appsignal/garbage_collection_profiler.rb +48 -0
  60. data/lib/appsignal/hooks.rb +105 -0
  61. data/lib/appsignal/hooks/action_cable.rb +113 -0
  62. data/lib/appsignal/hooks/active_support_notifications.rb +52 -0
  63. data/lib/appsignal/hooks/celluloid.rb +30 -0
  64. data/lib/appsignal/hooks/data_mapper.rb +18 -0
  65. data/lib/appsignal/hooks/delayed_job.rb +19 -0
  66. data/lib/appsignal/hooks/mongo_ruby_driver.rb +21 -0
  67. data/lib/appsignal/hooks/net_http.rb +29 -0
  68. data/lib/appsignal/hooks/passenger.rb +22 -0
  69. data/lib/appsignal/hooks/puma.rb +35 -0
  70. data/lib/appsignal/hooks/que.rb +21 -0
  71. data/lib/appsignal/hooks/rake.rb +39 -0
  72. data/lib/appsignal/hooks/redis.rb +30 -0
  73. data/lib/appsignal/hooks/sequel.rb +60 -0
  74. data/lib/appsignal/hooks/shoryuken.rb +43 -0
  75. data/lib/appsignal/hooks/sidekiq.rb +144 -0
  76. data/lib/appsignal/hooks/unicorn.rb +40 -0
  77. data/lib/appsignal/hooks/webmachine.rb +23 -0
  78. data/lib/appsignal/integrations/capistrano/appsignal.cap +39 -0
  79. data/lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb +52 -0
  80. data/lib/appsignal/integrations/data_mapper.rb +33 -0
  81. data/lib/appsignal/integrations/delayed_job_plugin.rb +54 -0
  82. data/lib/appsignal/integrations/grape.rb +53 -0
  83. data/lib/appsignal/integrations/mongo_ruby_driver.rb +55 -0
  84. data/lib/appsignal/integrations/object.rb +35 -0
  85. data/lib/appsignal/integrations/padrino.rb +84 -0
  86. data/lib/appsignal/integrations/que.rb +43 -0
  87. data/lib/appsignal/integrations/railtie.rb +41 -0
  88. data/lib/appsignal/integrations/rake.rb +2 -0
  89. data/lib/appsignal/integrations/resque.rb +20 -0
  90. data/lib/appsignal/integrations/resque_active_job.rb +30 -0
  91. data/lib/appsignal/integrations/sinatra.rb +17 -0
  92. data/lib/appsignal/integrations/webmachine.rb +38 -0
  93. data/lib/appsignal/js_exception_transaction.rb +54 -0
  94. data/lib/appsignal/marker.rb +63 -0
  95. data/lib/appsignal/minutely.rb +42 -0
  96. data/lib/appsignal/rack/generic_instrumentation.rb +49 -0
  97. data/lib/appsignal/rack/js_exception_catcher.rb +70 -0
  98. data/lib/appsignal/rack/rails_instrumentation.rb +51 -0
  99. data/lib/appsignal/rack/sinatra_instrumentation.rb +99 -0
  100. data/lib/appsignal/rack/streaming_listener.rb +73 -0
  101. data/lib/appsignal/system.rb +81 -0
  102. data/lib/appsignal/transaction.rb +498 -0
  103. data/lib/appsignal/transmitter.rb +107 -0
  104. data/lib/appsignal/utils.rb +127 -0
  105. data/lib/appsignal/utils/params_sanitizer.rb +59 -0
  106. data/lib/appsignal/utils/query_params_sanitizer.rb +55 -0
  107. data/lib/appsignal/version.rb +3 -0
  108. data/lib/sequel/extensions/appsignal_integration.rb +3 -0
  109. data/resources/appsignal.yml.erb +39 -0
  110. data/resources/cacert.pem +3866 -0
  111. data/spec/.rubocop.yml +7 -0
  112. data/spec/lib/appsignal/auth_check_spec.rb +80 -0
  113. data/spec/lib/appsignal/capistrano2_spec.rb +224 -0
  114. data/spec/lib/appsignal/capistrano3_spec.rb +237 -0
  115. data/spec/lib/appsignal/cli/demo_spec.rb +67 -0
  116. data/spec/lib/appsignal/cli/diagnose_spec.rb +988 -0
  117. data/spec/lib/appsignal/cli/helpers_spec.rb +171 -0
  118. data/spec/lib/appsignal/cli/install_spec.rb +632 -0
  119. data/spec/lib/appsignal/cli/notify_of_deploy_spec.rb +168 -0
  120. data/spec/lib/appsignal/cli_spec.rb +56 -0
  121. data/spec/lib/appsignal/config_spec.rb +637 -0
  122. data/spec/lib/appsignal/demo_spec.rb +87 -0
  123. data/spec/lib/appsignal/event_formatter/action_view/render_formatter_spec.rb +44 -0
  124. data/spec/lib/appsignal/event_formatter/active_record/instantiation_formatter_spec.rb +21 -0
  125. data/spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb +21 -0
  126. data/spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb +52 -0
  127. data/spec/lib/appsignal/event_formatter/faraday/request_formatter_spec.rb +21 -0
  128. data/spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb +113 -0
  129. data/spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb +112 -0
  130. data/spec/lib/appsignal/event_formatter_spec.rb +100 -0
  131. data/spec/lib/appsignal/extension/jruby_spec.rb +43 -0
  132. data/spec/lib/appsignal/extension_spec.rb +137 -0
  133. data/spec/lib/appsignal/garbage_collection_profiler_spec.rb +66 -0
  134. data/spec/lib/appsignal/hooks/action_cable_spec.rb +370 -0
  135. data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +92 -0
  136. data/spec/lib/appsignal/hooks/celluloid_spec.rb +35 -0
  137. data/spec/lib/appsignal/hooks/data_mapper_spec.rb +39 -0
  138. data/spec/lib/appsignal/hooks/delayed_job_spec.rb +358 -0
  139. data/spec/lib/appsignal/hooks/mongo_ruby_driver_spec.rb +44 -0
  140. data/spec/lib/appsignal/hooks/net_http_spec.rb +53 -0
  141. data/spec/lib/appsignal/hooks/passenger_spec.rb +30 -0
  142. data/spec/lib/appsignal/hooks/puma_spec.rb +80 -0
  143. data/spec/lib/appsignal/hooks/que_spec.rb +19 -0
  144. data/spec/lib/appsignal/hooks/rake_spec.rb +73 -0
  145. data/spec/lib/appsignal/hooks/redis_spec.rb +55 -0
  146. data/spec/lib/appsignal/hooks/sequel_spec.rb +46 -0
  147. data/spec/lib/appsignal/hooks/shoryuken_spec.rb +192 -0
  148. data/spec/lib/appsignal/hooks/sidekiq_spec.rb +419 -0
  149. data/spec/lib/appsignal/hooks/unicorn_spec.rb +52 -0
  150. data/spec/lib/appsignal/hooks/webmachine_spec.rb +35 -0
  151. data/spec/lib/appsignal/hooks_spec.rb +195 -0
  152. data/spec/lib/appsignal/integrations/data_mapper_spec.rb +65 -0
  153. data/spec/lib/appsignal/integrations/grape_spec.rb +225 -0
  154. data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +127 -0
  155. data/spec/lib/appsignal/integrations/object_spec.rb +249 -0
  156. data/spec/lib/appsignal/integrations/padrino_spec.rb +323 -0
  157. data/spec/lib/appsignal/integrations/que_spec.rb +174 -0
  158. data/spec/lib/appsignal/integrations/railtie_spec.rb +129 -0
  159. data/spec/lib/appsignal/integrations/resque_active_job_spec.rb +83 -0
  160. data/spec/lib/appsignal/integrations/resque_spec.rb +92 -0
  161. data/spec/lib/appsignal/integrations/sinatra_spec.rb +73 -0
  162. data/spec/lib/appsignal/integrations/webmachine_spec.rb +69 -0
  163. data/spec/lib/appsignal/js_exception_transaction_spec.rb +128 -0
  164. data/spec/lib/appsignal/marker_spec.rb +51 -0
  165. data/spec/lib/appsignal/minutely_spec.rb +50 -0
  166. data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +90 -0
  167. data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +147 -0
  168. data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +117 -0
  169. data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +213 -0
  170. data/spec/lib/appsignal/rack/streaming_listener_spec.rb +161 -0
  171. data/spec/lib/appsignal/system_spec.rb +131 -0
  172. data/spec/lib/appsignal/transaction_spec.rb +1146 -0
  173. data/spec/lib/appsignal/transmitter_spec.rb +152 -0
  174. data/spec/lib/appsignal/utils/params_sanitizer_spec.rb +136 -0
  175. data/spec/lib/appsignal/utils/query_params_sanitizer_spec.rb +192 -0
  176. data/spec/lib/appsignal/utils_spec.rb +150 -0
  177. data/spec/lib/appsignal_spec.rb +1049 -0
  178. data/spec/spec_helper.rb +116 -0
  179. data/spec/support/fixtures/containers/cgroups/docker +14 -0
  180. data/spec/support/fixtures/containers/cgroups/docker_systemd +8 -0
  181. data/spec/support/fixtures/containers/cgroups/lxc +10 -0
  182. data/spec/support/fixtures/containers/cgroups/no_permission +0 -0
  183. data/spec/support/fixtures/containers/cgroups/none +1 -0
  184. data/spec/support/fixtures/generated_config.yml +24 -0
  185. data/spec/support/fixtures/uploaded_file.txt +0 -0
  186. data/spec/support/helpers/api_request_helper.rb +19 -0
  187. data/spec/support/helpers/cli_helpers.rb +26 -0
  188. data/spec/support/helpers/config_helpers.rb +21 -0
  189. data/spec/support/helpers/dependency_helper.rb +73 -0
  190. data/spec/support/helpers/directory_helper.rb +27 -0
  191. data/spec/support/helpers/env_helpers.rb +33 -0
  192. data/spec/support/helpers/example_exception.rb +13 -0
  193. data/spec/support/helpers/example_standard_error.rb +13 -0
  194. data/spec/support/helpers/log_helpers.rb +22 -0
  195. data/spec/support/helpers/std_streams_helper.rb +66 -0
  196. data/spec/support/helpers/system_helpers.rb +8 -0
  197. data/spec/support/helpers/time_helpers.rb +11 -0
  198. data/spec/support/helpers/transaction_helpers.rb +37 -0
  199. data/spec/support/matchers/contains_log.rb +7 -0
  200. data/spec/support/mocks/fake_gc_profiler.rb +19 -0
  201. data/spec/support/mocks/mock_extension.rb +6 -0
  202. data/spec/support/project_fixture/config/application.rb +0 -0
  203. data/spec/support/project_fixture/config/appsignal.yml +32 -0
  204. data/spec/support/project_fixture/config/environments/development.rb +0 -0
  205. data/spec/support/project_fixture/config/environments/production.rb +0 -0
  206. data/spec/support/project_fixture/config/environments/test.rb +0 -0
  207. data/spec/support/project_fixture/log/.gitkeep +0 -0
  208. data/spec/support/rails/my_app.rb +6 -0
  209. data/spec/support/shared_examples/instrument.rb +43 -0
  210. data/spec/support/stubs/delayed_job.rb +0 -0
  211. metadata +483 -0
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012-2017 AppSignal
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.
@@ -0,0 +1,264 @@
1
+ # AppSignal for Ruby
2
+
3
+ AppSignal solves all your Ruby monitoring needs in a single tool. You and your
4
+ team can focus on writing code and we'll provide the alerts if your app has any
5
+ issues.
6
+
7
+ - [AppSignal.com website][appsignal]
8
+ - [Documentation][docs]
9
+ - [Support][contact]
10
+
11
+ [![Build Status](https://travis-ci.org/appsignal/appsignal-ruby.png?branch=master)](https://travis-ci.org/appsignal/appsignal-ruby)
12
+ [![Gem Version](https://badge.fury.io/rb/appsignal.svg)](http://badge.fury.io/rb/appsignal)
13
+ [![Code Climate](https://codeclimate.com/github/appsignal/appsignal.png)](https://codeclimate.com/github/appsignal/appsignal)
14
+
15
+ ## Description
16
+
17
+ The AppSignal gem collects exceptions and performance data from your Ruby
18
+ applications and sends it to [AppSignal][appsignal] for analysis. Get alerted
19
+ when an error occurs or an endpoint is responding very slowly.
20
+
21
+ AppSignal aims to provide a one stop solution to all your monitoring needs.
22
+ Track metrics from your servers with our [Host metrics][host-metrics] and graph
23
+ everything else with our [Custom metrics][custom-metrics] feature.
24
+
25
+ ## Usage
26
+
27
+ First make sure you've installed AppSignal in your application by following the
28
+ steps in [Installation](#installation).
29
+
30
+ AppSignal will automatically monitor requests, report any exceptions that are
31
+ thrown and any performance issues that might have occurred.
32
+
33
+ You can also add extra information to requests by adding custom instrumentation
34
+ and by adding tags.
35
+
36
+ ### Track any error
37
+
38
+ Catch any error and report it to AppSignal, even if it doesn't crash a
39
+ request.
40
+
41
+ ```ruby
42
+ begin
43
+ config = File.read("config.yml")
44
+ rescue => e
45
+ Appsignal.set_error(e)
46
+ # Load alternative config
47
+ config = { :name => ENV["NAME"] }
48
+ end
49
+ ```
50
+
51
+ Read more about [Exception handling][exception-handling] in our documentation.
52
+
53
+ ### Tagging
54
+
55
+ Need more information with errors and performance issues? Add tags to your
56
+ requests to identify common factors for problems.
57
+
58
+ ```ruby
59
+ Appsignal.tag_request(
60
+ user: current_user.id,
61
+ locale: I18n.locale
62
+ )
63
+ ```
64
+
65
+ Read more about [Tagging][tagging] in our documentation.
66
+
67
+ ### Custom instrumentation
68
+
69
+ If you need more fine-grained instrumentation you can add custom
70
+ instrumentation anywhere in your code.
71
+
72
+ ```ruby
73
+ # Simple instrumentation
74
+ Appsignal.instrument("array_to_hash.expensive_logic", "Complex calculations") do
75
+ array = [["a", 1], ["b", 2], ["c", 3]]
76
+ Hash[array]
77
+ end
78
+
79
+ # Add the query that you're monitoring
80
+ sql = "SELECT * FROM posts ORDER BY created_at DESC LIMIT 1"
81
+ Appsignal.instrument("fetch.custom_database", "Fetch latest post", sql) do
82
+ # ...
83
+ end
84
+
85
+ # Nested instrumentation calls are also supported!
86
+ Appsignal.instrument("fetch.custom_database", "Fetch current user") do
87
+ # ...
88
+
89
+ Appsignal.instrument("write.custom_database", "Write user update") do
90
+ # ...
91
+ end
92
+ end
93
+ ```
94
+
95
+ Read more about [custom instrumentation][custom-instrumentation] in our
96
+ documentation.
97
+
98
+ ## Installation
99
+
100
+ First, [sign up][appsignal-sign-up] for an AppSignal account and add the
101
+ `appsignal` gem to your `Gemfile`. Then, run `bundle install`.
102
+
103
+ ```ruby
104
+ # Gemfile
105
+ gem "appsignal"
106
+ ```
107
+
108
+ Afterward, you can use the `appsignal install` command to install AppSignal
109
+ into your application by using the "Push API key". This will guide you through
110
+ our installation wizard.
111
+
112
+ ```sh
113
+ appsignal install [push api key]
114
+ ```
115
+
116
+ Depending on what framework or gems you use some manual integration is
117
+ required. Follow the steps in the wizard or consult our [integrations] page for
118
+ help.
119
+
120
+ If you're stuck feel free to [contact us][contact]!
121
+
122
+ ## Supported frameworks and gems
123
+
124
+ AppSignal automatically supports a collection of Ruby frameworks and gems,
125
+ including but not limited to:
126
+
127
+ - Ruby on Rails
128
+ - Rack
129
+ - Sinatra
130
+ - Padrino
131
+ - Grape
132
+ - Webmachine
133
+ - Capistrano
134
+ - Sidekiq
135
+ - Delayed Job
136
+ - Resque
137
+ - Rake
138
+
139
+ AppSignal instrumentation doesn't depend on automatic integrations. It's easy
140
+ to set up [custom instrumentation][custom-instrumentation] to add keep track of
141
+ anything.
142
+
143
+ For more detailed information and examples please visit our
144
+ [integrations] page.
145
+
146
+ ### Front-end monitoring (Beta)
147
+
148
+ We have a [Front-end monitoring program][front-end-monitoring] running in Beta
149
+ currently. Be sure to check it out!
150
+
151
+ ## Supported systems
152
+
153
+ Currently the AppSignal agent works on most Unix-like operating systems, such
154
+ as most Linux distributions, FreeBSD, macOS, excluding Microsoft Windows.
155
+
156
+ For more detailed information please visit our [Supported
157
+ systems][supported-systems] page.
158
+
159
+ ## Development
160
+
161
+ ### Installation
162
+
163
+ Make sure you have Bundler installed and then use the Rake install task to
164
+ install all possible dependencies.
165
+
166
+ ```bash
167
+ # Install Bundler
168
+ gem install bundler
169
+ # Install the AppSignal extension and _all_ gems we support.
170
+ bundle exec rake install
171
+ # Only install the AppSignal extension.
172
+ bundle exec rake extension:install
173
+ ```
174
+
175
+ ### Testing
176
+
177
+ ```bash
178
+ bundle exec rspec
179
+ # Or with one file
180
+ bundle exec rspec spec/lib/appsignal_spec.rb
181
+ ```
182
+
183
+ Note that some specs depend on certain other gems to run and if they are not
184
+ loaded RSpec will not run them. See also [Testing with other
185
+ gems](#testing-with-other-gems).
186
+
187
+ #### Testing with other gems
188
+
189
+ AppSignal runs in many different configurations. To replicate these
190
+ configurations you need to run the spec suite with a specific Gemfile.
191
+
192
+ ```
193
+ BUNDLE_GEMFILE=gemfiles/capistrano2.gemfile bundle exec rspec
194
+ BUNDLE_GEMFILE=gemfiles/capistrano3.gemfile bundle exec rspec
195
+ BUNDLE_GEMFILE=gemfiles/grape.gemfile bundle exec rspec
196
+ BUNDLE_GEMFILE=gemfiles/no_dependencies.gemfile bundle exec rspec
197
+ BUNDLE_GEMFILE=gemfiles/padrino.gemfile bundle exec rspec
198
+ BUNDLE_GEMFILE=gemfiles/rails-3.2.gemfile bundle exec rspec
199
+ BUNDLE_GEMFILE=gemfiles/rails-4.0.gemfile bundle exec rspec
200
+ BUNDLE_GEMFILE=gemfiles/rails-4.1.gemfile bundle exec rspec
201
+ BUNDLE_GEMFILE=gemfiles/rails-4.2.gemfile bundle exec rspec
202
+ BUNDLE_GEMFILE=gemfiles/rails-5.0.gemfile bundle exec rspec
203
+ BUNDLE_GEMFILE=gemfiles/resque.gemfile bundle exec rspec
204
+ BUNDLE_GEMFILE=gemfiles/sequel-435.gemfile bundle exec rspec
205
+ BUNDLE_GEMFILE=gemfiles/sequel.gemfile bundle exec rspec
206
+ BUNDLE_GEMFILE=gemfiles/sinatra.gemfile bundle exec rspec
207
+ BUNDLE_GEMFILE=gemfiles/webmachine.gemfile bundle exec rspec
208
+ ```
209
+
210
+ If you have either [RVM][rvm] or [rbenv][rbenv] installed you can also use
211
+ `rake generate_bundle_and_spec_all` to generate a script that runs specs for
212
+ all Ruby versions and gem combinations we support.
213
+
214
+ We run the suite against all of the Gemfiles mentioned above and on
215
+ a number of different Ruby versions.
216
+
217
+ ### Versioning
218
+
219
+ This gem uses [Semantic Versioning][semver].
220
+
221
+ The `master` branch corresponds to the current stable release of the gem.
222
+
223
+ The `develop` branch is used for development of features that will end up in
224
+ the next minor release.
225
+
226
+ Open a Pull Request on the `master` branch if you're fixing a bug. For new new
227
+ features, open a Pull Request on the `develop` branch.
228
+
229
+ Every stable and unstable release is tagged in git with a version tag.
230
+
231
+ ## Contributing
232
+
233
+ Thinking of contributing to our gem? Awesome! 🚀
234
+
235
+ Please follow our [Contributing guide][contributing-guide] in our
236
+ documentation.
237
+
238
+ Also, we would be very happy to send you Stroopwafles. Have look at everyone
239
+ we send a package to so far on our [Stroopwafles page][waffles-page].
240
+
241
+ ## Support
242
+
243
+ [Contact us][contact] and speak directly with the engineers working on
244
+ AppSignal. They will help you get set up, tweak your code and make sure you get
245
+ the most out of using AppSignal.
246
+
247
+ [appsignal]: https://appsignal.com
248
+ [appsignal-sign-up]: https://appsignal.com/users/sign_up
249
+ [contact]: mailto:support@appsignal.com
250
+ [waffles-page]: https://appsignal.com/waffles
251
+ [docs]: http://docs.appsignal.com
252
+ [contributing-guide]: http://docs.appsignal.com/appsignal/contributing.html
253
+ [supported-systems]: http://docs.appsignal.com/support/operating-systems.html
254
+ [integrations]: http://docs.appsignal.com/ruby/integrations/index.html
255
+ [custom-instrumentation]: http://docs.appsignal.com/ruby/instrumentation/
256
+ [front-end-monitoring]: http://docs.appsignal.com/front-end/error-handling.html
257
+ [exception-handling]: http://docs.appsignal.com/ruby/instrumentation/exception-handling.html
258
+ [tagging]: http://docs.appsignal.com/ruby/instrumentation/tagging.html
259
+ [host-metrics]: http://docs.appsignal.com/metrics/host.html
260
+ [custom-metrics]: http://docs.appsignal.com/metrics/custom.html
261
+
262
+ [semver]: http://semver.org/
263
+ [rvm]: http://rvm.io/
264
+ [rbenv]: https://github.com/rbenv/rbenv
@@ -0,0 +1,214 @@
1
+ require "bundler"
2
+ require "fileutils"
3
+
4
+ GEMFILES = %w[
5
+ capistrano2
6
+ capistrano3
7
+ grape
8
+ no_dependencies
9
+ padrino
10
+ rails-3.2
11
+ rails-4.0
12
+ rails-4.1
13
+ rails-4.2
14
+ rails-5.0
15
+ resque
16
+ sequel
17
+ sequel-435
18
+ sinatra
19
+ grape
20
+ webmachine
21
+ que
22
+ ].freeze
23
+
24
+ RUBY_VERSIONS = %w[
25
+ 2.0.0-p648
26
+ 2.1.8
27
+ 2.2.4
28
+ 2.3.0
29
+ 2.4.0
30
+ ].freeze
31
+
32
+ EXCLUSIONS = {
33
+ "rails-5.0" => %w[2.0.0 2.1.8]
34
+ }.freeze
35
+
36
+ VERSION_MANAGERS = {
37
+ :rbenv => ->(version) { "rbenv local #{version}" },
38
+ :rvm => ->(version) { "rvm use --default #{version.split("-").first}" }
39
+ }.freeze
40
+
41
+ task :publish do
42
+ require "appsignal/version"
43
+
44
+ NAME = "appsignal".freeze
45
+ VERSION_FILE = "lib/appsignal/version.rb".freeze
46
+ CHANGELOG_FILE = "CHANGELOG.md".freeze
47
+
48
+ raise "$EDITOR should be set" unless ENV["EDITOR"]
49
+
50
+ def build_and_push_gem
51
+ puts "# Building gem"
52
+ FileUtils.rm_f("#{NAME}-#{gem_version}.gem")
53
+ puts `gem build #{NAME}.gemspec`
54
+ puts "# Publishing Gem"
55
+ puts `gem push #{NAME}-#{gem_version}.gem`
56
+ end
57
+
58
+ def create_and_push_tag
59
+ puts `git commit -am 'Bump to #{version} [ci skip]'`
60
+ puts "# Creating tag #{version}"
61
+ puts `git tag #{version}`
62
+ puts `git push origin #{version}`
63
+ puts `git push origin #{current_branch}`
64
+ rescue
65
+ raise "Tag: '#{version}' already exists"
66
+ end
67
+
68
+ def changes
69
+ git_status_to_array(`git status -s -u`)
70
+ end
71
+
72
+ def gem_version
73
+ Appsignal::VERSION
74
+ end
75
+
76
+ def version
77
+ @version ||= "v#{gem_version}"
78
+ end
79
+
80
+ def current_branch
81
+ `git rev-parse --abbrev-ref HEAD`.chomp
82
+ end
83
+
84
+ def git_status_to_array(changes)
85
+ changes.split("\n").each { |change| change.gsub!(/^.. /, "") }
86
+ end
87
+
88
+ raise "Branch should hold no uncommitted file change)" unless changes.empty?
89
+
90
+ system("$EDITOR #{VERSION_FILE}")
91
+ unless changes.member?(VERSION_FILE)
92
+ raise "Actually change the version in: #{VERSION_FILE}"
93
+ end
94
+
95
+ Appsignal.send(:remove_const, :VERSION)
96
+ load File.expand_path(VERSION_FILE)
97
+ system("$EDITOR #{CHANGELOG_FILE}")
98
+
99
+ # Build and push for MRI
100
+ ENV.delete("APPSIGNAL_PUSH_JAVA_GEM")
101
+ build_and_push_gem
102
+
103
+ # Build and push for jRuby
104
+ ENV["APPSIGNAL_PUSH_JAVA_GEM"] = "true"
105
+ build_and_push_gem
106
+
107
+ # Create tag
108
+ create_and_push_tag
109
+ end
110
+
111
+ desc "Install the AppSignal gem, extension and all possible dependencies."
112
+ task :install => "extension:install" do
113
+ Bundler.with_clean_env do
114
+ GEMFILES.each do |gemfile|
115
+ system "bundle --gemfile gemfiles/#{gemfile}.gemfile"
116
+ end
117
+ end
118
+ end
119
+
120
+ task :spec_all_gemfiles do
121
+ GEMFILES.each do |gemfile|
122
+ puts "Running tests for #{gemfile}"
123
+ unless system("env BUNDLE_GEMFILE=gemfiles/#{gemfile}.gemfile bundle exec rspec")
124
+ raise "Not successful"
125
+ end
126
+ end
127
+ end
128
+
129
+ task :generate_bundle_and_spec_all do
130
+ VERSION_MANAGERS.each do |version_manager, switch_command|
131
+ out = []
132
+ out << if version_manager == :rvm
133
+ "#!/bin/bash --login"
134
+ else
135
+ "#!/bin/sh"
136
+ end
137
+ out << "rm -f .ruby-version"
138
+ out << "echo 'Using #{version_manager}'"
139
+ RUBY_VERSIONS.each do |version|
140
+ short_version = version.split("-").first
141
+ out << "echo 'Switching to #{short_version}'"
142
+ out << "#{switch_command.call(version)} || { echo 'Switching Ruby failed'; exit 1; }"
143
+ out << "ruby -v"
144
+ out << "echo 'Compiling extension'"
145
+ out << "cd ext && rm -f appsignal-agent appsignal_extension.bundle appsignal.h libappsignal.a Makefile && ruby extconf.rb && make && cd .."
146
+ GEMFILES.each do |gemfile|
147
+ next if EXCLUSIONS[gemfile] && EXCLUSIONS[gemfile].include?(short_version)
148
+ out << "echo 'Bundling #{gemfile} in #{short_version}'"
149
+ out << "bundle --quiet --gemfile gemfiles/#{gemfile}.gemfile || { echo 'Bundling failed'; exit 1; }"
150
+ out << "echo 'Running #{gemfile} in #{short_version}'"
151
+ out << "env BUNDLE_GEMFILE=gemfiles/#{gemfile}.gemfile bundle exec rspec || { echo 'Running specs failed'; exit 1; }"
152
+ end
153
+ end
154
+ out << "rm -f .ruby-version"
155
+ out << "echo 'Successfully ran specs for all environments'"
156
+
157
+ script = "bundle_and_spec_all_#{version_manager}"
158
+ FileUtils.rm_f(script)
159
+ File.open(script, "w") do |file|
160
+ file.write out.join("\n")
161
+ end
162
+ File.chmod(0o775, script)
163
+ puts "Generated #{script}"
164
+ end
165
+ end
166
+
167
+ task :console do
168
+ require "irb"
169
+ require "irb/completion"
170
+ require "appsignal"
171
+
172
+ Appsignal.config = Appsignal::Config.new(".", :console)
173
+
174
+ ARGV.clear
175
+ IRB.start
176
+ end
177
+
178
+ namespace :extension do
179
+ desc "Install the AppSignal gem extension"
180
+ task :install => :clean do
181
+ if RUBY_PLATFORM == "java"
182
+ system "cd ext && rake"
183
+ else
184
+ system "cd ext && ruby extconf.rb && make clean && make"
185
+ end
186
+ end
187
+
188
+ desc "Clean the AppSignal gem extension directory of installation artifacts"
189
+ task :clean do
190
+ system <<-COMMAND
191
+ cd ext &&
192
+ rm -f appsignal.bundle \
193
+ appsignal-agent \
194
+ appsignal.h \
195
+ appsignal_extension.o \
196
+ appsignal_extension.bundle \
197
+ install.log \
198
+ libappsignal.a \
199
+ appsignal.version \
200
+ Makefile \
201
+ mkmf.log
202
+ COMMAND
203
+ end
204
+ end
205
+
206
+ begin
207
+ require "rspec/core/rake_task"
208
+ desc "Run the AppSignal gem test suite."
209
+ RSpec::Core::RakeTask.new :test
210
+ rescue LoadError # rubocop:disable Lint/HandleExceptions
211
+ # When running rake install, there is no RSpec yet.
212
+ end
213
+
214
+ task :default => [:generate_bundle_and_spec_all, :spec_all_gemfiles]