stackify-ruby-apm 0.9.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +18 -0
- data/Gemfile.lock +181 -8
- data/LICENSE.md +66 -0
- data/README.md +5 -3
- data/Rakefile +4 -0
- data/docker-compose.yml +46 -0
- data/lib/stackify/agent.rb +22 -9
- data/lib/stackify/config.rb +65 -29
- data/lib/stackify/context/response.rb +13 -0
- data/lib/stackify/context_builder.rb +0 -2
- data/lib/stackify/error.rb +2 -2
- data/lib/stackify/error_builder.rb +1 -1
- data/lib/stackify/instrumenter.rb +4 -4
- data/lib/stackify/logger/logger_high_version.rb +65 -0
- data/lib/stackify/logger/logger_lower_version.rb +63 -0
- data/lib/stackify/middleware.rb +0 -4
- data/lib/stackify/normalizers.rb +0 -1
- data/lib/stackify/normalizers/active_record.rb +3 -1
- data/lib/stackify/railtie.rb +0 -1
- data/lib/stackify/serializers/errors.rb +8 -7
- data/lib/stackify/serializers/transactions.rb +3 -2
- data/lib/stackify/span.rb +1 -2
- data/lib/stackify/span/context.rb +5 -1
- data/lib/stackify/spies/action_dispatch.rb +8 -1
- data/lib/stackify/spies/httpclient.rb +14 -5
- data/lib/stackify/spies/httprb.rb +45 -0
- data/lib/stackify/spies/mongo.rb +13 -1
- data/lib/stackify/spies/net_http.rb +14 -3
- data/lib/stackify/spies/redis.rb +66 -0
- data/lib/stackify/spies/sinatra.rb +3 -1
- data/lib/stackify/spies/sinatra_activerecord/mysql_adapter.rb +177 -0
- data/lib/stackify/spies/sinatra_activerecord/postgresql_adapter.rb +96 -0
- data/lib/stackify/spies/sinatra_activerecord/sqlite_adapter.rb +48 -0
- data/lib/stackify/spies/tilt.rb +8 -1
- data/lib/stackify/stacktrace_builder.rb +4 -3
- data/lib/stackify/subscriber.rb +4 -4
- data/lib/stackify/trace_logger.rb +6 -23
- data/lib/stackify/transaction.rb +10 -1
- data/lib/stackify/util.rb +0 -13
- data/lib/stackify/version.rb +1 -1
- data/lib/stackify/worker.rb +5 -5
- data/lib/stackify_ruby_apm.rb +2 -6
- data/run-test.sh +75 -0
- data/stackify-ruby-apm.gemspec +0 -1
- metadata +12 -17
- data/lib/stackify/logger.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bd379b0656760e155c8796bf1774627e593ecbe
|
4
|
+
data.tar.gz: cb1f771b879d3c21dafc339e7f1cb874f592f9fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be773012e733b98d520a0605f9a6fe85f79a06feddfda47046479929eba89b161a50528e0bc8188717ad2d5004fc236b71f720941f78378baeb74ae87f0f564f
|
7
|
+
data.tar.gz: bae740a96d52bd9905af652998a3f5440f836028e1d000684e496ea37f5fd8b0c50e9f752b02ada9b84e341a6fcd2f44c9409d7efc96e6f26b627d9d9630b0a5
|
data/Gemfile
CHANGED
@@ -2,3 +2,21 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in stackify-ruby-apm.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
group :test do
|
7
|
+
gem 'mongo'
|
8
|
+
gem 'webmock'
|
9
|
+
gem 'fakeredis'
|
10
|
+
gem 'rack-test'
|
11
|
+
gem 'rails'
|
12
|
+
gem 'httpclient'
|
13
|
+
gem 'http'
|
14
|
+
gem 'timecop'
|
15
|
+
gem "sinatra"
|
16
|
+
gem "activerecord"
|
17
|
+
gem "sinatra-activerecord"
|
18
|
+
gem "sqlite3"
|
19
|
+
gem 'mysql2'
|
20
|
+
gem 'pg', '~> 0.20'
|
21
|
+
gem 'rubocop', require: false
|
22
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,29 +1,149 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stackify-ruby-apm (0.
|
4
|
+
stackify-ruby-apm (1.0.0)
|
5
5
|
concurrent-ruby (~> 1.0)
|
6
6
|
delegate_matcher (~> 0.4)
|
7
|
-
webmock (~> 3.4)
|
8
7
|
|
9
8
|
GEM
|
10
9
|
remote: https://rubygems.org/
|
11
10
|
specs:
|
11
|
+
actioncable (5.2.2)
|
12
|
+
actionpack (= 5.2.2)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
actionmailer (5.2.2)
|
16
|
+
actionpack (= 5.2.2)
|
17
|
+
actionview (= 5.2.2)
|
18
|
+
activejob (= 5.2.2)
|
19
|
+
mail (~> 2.5, >= 2.5.4)
|
20
|
+
rails-dom-testing (~> 2.0)
|
21
|
+
actionpack (5.2.2)
|
22
|
+
actionview (= 5.2.2)
|
23
|
+
activesupport (= 5.2.2)
|
24
|
+
rack (~> 2.0)
|
25
|
+
rack-test (>= 0.6.3)
|
26
|
+
rails-dom-testing (~> 2.0)
|
27
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
+
actionview (5.2.2)
|
29
|
+
activesupport (= 5.2.2)
|
30
|
+
builder (~> 3.1)
|
31
|
+
erubi (~> 1.4)
|
32
|
+
rails-dom-testing (~> 2.0)
|
33
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
+
activejob (5.2.2)
|
35
|
+
activesupport (= 5.2.2)
|
36
|
+
globalid (>= 0.3.6)
|
37
|
+
activemodel (5.2.2)
|
38
|
+
activesupport (= 5.2.2)
|
39
|
+
activerecord (5.2.2)
|
40
|
+
activemodel (= 5.2.2)
|
41
|
+
activesupport (= 5.2.2)
|
42
|
+
arel (>= 9.0)
|
43
|
+
activestorage (5.2.2)
|
44
|
+
actionpack (= 5.2.2)
|
45
|
+
activerecord (= 5.2.2)
|
46
|
+
marcel (~> 0.3.1)
|
47
|
+
activesupport (5.2.2)
|
48
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
49
|
+
i18n (>= 0.7, < 2)
|
50
|
+
minitest (~> 5.1)
|
51
|
+
tzinfo (~> 1.1)
|
12
52
|
addressable (2.5.2)
|
13
53
|
public_suffix (>= 2.0.2, < 4.0)
|
14
|
-
|
54
|
+
arel (9.0.0)
|
55
|
+
ast (2.4.0)
|
56
|
+
bson (4.3.0)
|
57
|
+
builder (3.2.3)
|
58
|
+
concurrent-ruby (1.1.4)
|
15
59
|
crack (0.4.3)
|
16
60
|
safe_yaml (~> 1.0.0)
|
61
|
+
crass (1.0.4)
|
17
62
|
delegate_matcher (0.4.3)
|
18
63
|
proc_extensions (~> 0.2)
|
19
64
|
diff-lcs (1.3)
|
65
|
+
domain_name (0.5.20180417)
|
66
|
+
unf (>= 0.0.5, < 1.0.0)
|
67
|
+
erubi (1.8.0)
|
68
|
+
fakeredis (0.7.0)
|
69
|
+
redis (>= 3.2, < 5.0)
|
20
70
|
file-tail (1.2.0)
|
21
71
|
tins (~> 1.0)
|
22
|
-
|
72
|
+
globalid (0.4.1)
|
73
|
+
activesupport (>= 4.2.0)
|
74
|
+
hashdiff (0.3.8)
|
75
|
+
http (4.0.0)
|
76
|
+
addressable (~> 2.3)
|
77
|
+
http-cookie (~> 1.0)
|
78
|
+
http-form_data (~> 2.0)
|
79
|
+
http_parser.rb (~> 0.6.0)
|
80
|
+
http-cookie (1.0.3)
|
81
|
+
domain_name (~> 0.5)
|
82
|
+
http-form_data (2.1.1)
|
83
|
+
http_parser.rb (0.6.0)
|
84
|
+
httpclient (2.8.3)
|
85
|
+
i18n (1.5.1)
|
86
|
+
concurrent-ruby (~> 1.0)
|
87
|
+
jaro_winkler (1.5.2)
|
88
|
+
loofah (2.2.3)
|
89
|
+
crass (~> 1.0.2)
|
90
|
+
nokogiri (>= 1.5.9)
|
91
|
+
mail (2.7.1)
|
92
|
+
mini_mime (>= 0.1.1)
|
93
|
+
marcel (0.3.3)
|
94
|
+
mimemagic (~> 0.3.2)
|
95
|
+
method_source (0.9.2)
|
96
|
+
mimemagic (0.3.3)
|
97
|
+
mini_mime (1.0.1)
|
98
|
+
mini_portile2 (2.4.0)
|
99
|
+
minitest (5.11.3)
|
100
|
+
mongo (2.6.2)
|
101
|
+
bson (>= 4.3.0, < 5.0.0)
|
102
|
+
mustermann (1.0.3)
|
103
|
+
mysql2 (0.5.2)
|
104
|
+
nio4r (2.3.1)
|
105
|
+
nokogiri (1.10.0)
|
106
|
+
mini_portile2 (~> 2.4.0)
|
107
|
+
parallel (1.12.1)
|
108
|
+
parser (2.5.3.0)
|
109
|
+
ast (~> 2.4.0)
|
110
|
+
pg (0.21.0)
|
111
|
+
powerpack (0.1.2)
|
23
112
|
proc_extensions (0.2)
|
24
113
|
sourcify (~> 0.5)
|
25
114
|
public_suffix (3.0.3)
|
115
|
+
rack (2.0.6)
|
116
|
+
rack-protection (2.0.5)
|
117
|
+
rack
|
118
|
+
rack-test (1.1.0)
|
119
|
+
rack (>= 1.0, < 3)
|
120
|
+
rails (5.2.2)
|
121
|
+
actioncable (= 5.2.2)
|
122
|
+
actionmailer (= 5.2.2)
|
123
|
+
actionpack (= 5.2.2)
|
124
|
+
actionview (= 5.2.2)
|
125
|
+
activejob (= 5.2.2)
|
126
|
+
activemodel (= 5.2.2)
|
127
|
+
activerecord (= 5.2.2)
|
128
|
+
activestorage (= 5.2.2)
|
129
|
+
activesupport (= 5.2.2)
|
130
|
+
bundler (>= 1.3.0)
|
131
|
+
railties (= 5.2.2)
|
132
|
+
sprockets-rails (>= 2.0.0)
|
133
|
+
rails-dom-testing (2.0.3)
|
134
|
+
activesupport (>= 4.2.0)
|
135
|
+
nokogiri (>= 1.6)
|
136
|
+
rails-html-sanitizer (1.0.4)
|
137
|
+
loofah (~> 2.2, >= 2.2.2)
|
138
|
+
railties (5.2.2)
|
139
|
+
actionpack (= 5.2.2)
|
140
|
+
activesupport (= 5.2.2)
|
141
|
+
method_source
|
142
|
+
rake (>= 0.8.7)
|
143
|
+
thor (>= 0.19.0, < 2.0)
|
144
|
+
rainbow (3.0.0)
|
26
145
|
rake (10.5.0)
|
146
|
+
redis (4.1.0)
|
27
147
|
rspec (3.8.0)
|
28
148
|
rspec-core (~> 3.8.0)
|
29
149
|
rspec-expectations (~> 3.8.0)
|
@@ -37,32 +157,85 @@ GEM
|
|
37
157
|
diff-lcs (>= 1.2.0, < 2.0)
|
38
158
|
rspec-support (~> 3.8.0)
|
39
159
|
rspec-support (3.8.0)
|
160
|
+
rubocop (0.62.0)
|
161
|
+
jaro_winkler (~> 1.5.1)
|
162
|
+
parallel (~> 1.10)
|
163
|
+
parser (>= 2.5, != 2.5.1.1)
|
164
|
+
powerpack (~> 0.1)
|
165
|
+
rainbow (>= 2.2.2, < 4.0)
|
166
|
+
ruby-progressbar (~> 1.7)
|
167
|
+
unicode-display_width (~> 1.4.0)
|
168
|
+
ruby-progressbar (1.10.0)
|
40
169
|
ruby2ruby (2.4.1)
|
41
170
|
ruby_parser (~> 3.1)
|
42
171
|
sexp_processor (~> 4.6)
|
43
|
-
ruby_parser (3.
|
172
|
+
ruby_parser (3.12.0)
|
44
173
|
sexp_processor (~> 4.9)
|
45
174
|
safe_yaml (1.0.4)
|
46
175
|
sexp_processor (4.11.0)
|
176
|
+
sinatra (2.0.5)
|
177
|
+
mustermann (~> 1.0)
|
178
|
+
rack (~> 2.0)
|
179
|
+
rack-protection (= 2.0.5)
|
180
|
+
tilt (~> 2.0)
|
181
|
+
sinatra-activerecord (2.0.13)
|
182
|
+
activerecord (>= 3.2)
|
183
|
+
sinatra (>= 1.0)
|
47
184
|
sourcify (0.5.0)
|
48
185
|
file-tail (>= 1.0.5)
|
49
186
|
ruby2ruby (>= 1.2.5)
|
50
187
|
ruby_parser (>= 2.0.5)
|
51
188
|
sexp_processor (>= 3.0.5)
|
52
|
-
|
53
|
-
|
189
|
+
sprockets (3.7.2)
|
190
|
+
concurrent-ruby (~> 1.0)
|
191
|
+
rack (> 1, < 3)
|
192
|
+
sprockets-rails (3.2.1)
|
193
|
+
actionpack (>= 4.0)
|
194
|
+
activesupport (>= 4.0)
|
195
|
+
sprockets (>= 3.0.0)
|
196
|
+
sqlite3 (1.3.13)
|
197
|
+
thor (0.20.3)
|
198
|
+
thread_safe (0.3.6)
|
199
|
+
tilt (2.0.9)
|
200
|
+
timecop (0.9.1)
|
201
|
+
tins (1.20.2)
|
202
|
+
tzinfo (1.2.5)
|
203
|
+
thread_safe (~> 0.1)
|
204
|
+
unf (0.1.4)
|
205
|
+
unf_ext
|
206
|
+
unf_ext (0.0.7.5)
|
207
|
+
unicode-display_width (1.4.1)
|
208
|
+
webmock (3.5.1)
|
54
209
|
addressable (>= 2.3.6)
|
55
210
|
crack (>= 0.3.2)
|
56
211
|
hashdiff
|
212
|
+
websocket-driver (0.7.0)
|
213
|
+
websocket-extensions (>= 0.1.0)
|
214
|
+
websocket-extensions (0.1.3)
|
57
215
|
|
58
216
|
PLATFORMS
|
59
217
|
ruby
|
60
218
|
|
61
219
|
DEPENDENCIES
|
220
|
+
activerecord
|
62
221
|
bundler (~> 1.16)
|
222
|
+
fakeredis
|
223
|
+
http
|
224
|
+
httpclient
|
225
|
+
mongo
|
226
|
+
mysql2
|
227
|
+
pg (~> 0.20)
|
228
|
+
rack-test
|
229
|
+
rails
|
63
230
|
rake (~> 10.0)
|
64
231
|
rspec (~> 3.0)
|
232
|
+
rubocop
|
233
|
+
sinatra
|
234
|
+
sinatra-activerecord
|
235
|
+
sqlite3
|
65
236
|
stackify-ruby-apm!
|
237
|
+
timecop
|
238
|
+
webmock
|
66
239
|
|
67
240
|
BUNDLED WITH
|
68
|
-
1.
|
241
|
+
1.17.3
|
data/LICENSE.md
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
Stackify Ruby APM LICENSE
|
2
|
+
---
|
3
|
+
|
4
|
+
Certain inventions disclosed in this file may be claimed within patents owned or patent applications filed by
|
5
|
+
Stackify, LLC (“Stackify”) or third parties.
|
6
|
+
|
7
|
+
Stackify grants you a revocable, non-exclusive, non-transferable, limited license to download, install and use this
|
8
|
+
Stackify Ruby APM package (“Application”) strictly in accordance with the terms of this Agreement and the terms found
|
9
|
+
at https://stackify.com/terms-conditions.
|
10
|
+
|
11
|
+
You agree not to, and you will not permit others to: license, sell, rent, lease, assign, distribute, transmit, host,
|
12
|
+
outsource, disclose or otherwise commercially exploit the Application or make the Application available to any third
|
13
|
+
party; modify, make derivative works of, disassemble, decrypt, reverse compile or reverse engineer any part of the
|
14
|
+
Application; or remove, alter or obscure any proprietary notice (including any notice of copyright or trademark) of
|
15
|
+
Stackify or its affiliates, partners, suppliers or the licensors of the Application.
|
16
|
+
|
17
|
+
You may install, execute, and distribute these files and their contents only in conjunction with your direct use of
|
18
|
+
Stackify’s services. These files and their contents shall not be used in conjunction with any other product or
|
19
|
+
software, including but not limited to those that may compete with any Stackify product, feature, or software. As a
|
20
|
+
condition to the foregoing grant, you must provide this notice along with each copy you distribute and you must not
|
21
|
+
remove, alter, or obscure this notice.
|
22
|
+
|
23
|
+
The Application, including without limitation all copyrights, patents, trademarks, trade secrets and other intellectual
|
24
|
+
property rights are, and shall remain, the sole and exclusive property of Stackify. Any feedback, comments, ideas,
|
25
|
+
code, pull requests, improvements or suggestions (collectively, "Suggestions") provided by you to Stackify with respect
|
26
|
+
to the Application shall remain the sole and exclusive property of Stackify. Stackify shall be free to use, copy,
|
27
|
+
modify, publish, or redistribute the Suggestions for any purpose and in any way without any credit or any compensation
|
28
|
+
to you.
|
29
|
+
|
30
|
+
Stackify reserves the right to modify, suspend or discontinue, temporarily or permanently, the Application or any
|
31
|
+
service to which it connects, with or without notice and without liability to you.
|
32
|
+
|
33
|
+
Stackify may from time to time provide enhancements or improvements to the features/functionality of the Application,
|
34
|
+
which may include patches, bug fixes, updates, upgrades and other modifications ("Updates"). Updates may modify or
|
35
|
+
delete certain features and/or functionalities of the Application. You agree that Stackify has no obligation to (i)
|
36
|
+
provide any Updates, or (ii) continue to provide or enable any particular features and/or functionalities of the
|
37
|
+
Application to you. You further agree that all Updates will be (i) deemed to constitute an integral part of the
|
38
|
+
Application, and (ii) subject to the terms and conditions of this Agreement.
|
39
|
+
|
40
|
+
All other use, reproduction, modification, distribution, or other exploitation of these files is strictly prohibited,
|
41
|
+
except as may be set forth in a separate written license agreement between you and Stackify. The terms of any such
|
42
|
+
license agreement will control over this notice. The license stated above will be automatically terminated and
|
43
|
+
revoked if you exceed its scope or violate any of the terms of this notice.
|
44
|
+
|
45
|
+
Upon termination of this Agreement, you shall cease all use of the Application and delete all copies of the
|
46
|
+
Application from your mobile device or from your computer.
|
47
|
+
|
48
|
+
Termination of this Agreement will not limit any of Stackify LLC's rights or remedies at law or in equity in case of
|
49
|
+
breach by you (during the term of this Agreement) of any of your obligations under the present Agreement.
|
50
|
+
|
51
|
+
You agree to indemnify and hold Stackify LLC and its parents, subsidiaries, affiliates, officers, employees, agents,
|
52
|
+
partners and licensors (if any) harmless from any claim or demand, including reasonable attorneys' fees, due to or
|
53
|
+
arising out of your: (a) use of the Application; (b) violation of this Agreement or any law or regulation; or (c)
|
54
|
+
violation of any right of a third party.
|
55
|
+
|
56
|
+
Unless otherwise expressly agreed by Stackify in a separate written license agreement, these files are provided
|
57
|
+
AS IS, WITHOUT WARRANTY OF ANY KIND, including without any implied warranties of MERCHANTABILITY, FITNESS FOR A
|
58
|
+
PARTICULAR PURPOSE, TITLE, or NON-INFRINGEMENT. As a condition to your use of these files, you are solely responsible
|
59
|
+
for such use. Stackify will have no liability to you for direct, indirect, consequential, incidental, special, or
|
60
|
+
punitive damages or for lost profits or data.
|
61
|
+
|
62
|
+
The Application also uses code from the following open source projects under the following licenses:
|
63
|
+
|
64
|
+
* concurrent-ruby - http://opensource.org/licenses/MIT
|
65
|
+
* delegate_matcher - http://opensource.org/licenses/MIT
|
66
|
+
* webmock - http://opensource.org/licenses/MIT
|
data/README.md
CHANGED
@@ -6,9 +6,11 @@
|
|
6
6
|
1. Install **Stackify Linux Agent**.
|
7
7
|
|
8
8
|
2. Check that your setup meets our system requirements.
|
9
|
-
* Ruby version 2.
|
10
|
-
*
|
11
|
-
* Ruby on Rails
|
9
|
+
* Ruby version 2.0+
|
10
|
+
* Frameworks
|
11
|
+
* Ruby on Rails 4+
|
12
|
+
* Rack 1+
|
13
|
+
* Sinatra 1.4+
|
12
14
|
* Operating System
|
13
15
|
* Linux
|
14
16
|
|
data/Rakefile
CHANGED
data/docker-compose.yml
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
version: "3"
|
2
|
+
services:
|
3
|
+
|
4
|
+
dbpostgresql:
|
5
|
+
image: postgres
|
6
|
+
volumes:
|
7
|
+
- postgresdata:/var/lib/postgresql/data
|
8
|
+
ports:
|
9
|
+
- 5433:5432
|
10
|
+
environment:
|
11
|
+
POSTGRES_DB: PostgresTestDB
|
12
|
+
POSTGRES_USER: bob
|
13
|
+
POSTGRES_PASSWORD: password
|
14
|
+
container_name: sinatra_activerecord_postgres_test
|
15
|
+
|
16
|
+
dbmysql:
|
17
|
+
image: mysql:5.7
|
18
|
+
volumes:
|
19
|
+
- mysqldata:/var/lib/mysql
|
20
|
+
ports:
|
21
|
+
- 3305:3306
|
22
|
+
environment:
|
23
|
+
- MYSQL_ROOT_PASSWORD=secret
|
24
|
+
- MYSQL_USER=bob
|
25
|
+
- MYSQL_PASSWORD=password
|
26
|
+
- MYSQL_DATABASE=MysqlTestDB
|
27
|
+
container_name: sinatra_activerecord_mysql_test
|
28
|
+
|
29
|
+
dbmongo:
|
30
|
+
image: mongo:3.6
|
31
|
+
volumes:
|
32
|
+
- mongodata:/data/db
|
33
|
+
- mongodata_config:/data/configdb
|
34
|
+
ports:
|
35
|
+
- 27018:27017
|
36
|
+
container_name: sinatra_activerecord_mongo_test
|
37
|
+
|
38
|
+
volumes:
|
39
|
+
postgresdata:
|
40
|
+
driver: local
|
41
|
+
mysqldata:
|
42
|
+
driver: local
|
43
|
+
mongodata:
|
44
|
+
driver: local
|
45
|
+
mongodata_config:
|
46
|
+
driver: local
|
data/lib/stackify/agent.rb
CHANGED
@@ -27,6 +27,16 @@ module StackifyRubyAPM
|
|
27
27
|
def self.start(config)
|
28
28
|
return @instance if @instance
|
29
29
|
config = Config.new(config) unless config.is_a?(Config)
|
30
|
+
pid = $PID || Process.pid
|
31
|
+
host_name = config.hostname || `hostname`
|
32
|
+
date_now = Time.now
|
33
|
+
current_trace_file = config.log_trace_path + host_name.squish! + "#" + pid.to_s.squish! + ".log"
|
34
|
+
|
35
|
+
if(ENV['STACKIFY_RUBY_ENV'] != 'rspec')
|
36
|
+
config.tracer_logger = StackifyLogger.new(current_trace_file, config.filenum_rotate, config.logger_byte_size)
|
37
|
+
config.logtime_created = date_now.strftime("%H:%M")
|
38
|
+
end
|
39
|
+
|
30
40
|
LOCK.synchronize do
|
31
41
|
return @instance if @instance
|
32
42
|
@instance = new(config).start
|
@@ -53,7 +63,6 @@ module StackifyRubyAPM
|
|
53
63
|
end
|
54
64
|
|
55
65
|
def initialize(config)
|
56
|
-
# puts '@stackify_ruby [Agent] [lib/agent.rb] initialize()'
|
57
66
|
@config = config
|
58
67
|
@trace_logger = TraceLogger.new(config)
|
59
68
|
@messages = Queue.new
|
@@ -62,6 +71,7 @@ module StackifyRubyAPM
|
|
62
71
|
@context_builder = ContextBuilder.new(self)
|
63
72
|
@error_builder = ErrorBuilder.new(self)
|
64
73
|
@stacktrace_builder = StacktraceBuilder.new(self)
|
74
|
+
@error_serializer = Serializers::Errors.new(config)
|
65
75
|
end
|
66
76
|
|
67
77
|
attr_reader :config,
|
@@ -71,18 +81,17 @@ module StackifyRubyAPM
|
|
71
81
|
:context_builder,
|
72
82
|
:stacktrace_builder,
|
73
83
|
:trace_logger,
|
84
|
+
:error_serializer,
|
74
85
|
:error_builder
|
75
86
|
|
76
87
|
def start
|
77
|
-
|
78
|
-
|
79
|
-
# puts '@stackify_ruby [Agent] [lib/agent.rb] Application Name: ' + @config.application_name
|
80
|
-
# @instrumenter.start
|
81
|
-
debug 'Loaded spies:'
|
88
|
+
info '[Agent] start()'
|
89
|
+
spies_name = ''
|
82
90
|
config.enabled_spies.each do |lib|
|
83
|
-
|
91
|
+
spies_name = spies_name + ', ' + lib.inspect.to_s
|
84
92
|
require "stackify/spies/#{lib}"
|
85
93
|
end
|
94
|
+
debug '[Agent] Loaded spies:' + spies_name
|
86
95
|
self
|
87
96
|
end
|
88
97
|
|
@@ -142,7 +151,11 @@ module StackifyRubyAPM
|
|
142
151
|
exception,
|
143
152
|
handled: handled
|
144
153
|
)
|
145
|
-
|
154
|
+
current_error = @error_serializer.build(error)
|
155
|
+
if current_transaction
|
156
|
+
current_transaction.add_exception(current_error)
|
157
|
+
end
|
158
|
+
|
146
159
|
end
|
147
160
|
|
148
161
|
def report_message(message, backtrace: nil, **attrs)
|
@@ -157,7 +170,7 @@ module StackifyRubyAPM
|
|
157
170
|
private
|
158
171
|
|
159
172
|
def boot_worker
|
160
|
-
debug 'Booting worker'
|
173
|
+
debug '[Agent] Booting worker'
|
161
174
|
|
162
175
|
@worker_thread = Thread.new do
|
163
176
|
Worker.new(
|