opbeat 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -3
- data/.travis.yml +19 -28
- data/.yardopts +3 -0
- data/Gemfile +4 -2
- data/HISTORY.md +3 -0
- data/LICENSE +7 -196
- data/README.md +96 -177
- data/Rakefile +19 -13
- data/gemfiles/Gemfile.base +28 -0
- data/gemfiles/Gemfile.rails-3.2.x +3 -0
- data/gemfiles/Gemfile.rails-4.0.x +3 -0
- data/gemfiles/Gemfile.rails-4.1.x +3 -0
- data/gemfiles/Gemfile.rails-4.2.x +3 -0
- data/lib/opbeat.rb +113 -93
- data/lib/opbeat/capistrano.rb +3 -4
- data/lib/opbeat/client.rb +243 -82
- data/lib/opbeat/configuration.rb +51 -64
- data/lib/opbeat/data_builders.rb +16 -0
- data/lib/opbeat/data_builders/error.rb +27 -0
- data/lib/opbeat/data_builders/transactions.rb +85 -0
- data/lib/opbeat/error.rb +1 -2
- data/lib/opbeat/error_message.rb +71 -0
- data/lib/opbeat/error_message/exception.rb +12 -0
- data/lib/opbeat/error_message/http.rb +62 -0
- data/lib/opbeat/error_message/stacktrace.rb +75 -0
- data/lib/opbeat/error_message/user.rb +23 -0
- data/lib/opbeat/filter.rb +53 -43
- data/lib/opbeat/http_client.rb +141 -0
- data/lib/opbeat/injections.rb +83 -0
- data/lib/opbeat/injections/json.rb +19 -0
- data/lib/opbeat/injections/net_http.rb +43 -0
- data/lib/opbeat/injections/redis.rb +23 -0
- data/lib/opbeat/injections/sequel.rb +32 -0
- data/lib/opbeat/injections/sinatra.rb +56 -0
- data/lib/opbeat/{capistrano → integration}/capistrano2.rb +6 -6
- data/lib/opbeat/{capistrano → integration}/capistrano3.rb +3 -3
- data/lib/opbeat/{integrations → integration}/delayed_job.rb +6 -11
- data/lib/opbeat/integration/rails/inject_exceptions_catcher.rb +23 -0
- data/lib/opbeat/integration/railtie.rb +53 -0
- data/lib/opbeat/integration/resque.rb +16 -0
- data/lib/opbeat/integration/sidekiq.rb +38 -0
- data/lib/opbeat/line_cache.rb +21 -0
- data/lib/opbeat/logging.rb +37 -0
- data/lib/opbeat/middleware.rb +59 -0
- data/lib/opbeat/normalizers.rb +65 -0
- data/lib/opbeat/normalizers/action_controller.rb +21 -0
- data/lib/opbeat/normalizers/action_view.rb +71 -0
- data/lib/opbeat/normalizers/active_record.rb +41 -0
- data/lib/opbeat/sql_summarizer.rb +27 -0
- data/lib/opbeat/subscriber.rb +80 -0
- data/lib/opbeat/tasks.rb +20 -18
- data/lib/opbeat/trace.rb +47 -0
- data/lib/opbeat/trace_helpers.rb +29 -0
- data/lib/opbeat/transaction.rb +99 -0
- data/lib/opbeat/util.rb +26 -0
- data/lib/opbeat/util/constantize.rb +54 -0
- data/lib/opbeat/util/inspector.rb +75 -0
- data/lib/opbeat/version.rb +1 -1
- data/lib/opbeat/worker.rb +55 -0
- data/opbeat.gemspec +6 -14
- data/spec/opbeat/client_spec.rb +216 -29
- data/spec/opbeat/configuration_spec.rb +34 -38
- data/spec/opbeat/data_builders/error_spec.rb +43 -0
- data/spec/opbeat/data_builders/transactions_spec.rb +51 -0
- data/spec/opbeat/error_message/exception_spec.rb +22 -0
- data/spec/opbeat/error_message/http_spec.rb +65 -0
- data/spec/opbeat/error_message/stacktrace_spec.rb +56 -0
- data/spec/opbeat/error_message/user_spec.rb +28 -0
- data/spec/opbeat/error_message_spec.rb +78 -0
- data/spec/opbeat/filter_spec.rb +21 -99
- data/spec/opbeat/http_client_spec.rb +64 -0
- data/spec/opbeat/injections/net_http_spec.rb +37 -0
- data/spec/opbeat/injections/sequel_spec.rb +33 -0
- data/spec/opbeat/injections/sinatra_spec.rb +13 -0
- data/spec/opbeat/injections_spec.rb +49 -0
- data/spec/opbeat/integration/delayed_job_spec.rb +35 -0
- data/spec/opbeat/integration/json_spec.rb +41 -0
- data/spec/opbeat/integration/rails_spec.rb +88 -0
- data/spec/opbeat/integration/redis_spec.rb +20 -0
- data/spec/opbeat/integration/resque_spec.rb +42 -0
- data/spec/opbeat/integration/sidekiq_spec.rb +40 -0
- data/spec/opbeat/integration/sinatra_spec.rb +66 -0
- data/spec/opbeat/line_cache_spec.rb +38 -0
- data/spec/opbeat/logging_spec.rb +47 -0
- data/spec/opbeat/middleware_spec.rb +32 -0
- data/spec/opbeat/normalizers/action_controller_spec.rb +32 -0
- data/spec/opbeat/normalizers/action_view_spec.rb +77 -0
- data/spec/opbeat/normalizers/active_record_spec.rb +70 -0
- data/spec/opbeat/normalizers_spec.rb +16 -0
- data/spec/opbeat/sql_summarizer_spec.rb +6 -0
- data/spec/opbeat/subscriber_spec.rb +83 -0
- data/spec/opbeat/trace_spec.rb +43 -0
- data/spec/opbeat/transaction_spec.rb +98 -0
- data/spec/opbeat/util/inspector_spec.rb +40 -0
- data/spec/opbeat/util_spec.rb +20 -0
- data/spec/opbeat/worker_spec.rb +54 -0
- data/spec/opbeat_spec.rb +49 -0
- data/spec/spec_helper.rb +79 -6
- metadata +89 -149
- data/Makefile +0 -3
- data/gemfiles/rails30.gemfile +0 -9
- data/gemfiles/rails31.gemfile +0 -9
- data/gemfiles/rails32.gemfile +0 -9
- data/gemfiles/rails40.gemfile +0 -9
- data/gemfiles/rails41.gemfile +0 -9
- data/gemfiles/rails42.gemfile +0 -9
- data/gemfiles/ruby192_rails31.gemfile +0 -10
- data/gemfiles/ruby192_rails32.gemfile +0 -10
- data/gemfiles/sidekiq31.gemfile +0 -11
- data/lib/opbeat/better_attr_accessor.rb +0 -44
- data/lib/opbeat/event.rb +0 -223
- data/lib/opbeat/integrations/resque.rb +0 -22
- data/lib/opbeat/integrations/sidekiq.rb +0 -32
- data/lib/opbeat/interfaces.rb +0 -35
- data/lib/opbeat/interfaces/exception.rb +0 -16
- data/lib/opbeat/interfaces/http.rb +0 -57
- data/lib/opbeat/interfaces/message.rb +0 -19
- data/lib/opbeat/interfaces/stack_trace.rb +0 -50
- data/lib/opbeat/linecache.rb +0 -25
- data/lib/opbeat/logger.rb +0 -21
- data/lib/opbeat/rack.rb +0 -46
- data/lib/opbeat/rails/middleware/debug_exceptions_catcher.rb +0 -22
- data/lib/opbeat/railtie.rb +0 -26
- data/spec/opbeat/better_attr_accessor_spec.rb +0 -99
- data/spec/opbeat/event_spec.rb +0 -138
- data/spec/opbeat/integrations/delayed_job_spec.rb +0 -38
- data/spec/opbeat/logger_spec.rb +0 -55
- data/spec/opbeat/opbeat_spec.rb +0 -64
- data/spec/opbeat/rack_spec.rb +0 -117
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab9a138807b83eccad509ecbb47bd14c4fd4d0d9
|
4
|
+
data.tar.gz: 63eb2b18b8391863405f1d2d1b1e6def179ca6af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 641e5c53512558c13573579d30d92b1032116e2773a80a19c5fc8b8b381c38f4d402f8072878d3b6bce764b8577569da91eea90b75112a4559ce5b7ced08e659
|
7
|
+
data.tar.gz: eff01294ef09048a0e1938b8e307f6d7570f3ded99b6cb4a2f270bec1b18db48da988f67a0058d8d5b7fa3d0eeda1263bd91b985981b8f904cd1bf38ddc7d7a7
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,36 +1,27 @@
|
|
1
|
+
---
|
1
2
|
language: ruby
|
3
|
+
cache: bundler
|
2
4
|
rvm:
|
3
|
-
- 1.9.
|
4
|
-
-
|
5
|
-
- 2.
|
6
|
-
- 2.
|
7
|
-
- 2.2
|
8
|
-
- jruby
|
9
|
-
- rbx-2
|
5
|
+
- 1.9.3
|
6
|
+
- 2.0.0
|
7
|
+
- 2.1.6
|
8
|
+
- 2.2.3
|
10
9
|
gemfile:
|
11
|
-
- gemfiles/
|
12
|
-
- gemfiles/
|
13
|
-
- gemfiles/
|
14
|
-
- gemfiles/
|
15
|
-
- gemfiles/rails41.gemfile
|
16
|
-
- gemfiles/rails42.gemfile
|
10
|
+
- gemfiles/Gemfile.rails-3.2.x
|
11
|
+
- gemfiles/Gemfile.rails-4.0.x
|
12
|
+
- gemfiles/Gemfile.rails-4.1.x
|
13
|
+
- gemfiles/Gemfile.rails-4.2.x
|
17
14
|
matrix:
|
18
|
-
include:
|
19
|
-
- rvm: 1.9.2
|
20
|
-
gemfile: gemfiles/ruby192_rails31.gemfile
|
21
|
-
- rvm: 1.9.2
|
22
|
-
gemfile: gemfiles/ruby192_rails32.gemfile
|
23
15
|
exclude:
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
- rvm: 1.9.2
|
33
|
-
gemfile: gemfiles/rails42.gemfile
|
16
|
+
# Rails 4.0+ requires ruby 2.0+
|
17
|
+
- rvm: 1.9.3
|
18
|
+
Gemfile: gemfiles/Gemfile.rails-4.0.x
|
19
|
+
- rvm: 1.9.3
|
20
|
+
Gemfile: gemfiles/Gemfile.rails-4.1.x
|
21
|
+
- rvm: 1.9.3
|
22
|
+
Gemfile: gemfiles/Gemfile.rails-4.2.x
|
23
|
+
|
34
24
|
notifications:
|
25
|
+
email: false
|
35
26
|
slack:
|
36
27
|
secure: IniiL3PdFsht2zykTwd/z5Et/L1U6GzsmMC1LrgccKCrvLsdcdlBU3VrAgIb1GT9FPEFpb5sl7FEBN80p6uW15uO57onUawFaSWDhSA3eXG1ImmunVPJ20U4NkJvMbnUdZXQ9XXqOw1ggkR7GrD0PM9Nzr4puWaaGq42UJjdaq0=
|
data/.yardopts
ADDED
data/Gemfile
CHANGED
data/HISTORY.md
ADDED
data/LICENSE
CHANGED
@@ -1,201 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
http://www.apache.org/licenses/
|
1
|
+
Copyright (c) 2016, Opbeat, Inc
|
2
|
+
All rights reserved.
|
4
3
|
|
5
|
-
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
6
5
|
|
7
|
-
1.
|
6
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
8
7
|
|
9
|
-
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
11
9
|
|
12
|
-
|
13
|
-
the copyright owner that is granting the License.
|
10
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
14
11
|
|
15
|
-
|
16
|
-
other entities that control, are controlled by, or are under common
|
17
|
-
control with that entity. For the purposes of this definition,
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
19
|
-
direction or management of such entity, whether by contract or
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
-
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
-
exercising permissions granted by this License.
|
25
|
-
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
27
|
-
including but not limited to software source code, documentation
|
28
|
-
source, and configuration files.
|
29
|
-
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
31
|
-
transformation or translation of a Source form, including but
|
32
|
-
not limited to compiled object code, generated documentation,
|
33
|
-
and conversions to other media types.
|
34
|
-
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
36
|
-
Object form, made available under the License, as indicated by a
|
37
|
-
copyright notice that is included in or attached to the work
|
38
|
-
(an example is provided in the Appendix below).
|
39
|
-
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
-
the Work and Derivative Works thereof.
|
47
|
-
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
49
|
-
the original version of the Work and any modifications or additions
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
-
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
64
|
-
subsequently incorporated within the Work.
|
65
|
-
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
72
|
-
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
-
where such license applies only to those patent claims licensable
|
79
|
-
by such Contributor that are necessarily infringed by their
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
82
|
-
institute patent litigation against any entity (including a
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
85
|
-
or contributory patent infringement, then any patent licenses
|
86
|
-
granted to You under this License for that Work shall terminate
|
87
|
-
as of the date such litigation is filed.
|
88
|
-
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
91
|
-
modifications, and in Source or Object form, provided that You
|
92
|
-
meet the following conditions:
|
93
|
-
|
94
|
-
(a) You must give any other recipients of the Work or
|
95
|
-
Derivative Works a copy of this License; and
|
96
|
-
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
98
|
-
stating that You changed the files; and
|
99
|
-
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
102
|
-
attribution notices from the Source form of the Work,
|
103
|
-
excluding those notices that do not pertain to any part of
|
104
|
-
the Derivative Works; and
|
105
|
-
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
108
|
-
include a readable copy of the attribution notices contained
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
111
|
-
of the following places: within a NOTICE text file distributed
|
112
|
-
as part of the Derivative Works; within the Source form or
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
114
|
-
within a display generated by the Derivative Works, if and
|
115
|
-
wherever such third-party notices normally appear. The contents
|
116
|
-
of the NOTICE file are for informational purposes only and
|
117
|
-
do not modify the License. You may add Your own attribution
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
120
|
-
that such additional attribution notices cannot be construed
|
121
|
-
as modifying the License.
|
122
|
-
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
124
|
-
may provide additional or different license terms and conditions
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
128
|
-
the conditions stated in this License.
|
129
|
-
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
133
|
-
this License, without any additional terms or conditions.
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
-
the terms of any separate license agreement you may have executed
|
136
|
-
with Licensor regarding such Contributions.
|
137
|
-
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
140
|
-
except as required for reasonable and customary use in describing the
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
-
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
152
|
-
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
158
|
-
incidental, or consequential damages of any character arising as a
|
159
|
-
result of this License or out of the use or inability to use the
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
162
|
-
other commercial damages or losses), even if such Contributor
|
163
|
-
has been advised of the possibility of such damages.
|
164
|
-
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
-
or other liability obligations and/or rights consistent with this
|
169
|
-
License. However, in accepting such obligations, You may act only
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
174
|
-
of your accepting any such warranty or additional liability.
|
175
|
-
|
176
|
-
END OF TERMS AND CONDITIONS
|
177
|
-
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
179
|
-
|
180
|
-
To apply the Apache License to your work, attach the following
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
-
replaced with your own identifying information. (Don't include
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
184
|
-
comment syntax for the file format. We also recommend that a
|
185
|
-
file or class name and description of purpose be included on the
|
186
|
-
same "printed page" as the copyright notice for easier
|
187
|
-
identification within third-party archives.
|
188
|
-
|
189
|
-
Copyright [yyyy] [name of copyright owner]
|
190
|
-
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
-
you may not use this file except in compliance with the License.
|
193
|
-
You may obtain a copy of the License at
|
194
|
-
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
-
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
-
See the License for the specific language governing permissions and
|
201
|
-
limitations under the License.
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
CHANGED
@@ -1,267 +1,186 @@
|
|
1
|
-
|
1
|
+
<h1>
|
2
|
+
<img src='http://opbeat-brand-assets.s3-website-us-east-1.amazonaws.com/svg/logo/logo.svg' width=400 alt='Opbeat' />
|
3
|
+
</h1>
|
2
4
|
|
3
|
-
[![Build
|
4
|
-
|
5
|
-
A client and integration layer for [Opbeat](https://opbeat.com). Forked from the [raven-ruby](https://github.com/getsentry/raven-ruby) project.
|
5
|
+
[![Build status](https://travis-ci.org/opbeat/opbeat-ruby.svg)](https://travis-ci.org/opbeat/opbeat-ruby)
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
9
|
Add the following to your `Gemfile`:
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem
|
12
|
+
gem 'opbeat', git: 'https://github.com/opbeat/opbeat-ruby'
|
13
13
|
```
|
14
14
|
|
15
15
|
The Opbeat gem adhere to [Semantic
|
16
16
|
Versioning](http://guides.rubygems.org/patterns/#semantic-versioning)
|
17
|
-
and so you can safely trust all minor and patch versions (e.g.
|
17
|
+
and so you can safely trust all minor and patch versions (e.g. 3.x.x) to
|
18
18
|
be backwards compatible.
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
|
22
22
|
### Rails 3 and Rails 4
|
23
23
|
|
24
|
-
Add
|
24
|
+
Add the following to your `config/environments/production.rb`:
|
25
25
|
|
26
26
|
```ruby
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
config.
|
31
|
-
config.
|
32
|
-
config.secret_token = 'f0f5237a221637f561a15614f5fef218f8d6317d'
|
27
|
+
Rails.application.configure do |config|
|
28
|
+
# ...
|
29
|
+
config.opbeat.organization_id = 'XXX'
|
30
|
+
config.opbeat.app_id = 'XXX'
|
31
|
+
config.opbeat.secret_token = 'XXX'
|
33
32
|
end
|
34
33
|
```
|
35
34
|
|
36
|
-
### Rails 2
|
37
|
-
|
38
|
-
No support for Rails 2 yet.
|
39
|
-
|
40
35
|
### Rack
|
41
36
|
|
42
|
-
Basic RackUp file.
|
43
|
-
|
44
37
|
```ruby
|
45
38
|
require 'opbeat'
|
46
39
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
config.secret_token = 'f0f5237a221637f561a15614f5fef218f8d6317d'
|
40
|
+
# set up an Opbeat configuration
|
41
|
+
config = Opbeat::Configuration.new do |conf|
|
42
|
+
conf.organization_id = 'XXX'
|
43
|
+
conf.app_id = 'XXX'
|
44
|
+
conf.secret_token = 'XXX'
|
53
45
|
end
|
54
46
|
|
55
|
-
|
47
|
+
# start the Opbeat client
|
48
|
+
Opbeat.start! config
|
56
49
|
|
57
|
-
|
50
|
+
# install the Opbeat middleware
|
51
|
+
use Opbeat::Middleware
|
58
52
|
|
59
|
-
```ruby
|
60
|
-
require 'sinatra'
|
61
|
-
require 'opbeat'
|
62
|
-
|
63
|
-
use Opbeat::Rack
|
64
|
-
|
65
|
-
Opbeat.configure do |config|
|
66
|
-
config.organization_id = '094e250818f44e82bfae13919f55fb35'
|
67
|
-
config.app_id = '094e250818'
|
68
|
-
config.secret_token = 'f0f5237a221637f561a15614f5fef218f8d6317d'
|
69
|
-
end
|
70
|
-
|
71
|
-
get '/' do
|
72
|
-
1 / 0
|
73
|
-
end
|
74
53
|
```
|
75
54
|
|
76
|
-
|
77
|
-
|
78
|
-
```ruby
|
79
|
-
require 'opbeat'
|
55
|
+
## Configuration
|
80
56
|
|
81
|
-
Opbeat.
|
82
|
-
config.organization_id = '094e250818f44e82bfae13919f55fb35'
|
83
|
-
config.app_id = '094e250818'
|
84
|
-
config.secret_token = 'f0f5237a221637f561a15614f5fef218f8d6317d'
|
57
|
+
Opbeat works with just the authentication configuration but of course there are other knobs to turn. For a complete list, see [configuration.rb](https://github.com/opbeat/opbeat-ruby/blob/master/lib/opbeat/configuration.rb).
|
85
58
|
|
86
|
-
|
87
|
-
config.current_environment = 'production'
|
88
|
-
end
|
59
|
+
#### Enable in development and other environments
|
89
60
|
|
90
|
-
Opbeat.
|
61
|
+
As a default Opbeat only runs in production. You can make it run in other environments by adding them to the `enabled_environments` whitelist.
|
91
62
|
|
92
|
-
|
93
|
-
|
94
|
-
end
|
63
|
+
```ruby
|
64
|
+
config.opbeat.enabled_environments += %w{development}
|
95
65
|
```
|
96
66
|
|
97
|
-
|
98
|
-
|
99
|
-
With [delayed_job](https://github.com/collectiveidea/delayed_job) and [sidekiq](http://sidekiq.org/), Opbeat will automatically pick up exceptions that are raised in background jobs.
|
100
|
-
|
101
|
-
To enable Opbeat for [resque](https://github.com/resque/resque), add the following (for example in `config/initializers/opbeat.rb`):
|
67
|
+
#### Ignore specific exceptions
|
102
68
|
|
103
69
|
```ruby
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
Resque::Failure.backend = Resque::Failure::Multiple
|
70
|
+
config.opbeat.excluded_exceptions += %w{
|
71
|
+
ActiveRecord::RecordNotFound
|
72
|
+
ActionController::RoutingError
|
73
|
+
}
|
109
74
|
```
|
110
75
|
|
111
|
-
|
76
|
+
### Sanitizing data
|
112
77
|
|
113
|
-
|
114
|
-
```
|
115
|
-
Opbeat.capture_message("Not happy with the way things turned out")
|
116
|
-
```
|
78
|
+
Opbeat can strip certain data points from the reports it sends like passwords or other sensitive information. If you're on Rails the list will automatically include what you have in `config.filter_parameters`.
|
117
79
|
|
118
|
-
|
119
|
-
```
|
120
|
-
begin
|
121
|
-
faultyCall
|
122
|
-
rescue Exception => e
|
123
|
-
Opbeat.capture_exception(e)
|
124
|
-
```
|
80
|
+
Add or modify the list using the `filter_parameters` configuration:
|
125
81
|
|
126
|
-
Both `Opbeat.capture_exception` and `Opbeat.capture_message` take additional `options`:
|
127
82
|
```ruby
|
128
|
-
|
83
|
+
config.opbeat.filter_parameters += [/regex(p)?/, "string", :symbol]
|
129
84
|
```
|
130
85
|
|
86
|
+
### User information
|
131
87
|
|
132
|
-
|
133
|
-
|
134
|
-
By default events will be sent to Opbeat if your application is running in any of the following environments: `development`, `production`, `default`. Environment is set by default if you are running a Rack application (i.e. anytime `ENV['RACK_ENV']` is set).
|
135
|
-
|
136
|
-
You can configure Opbeat to run only in production environments by configuring the `environments` whitelist:
|
88
|
+
Opbeat can automatically add user information to errors. By default it looks for at method called `current_user` on the current controller. To change the method use `current_user_method`.
|
137
89
|
|
138
|
-
```
|
139
|
-
|
140
|
-
|
141
|
-
Opbeat.configure do |config|
|
142
|
-
config.organization_id = '094e250818f44e82bfae13919f55fb35'
|
143
|
-
config.app_id = '094e250818'
|
144
|
-
config.secret_token = 'f0f5237a221637f561a15614f5fef218f8d6317d'
|
145
|
-
|
146
|
-
config.environments = %w[ production ]
|
147
|
-
end
|
90
|
+
```
|
91
|
+
config.opbeat.current_user_method = :current_employee
|
148
92
|
```
|
149
93
|
|
150
|
-
##
|
94
|
+
## Background processing
|
151
95
|
|
152
|
-
|
96
|
+
Opbeat automatically catches exceptions in [delayed_job](https://github.com/collectiveidea/delayed_job) or [sidekiq](http://sidekiq.org/).
|
153
97
|
|
154
|
-
|
98
|
+
To enable Opbeat for [resque](https://github.com/resque/resque), add the following (for example in `config/initializers/opbeat_resque.rb`):
|
155
99
|
|
156
100
|
```ruby
|
157
|
-
require
|
158
|
-
|
159
|
-
Opbeat.configure do |config|
|
160
|
-
config.organization_id = '094e250818f44e82bfae13919f55fb35'
|
161
|
-
config.app_id = '094e250818'
|
162
|
-
config.secret_token = 'f0f5237a221637f561a15614f5fef218f8d6317d'
|
101
|
+
require "resque/failure/multiple"
|
102
|
+
require "opbeat/integration/resque"
|
163
103
|
|
164
|
-
|
165
|
-
|
104
|
+
Resque::Failure::Multiple.classes = [Resque::Failure::Opbeat]
|
105
|
+
Resque::Failure.backend = Resque::Failure::Multiple
|
166
106
|
```
|
167
107
|
|
168
|
-
##
|
108
|
+
## Manual profiling
|
169
109
|
|
170
|
-
|
171
|
-
on the following rules.
|
110
|
+
It's easy to add performance tracking wherever you want using the `Opbeat` module.
|
172
111
|
|
173
|
-
|
174
|
-
filtering settings from `Rails.application.config.filter_parameters`.
|
112
|
+
Basically you have to know about two concepts: `Transaction` and `Trace`.
|
175
113
|
|
176
|
-
|
177
|
-
fall back to its own defaults:
|
114
|
+
**Transactions** are a bundles of transactions. In a typical webapp every request is wrapped in a transaction. If you're instrumenting worker jobs, a single job run would be a transaction.
|
178
115
|
|
179
|
-
|
180
|
-
/(authorization|password|passwd|secret)/i
|
181
|
-
```
|
116
|
+
**Traces** are spans of time that happen during a transaction. Like a call to the database, a render of a view or a HTTP request. Opbeat will automatically trace the libraries that it knows of and you can manually trace whatever else you'd like to.
|
182
117
|
|
183
|
-
|
184
|
-
`filter_parameters` configuration parameter:
|
118
|
+
The basic api looks like this:
|
185
119
|
|
186
120
|
```ruby
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
end
|
121
|
+
Opbeat.transaction "Transaction identifier" do
|
122
|
+
data = Opbeat.trace "Preparation" do
|
123
|
+
prepare_data
|
124
|
+
end
|
125
|
+
Opbeat.trace "Description", "kind" do
|
126
|
+
perform_expensive_task data
|
127
|
+
end
|
128
|
+
end.done(200)
|
196
129
|
```
|
197
130
|
|
198
|
-
|
199
|
-
`http` are filtered.
|
200
|
-
|
201
|
-
## User information
|
202
|
-
|
203
|
-
With Rails, Opbeat expects `controller#current_user` to return an object with `id`, `email` and/or `username` attributes. You can change the name of the current user method in the following manner:
|
131
|
+
Here, for example is how you could profile a Sidekiq worker job:
|
204
132
|
|
205
133
|
```ruby
|
206
|
-
|
207
|
-
|
208
|
-
|
134
|
+
class MyWorker
|
135
|
+
include Sidekiq::Worker
|
136
|
+
|
137
|
+
def perform
|
138
|
+
Opbeat.transaction "MyWorker#perform", "worker.sidekiq" do
|
139
|
+
User.find_each do |user|
|
140
|
+
Opbeat.trace 'run!' do
|
141
|
+
user.sync_with_payment_provider!
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end.submit(true)
|
145
|
+
# `true` here is the result of the transaction
|
146
|
+
# eg 200, 404 and so on for web requests but
|
147
|
+
# anything that translates into JSON works
|
148
|
+
|
149
|
+
Opbeat.flush_transactions # send transactions right away
|
150
|
+
end
|
209
151
|
end
|
210
152
|
```
|
211
153
|
|
212
|
-
|
213
|
-
|
214
|
-
## Setting context
|
215
|
-
|
216
|
-
It is possible to set a context which be included an exceptions that are captured.
|
154
|
+
If you are inside a web request, you are already inside a transaction so you only need to use trace:
|
217
155
|
|
218
156
|
```ruby
|
219
|
-
|
157
|
+
class UsersController < ApplicationController
|
220
158
|
|
221
|
-
|
222
|
-
|
159
|
+
def extend_profiles
|
160
|
+
users = User.all
|
223
161
|
|
224
|
-
|
162
|
+
Opbeat.trace "prepare users" do
|
163
|
+
users.each { |user| user.extend_profile! }
|
164
|
+
end
|
225
165
|
|
226
|
-
|
166
|
+
render text: 'ok'
|
167
|
+
end
|
227
168
|
|
228
|
-
```ruby
|
229
|
-
Opbeat.configure do |config|
|
230
|
-
...
|
231
|
-
config.timeout = 5
|
232
|
-
config.open_timeout = 5
|
233
169
|
end
|
234
170
|
```
|
235
171
|
|
236
|
-
##
|
237
|
-
|
238
|
-
When an error occurs, the notification is immediately sent to Opbeat.
|
239
|
-
This will hold up the client HTTP request as long as the request to
|
240
|
-
Opbeat is ongoing. Alternatively the agent can be configured to send
|
241
|
-
notifications asynchronously.
|
242
|
-
|
243
|
-
Example using a native Ruby `Thread`:
|
244
|
-
|
245
|
-
```ruby
|
246
|
-
Opbeat.configure do |config|
|
247
|
-
config.async = lambda { |event|
|
248
|
-
Thread.new { Opbeat.send(event) }
|
249
|
-
}
|
250
|
-
end
|
251
|
-
```
|
252
|
-
|
253
|
-
Using this decoupled approach you can easily implement this into your
|
254
|
-
existing background job infrastructure. The only requirement is that you
|
255
|
-
at some point call the `Opbeat.send` method with the `event` object.
|
256
|
-
|
257
|
-
## Testing
|
172
|
+
## Testing and development
|
258
173
|
|
259
174
|
```bash
|
260
175
|
$ bundle install
|
261
|
-
$
|
176
|
+
$ rspec spec
|
262
177
|
```
|
263
178
|
|
179
|
+
## Legacy
|
180
|
+
|
181
|
+
Be aware that 3.0 is a almost complete rewrite of the Opbeat ruby client. It is not api compliant with version 2 and below.
|
182
|
+
|
264
183
|
## Resources
|
265
184
|
|
266
|
-
* [Bug Tracker](http://github.com/opbeat/
|
267
|
-
* [Code](http://github.com/opbeat/
|
185
|
+
* [Bug Tracker](http://github.com/opbeat/opbeat-ruby/issues)
|
186
|
+
* [Code](http://github.com/opbeat/opbeat-ruby)
|