appsignal 3.0.15-java → 3.0.19-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -3
- data/.semaphore/semaphore.yml +513 -104
- data/CHANGELOG.md +57 -0
- data/appsignal.gemspec +0 -2
- data/build_matrix.yml +45 -17
- data/ext/agent.yml +25 -25
- data/ext/appsignal_extension.c +201 -0
- data/ext/base.rb +2 -1
- data/gemfiles/rails-6.1.gemfile +7 -0
- data/gemfiles/rails-7.0.gemfile +7 -0
- data/lib/appsignal/cli/diagnose/utils.rb +0 -14
- data/lib/appsignal/cli/diagnose.rb +19 -8
- data/lib/appsignal/config.rb +89 -57
- data/lib/appsignal/event_formatter/sequel/sql_formatter.rb +24 -0
- data/lib/appsignal/extension/jruby.rb +147 -0
- data/lib/appsignal/extension.rb +5 -0
- data/lib/appsignal/integrations/sidekiq.rb +5 -1
- data/lib/appsignal/span.rb +92 -0
- data/lib/appsignal/system.rb +0 -4
- data/lib/appsignal/transaction.rb +12 -1
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +4 -10
- data/script/lint_git +1 -1
- data/spec/lib/appsignal/cli/diagnose_spec.rb +18 -13
- data/spec/lib/appsignal/config_spec.rb +104 -20
- data/spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb +2 -2
- data/spec/lib/appsignal/event_formatter/sequel/sql_formatter_spec.rb +30 -0
- data/spec/lib/appsignal/event_formatter_spec.rb +2 -2
- data/spec/lib/appsignal/hooks/activejob_spec.rb +17 -6
- data/spec/lib/appsignal/hooks/sequel_spec.rb +1 -1
- data/spec/lib/appsignal/integrations/padrino_spec.rb +8 -2
- data/spec/lib/appsignal/integrations/sidekiq_spec.rb +23 -5
- data/spec/lib/appsignal/span_spec.rb +141 -0
- data/spec/lib/appsignal/transaction_spec.rb +25 -0
- data/spec/lib/appsignal/utils/data_spec.rb +0 -2
- data/spec/lib/appsignal/utils/json_spec.rb +0 -2
- data/spec/lib/appsignal_spec.rb +2 -3
- data/spec/support/helpers/activejob_helpers.rb +27 -0
- data/spec/support/helpers/dependency_helper.rb +13 -1
- metadata +13 -3
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,62 @@
|
|
1
1
|
# AppSignal for Ruby gem Changelog
|
2
2
|
|
3
|
+
## 3.0.19
|
4
|
+
|
5
|
+
### Changed
|
6
|
+
|
7
|
+
- [2587eae3](https://github.com/appsignal/appsignal-ruby/commit/2587eae30f17e0f0b5e27cb61982301220cc77b1) patch - Store the extension install report as JSON, instead of YAML. Reduces internal complexity.
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
|
11
|
+
- [243c1ed4](https://github.com/appsignal/appsignal-ruby/commit/243c1ed444f3351ca158200a47836673f851cb31) patch - Improve compatibility with the sequel-rails gem by tracking the performed SQL query in instrumentation events.
|
12
|
+
|
13
|
+
## 3.0.18
|
14
|
+
|
15
|
+
### Added
|
16
|
+
|
17
|
+
- [d7bfcdf1](https://github.com/appsignal/appsignal-ruby/commit/d7bfcdf11a66df1ec5f54ac9342e5566062013b5) patch - Add Ruby 3.1.0 support. There was an issue with `YAML.load` arguments when parsing the `appsignal.yml` config file.
|
18
|
+
|
19
|
+
## 3.0.17
|
20
|
+
|
21
|
+
### Fixed
|
22
|
+
|
23
|
+
- [f9d57752](https://github.com/appsignal/appsignal-ruby/commit/f9d5775217400c59a70d98e9aa96e3dcd06cb1f9) patch - Use the `log_level` option for the Ruby gem logger. Previously it only configured the extension and agent loggers. Also fixes the `debug` and `transaction_debug_mode` option if no `log_level` is configured by the app.
|
24
|
+
|
25
|
+
## 3.0.16
|
26
|
+
|
27
|
+
### Added
|
28
|
+
|
29
|
+
- [fe226e99](https://github.com/appsignal/appsignal-ruby/commit/fe226e99f262bfa46e7a7630defe2fe90f8a3a13) patch - Add experimental Span API. This is not loaded by default and we do not recommend using it yet.
|
30
|
+
- [84b1ba18](https://github.com/appsignal/appsignal-ruby/commit/84b1ba18e50440e5c71d27319e560c5df180d0df) patch - Add "log_level" config option. This new option allows you to define the kind of messages
|
31
|
+
AppSignal's will log and up. The "debug" option will log all "debug", "info", "warning" and
|
32
|
+
"error" log messages. The default value is: "info"
|
33
|
+
|
34
|
+
The allowed values are:
|
35
|
+
- error
|
36
|
+
- warning
|
37
|
+
- info
|
38
|
+
- debug
|
39
|
+
- [6b2ecca2](https://github.com/appsignal/appsignal-ruby/commit/6b2ecca24603061f1b35800f60b0ee6e9f314998) patch - Clean up index values in error messages from PG index violation errors.
|
40
|
+
|
41
|
+
### Changed
|
42
|
+
|
43
|
+
- [25bde454](https://github.com/appsignal/appsignal-ruby/commit/25bde454f82776f8d2ea1fd4dbb00a73e414076e) patch - Order the config options alphabetically in diagnose report output.
|
44
|
+
- [fe226e99](https://github.com/appsignal/appsignal-ruby/commit/fe226e99f262bfa46e7a7630defe2fe90f8a3a13) patch - Use the `filter_parameters` and `filter_session_data` options to filter out specific parameter keys or session data keys for the experimental Span API. Previously only the (undocumented) `filter_data_keys` config option was available to filter out all kinds of app data.
|
45
|
+
- [fe226e99](https://github.com/appsignal/appsignal-ruby/commit/fe226e99f262bfa46e7a7630defe2fe90f8a3a13) patch - Standardize diagnose validation failure message. Explain the diagnose request failed and why.
|
46
|
+
- [fe226e99](https://github.com/appsignal/appsignal-ruby/commit/fe226e99f262bfa46e7a7630defe2fe90f8a3a13) patch - Bump agent to v-5b63505
|
47
|
+
|
48
|
+
- Only filter parameters with the `filter_parameters` config option.
|
49
|
+
- Only filter session data with the `filter_session_data` config option.
|
50
|
+
- [3ad95ea5](https://github.com/appsignal/appsignal-ruby/commit/3ad95ea5dd8a9488d293a652231950bd4a721e6c) patch - Bump agent to v-0db01c2
|
51
|
+
|
52
|
+
- Add `log_level` config option in extension.
|
53
|
+
- Deprecate `debug` and `transaction_debug_mode` option in extension.
|
54
|
+
|
55
|
+
### Deprecated
|
56
|
+
|
57
|
+
- [84b1ba18](https://github.com/appsignal/appsignal-ruby/commit/84b1ba18e50440e5c71d27319e560c5df180d0df) patch - Deprecate "debug" and "transaction_debug_mode" config options in favor of the new "log_level"
|
58
|
+
config option.
|
59
|
+
|
3
60
|
## 3.0.15
|
4
61
|
|
5
62
|
- [b40b3b4f](https://github.com/appsignal/appsignal-ruby/commit/b40b3b4f5264c6b69f9515b53806435258c73086) patch - Print String values in the diagnose report surrounded by quotes. Makes it more clear that it's a String value and not a label we print.
|
data/appsignal.gemspec
CHANGED
data/build_matrix.yml
CHANGED
@@ -52,7 +52,7 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
|
|
52
52
|
- name: Validate CI setup
|
53
53
|
env_vars:
|
54
54
|
- name: RUBY_VERSION
|
55
|
-
value: 2.6.
|
55
|
+
value: 2.6.9
|
56
56
|
- name: GEMSET
|
57
57
|
value: no_dependencies
|
58
58
|
- name: BUNDLE_GEMFILE
|
@@ -76,7 +76,7 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
|
|
76
76
|
- name: RuboCop
|
77
77
|
env_vars:
|
78
78
|
- name: RUBY_VERSION
|
79
|
-
value: 2.6.
|
79
|
+
value: 2.6.9
|
80
80
|
- name: GEMSET
|
81
81
|
value: no_dependencies
|
82
82
|
- name: BUNDLE_GEMFILE
|
@@ -111,7 +111,7 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
|
|
111
111
|
- name: Diagnose
|
112
112
|
env_vars:
|
113
113
|
- name: RUBY_VERSION
|
114
|
-
value:
|
114
|
+
value: 3.0.2
|
115
115
|
- name: LANGUAGE
|
116
116
|
value: ruby
|
117
117
|
commands:
|
@@ -164,6 +164,8 @@ matrix:
|
|
164
164
|
- "no_dependencies"
|
165
165
|
- "rails-5.2"
|
166
166
|
- "rails-6.0"
|
167
|
+
- "rails-6.1"
|
168
|
+
- "rails-7.0"
|
167
169
|
|
168
170
|
ruby:
|
169
171
|
- ruby: "2.0.0-p648"
|
@@ -184,9 +186,10 @@ matrix:
|
|
184
186
|
gems: "none"
|
185
187
|
- ruby: "2.5.8"
|
186
188
|
gems: "minimal"
|
187
|
-
- ruby: "2.6.
|
188
|
-
- ruby: "2.7.
|
189
|
-
- ruby: "3.0.
|
189
|
+
- ruby: "2.6.9"
|
190
|
+
- ruby: "2.7.5"
|
191
|
+
- ruby: "3.0.3"
|
192
|
+
- ruby: "3.1.0"
|
190
193
|
- ruby: "jruby-9.2.19.0"
|
191
194
|
gems: "minimal"
|
192
195
|
env_vars:
|
@@ -204,28 +207,33 @@ matrix:
|
|
204
207
|
bundler: "1.17.3"
|
205
208
|
exclude:
|
206
209
|
ruby:
|
207
|
-
- "2.6.
|
208
|
-
- "2.7.
|
209
|
-
- "3.0.
|
210
|
+
- "2.6.9"
|
211
|
+
- "2.7.5"
|
212
|
+
- "3.0.3"
|
213
|
+
- "3.1.0"
|
210
214
|
- gem: "rails-4.2"
|
211
215
|
bundler: "1.17.3"
|
212
216
|
exclude:
|
213
217
|
ruby:
|
214
|
-
- "2.6.
|
215
|
-
- "2.7.
|
216
|
-
- "3.0.
|
218
|
+
- "2.6.9"
|
219
|
+
- "2.7.5"
|
220
|
+
- "3.0.3"
|
221
|
+
- "3.1.0"
|
217
222
|
- gem: "rails-5.0"
|
218
223
|
exclude:
|
219
224
|
ruby:
|
220
|
-
- "3.0.
|
225
|
+
- "3.0.3"
|
226
|
+
- "3.1.0"
|
221
227
|
- gem: "rails-5.1"
|
222
228
|
exclude:
|
223
229
|
ruby:
|
224
|
-
- "3.0.
|
230
|
+
- "3.0.3"
|
231
|
+
- "3.1.0"
|
225
232
|
- gem: "rails-5.2"
|
226
233
|
exclude:
|
227
234
|
ruby:
|
228
|
-
- "3.0.
|
235
|
+
- "3.0.3"
|
236
|
+
- "3.1.0"
|
229
237
|
- gem: "rails-6.0"
|
230
238
|
exclude:
|
231
239
|
ruby:
|
@@ -233,16 +241,36 @@ matrix:
|
|
233
241
|
- "2.2.10"
|
234
242
|
- "2.3.8"
|
235
243
|
- "2.4.10"
|
244
|
+
- "3.1.0"
|
245
|
+
- gem: "rails-6.1"
|
246
|
+
exclude:
|
247
|
+
ruby:
|
248
|
+
- "2.1.10"
|
249
|
+
- "2.2.10"
|
250
|
+
- "2.3.8"
|
251
|
+
- "2.4.10"
|
252
|
+
- gem: "rails-7.0"
|
253
|
+
exclude:
|
254
|
+
ruby:
|
255
|
+
- "2.1.10"
|
256
|
+
- "2.2.10"
|
257
|
+
- "2.3.8"
|
258
|
+
- "2.4.10"
|
259
|
+
- "2.5.8"
|
260
|
+
- "2.6.9"
|
261
|
+
- "jruby-9.2.19.0"
|
236
262
|
- gem: "resque-1"
|
237
263
|
bundler: "1.17.3"
|
238
264
|
exclude:
|
239
265
|
ruby:
|
240
|
-
- "3.0.
|
266
|
+
- "3.0.3"
|
267
|
+
- "3.1.0"
|
241
268
|
- gem: "resque-2"
|
242
269
|
- gem: "sequel"
|
243
270
|
- gem: "sequel-435"
|
244
271
|
exclude:
|
245
272
|
ruby:
|
246
|
-
- "3.0.
|
273
|
+
- "3.0.3"
|
274
|
+
- "3.1.0"
|
247
275
|
- gem: "sinatra"
|
248
276
|
- gem: "webmachine"
|
data/ext/agent.yml
CHANGED
@@ -3,92 +3,92 @@
|
|
3
3
|
# appsignal-agent repository.
|
4
4
|
# Modifications to this file will be overwritten with the next agent release.
|
5
5
|
---
|
6
|
-
version:
|
6
|
+
version: 15ee07b
|
7
7
|
mirrors:
|
8
8
|
- https://appsignal-agent-releases.global.ssl.fastly.net
|
9
9
|
- https://d135dj0rjqvssy.cloudfront.net
|
10
10
|
triples:
|
11
11
|
x86_64-darwin:
|
12
12
|
static:
|
13
|
-
checksum:
|
13
|
+
checksum: 59bb7f5aea47ccea89b48cc323371fd87609592945ae8692f36063a635970e22
|
14
14
|
filename: appsignal-x86_64-darwin-all-static.tar.gz
|
15
15
|
dynamic:
|
16
|
-
checksum:
|
16
|
+
checksum: ce2d489170fdd84be1467d24e5c13782cf97912b3c7dbaaebe9e074d56e711a2
|
17
17
|
filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
|
18
18
|
universal-darwin:
|
19
19
|
static:
|
20
|
-
checksum:
|
20
|
+
checksum: 59bb7f5aea47ccea89b48cc323371fd87609592945ae8692f36063a635970e22
|
21
21
|
filename: appsignal-x86_64-darwin-all-static.tar.gz
|
22
22
|
dynamic:
|
23
|
-
checksum:
|
23
|
+
checksum: ce2d489170fdd84be1467d24e5c13782cf97912b3c7dbaaebe9e074d56e711a2
|
24
24
|
filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
|
25
25
|
aarch64-darwin:
|
26
26
|
static:
|
27
|
-
checksum:
|
27
|
+
checksum: aa37596a85d65d46fc5bba25d4d059e98655709e6c44ee39e7c6ba72398ad704
|
28
28
|
filename: appsignal-aarch64-darwin-all-static.tar.gz
|
29
29
|
dynamic:
|
30
|
-
checksum:
|
30
|
+
checksum: b40026410702c1bb3ac974c9648d464e0551956dc933deff22543f10cca81e46
|
31
31
|
filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
|
32
32
|
arm64-darwin:
|
33
33
|
static:
|
34
|
-
checksum:
|
34
|
+
checksum: aa37596a85d65d46fc5bba25d4d059e98655709e6c44ee39e7c6ba72398ad704
|
35
35
|
filename: appsignal-aarch64-darwin-all-static.tar.gz
|
36
36
|
dynamic:
|
37
|
-
checksum:
|
37
|
+
checksum: b40026410702c1bb3ac974c9648d464e0551956dc933deff22543f10cca81e46
|
38
38
|
filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
|
39
39
|
arm-darwin:
|
40
40
|
static:
|
41
|
-
checksum:
|
41
|
+
checksum: aa37596a85d65d46fc5bba25d4d059e98655709e6c44ee39e7c6ba72398ad704
|
42
42
|
filename: appsignal-aarch64-darwin-all-static.tar.gz
|
43
43
|
dynamic:
|
44
|
-
checksum:
|
44
|
+
checksum: b40026410702c1bb3ac974c9648d464e0551956dc933deff22543f10cca81e46
|
45
45
|
filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
|
46
46
|
aarch64-linux:
|
47
47
|
static:
|
48
|
-
checksum:
|
48
|
+
checksum: 12c5659d5a5d67ee641bdb1c38ef842b7687811fdec1f9edf8e196a2ed596405
|
49
49
|
filename: appsignal-aarch64-linux-all-static.tar.gz
|
50
50
|
dynamic:
|
51
|
-
checksum:
|
51
|
+
checksum: 8301ab5f64af1c185860314682fbfd89027ea5e4850d8beb222613ca5455358a
|
52
52
|
filename: appsignal-aarch64-linux-all-dynamic.tar.gz
|
53
53
|
i686-linux:
|
54
54
|
static:
|
55
|
-
checksum:
|
55
|
+
checksum: afebd51e26b8d21923a8adcbc8fda7bbd29d4e12573f53895e3a650fcd84ffd5
|
56
56
|
filename: appsignal-i686-linux-all-static.tar.gz
|
57
57
|
dynamic:
|
58
|
-
checksum:
|
58
|
+
checksum: e0ed425a1d92ad7e9beb83f5b7c896f8606773cc599337a198536a150ba76c51
|
59
59
|
filename: appsignal-i686-linux-all-dynamic.tar.gz
|
60
60
|
x86-linux:
|
61
61
|
static:
|
62
|
-
checksum:
|
62
|
+
checksum: afebd51e26b8d21923a8adcbc8fda7bbd29d4e12573f53895e3a650fcd84ffd5
|
63
63
|
filename: appsignal-i686-linux-all-static.tar.gz
|
64
64
|
dynamic:
|
65
|
-
checksum:
|
65
|
+
checksum: e0ed425a1d92ad7e9beb83f5b7c896f8606773cc599337a198536a150ba76c51
|
66
66
|
filename: appsignal-i686-linux-all-dynamic.tar.gz
|
67
67
|
x86_64-linux:
|
68
68
|
static:
|
69
|
-
checksum:
|
69
|
+
checksum: 563eb5c9daeec67a760ac236b2848aee4ec0e39dca1368150a6d99844d4d665f
|
70
70
|
filename: appsignal-x86_64-linux-all-static.tar.gz
|
71
71
|
dynamic:
|
72
|
-
checksum:
|
72
|
+
checksum: 74940f06f4c92582262014a9967f298bccee3ca94e3a490ddc40787573c91ed0
|
73
73
|
filename: appsignal-x86_64-linux-all-dynamic.tar.gz
|
74
74
|
x86_64-linux-musl:
|
75
75
|
static:
|
76
|
-
checksum:
|
76
|
+
checksum: 2ecad2b2bdd362d9d871322eac79370d12314e3d32a53c83be17d054e91f188d
|
77
77
|
filename: appsignal-x86_64-linux-musl-all-static.tar.gz
|
78
78
|
dynamic:
|
79
|
-
checksum:
|
79
|
+
checksum: 5e4c4096ca7b0c7a97fe03f684c0678396c97f24c2065dc961081d022a8ad2a7
|
80
80
|
filename: appsignal-x86_64-linux-musl-all-dynamic.tar.gz
|
81
81
|
x86_64-freebsd:
|
82
82
|
static:
|
83
|
-
checksum:
|
83
|
+
checksum: 2eaa4beeb3322ec3c6007f4a8ec483405f8ade4c372031a068bbedf05da9443d
|
84
84
|
filename: appsignal-x86_64-freebsd-all-static.tar.gz
|
85
85
|
dynamic:
|
86
|
-
checksum:
|
86
|
+
checksum: 4805995f0b10d4b5183e4a2430af19638372a4f290d95a123a0874b2f3878d8e
|
87
87
|
filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
|
88
88
|
amd64-freebsd:
|
89
89
|
static:
|
90
|
-
checksum:
|
90
|
+
checksum: 2eaa4beeb3322ec3c6007f4a8ec483405f8ade4c372031a068bbedf05da9443d
|
91
91
|
filename: appsignal-x86_64-freebsd-all-static.tar.gz
|
92
92
|
dynamic:
|
93
|
-
checksum:
|
93
|
+
checksum: 4805995f0b10d4b5183e4a2430af19638372a4f290d95a123a0874b2f3878d8e
|
94
94
|
filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
|
data/ext/appsignal_extension.c
CHANGED
@@ -19,6 +19,7 @@ VALUE Appsignal;
|
|
19
19
|
VALUE Extension;
|
20
20
|
VALUE Transaction;
|
21
21
|
VALUE Data;
|
22
|
+
VALUE Span;
|
22
23
|
|
23
24
|
static VALUE start(VALUE self) {
|
24
25
|
appsignal_start();
|
@@ -545,6 +546,180 @@ static VALUE data_to_s(VALUE self) {
|
|
545
546
|
}
|
546
547
|
}
|
547
548
|
|
549
|
+
static VALUE root_span_new(VALUE self, VALUE namespace) {
|
550
|
+
appsignal_span_t* span;
|
551
|
+
|
552
|
+
Check_Type(namespace, T_STRING);
|
553
|
+
|
554
|
+
span = appsignal_create_root_span(make_appsignal_string(namespace));
|
555
|
+
|
556
|
+
if (span) {
|
557
|
+
return Data_Wrap_Struct(Span, NULL, appsignal_free_span, span);
|
558
|
+
} else {
|
559
|
+
return Qnil;
|
560
|
+
}
|
561
|
+
}
|
562
|
+
|
563
|
+
static VALUE child_span_new(VALUE self) {
|
564
|
+
appsignal_span_t* parent;
|
565
|
+
appsignal_span_t* span;
|
566
|
+
|
567
|
+
Data_Get_Struct(self, appsignal_span_t, parent);
|
568
|
+
|
569
|
+
span = appsignal_create_child_span(parent);
|
570
|
+
|
571
|
+
if (span) {
|
572
|
+
return Data_Wrap_Struct(Span, NULL, appsignal_free_span, span);
|
573
|
+
} else {
|
574
|
+
return Qnil;
|
575
|
+
}
|
576
|
+
}
|
577
|
+
|
578
|
+
static VALUE set_span_name(VALUE self, VALUE name) {
|
579
|
+
appsignal_span_t* span;
|
580
|
+
|
581
|
+
Check_Type(name, T_STRING);
|
582
|
+
|
583
|
+
Data_Get_Struct(self, appsignal_span_t, span);
|
584
|
+
|
585
|
+
appsignal_set_span_name(span, make_appsignal_string(name));
|
586
|
+
return Qnil;
|
587
|
+
}
|
588
|
+
|
589
|
+
static VALUE add_span_error(VALUE self, VALUE name, VALUE message, VALUE backtrace) {
|
590
|
+
appsignal_span_t* span;
|
591
|
+
appsignal_data_t* backtrace_data;
|
592
|
+
|
593
|
+
Check_Type(name, T_STRING);
|
594
|
+
Check_Type(message, T_STRING);
|
595
|
+
Check_Type(backtrace, RUBY_T_DATA);
|
596
|
+
|
597
|
+
Data_Get_Struct(self, appsignal_span_t, span);
|
598
|
+
Data_Get_Struct(backtrace, appsignal_data_t, backtrace_data);
|
599
|
+
|
600
|
+
appsignal_add_span_error(
|
601
|
+
span,
|
602
|
+
make_appsignal_string(name),
|
603
|
+
make_appsignal_string(message),
|
604
|
+
backtrace_data
|
605
|
+
);
|
606
|
+
return Qnil;
|
607
|
+
}
|
608
|
+
|
609
|
+
static VALUE set_span_sample_data(VALUE self, VALUE key, VALUE payload) {
|
610
|
+
appsignal_span_t* span;
|
611
|
+
appsignal_data_t* payload_data;
|
612
|
+
|
613
|
+
Check_Type(key, T_STRING);
|
614
|
+
Check_Type(payload, RUBY_T_DATA);
|
615
|
+
|
616
|
+
Data_Get_Struct(self, appsignal_span_t, span);
|
617
|
+
Data_Get_Struct(payload, appsignal_data_t, payload_data);
|
618
|
+
|
619
|
+
appsignal_set_span_sample_data(
|
620
|
+
span,
|
621
|
+
make_appsignal_string(key),
|
622
|
+
payload_data
|
623
|
+
);
|
624
|
+
return Qnil;
|
625
|
+
}
|
626
|
+
|
627
|
+
static VALUE set_span_attribute_string(VALUE self, VALUE key, VALUE value) {
|
628
|
+
appsignal_span_t* span;
|
629
|
+
|
630
|
+
Check_Type(key, T_STRING);
|
631
|
+
Check_Type(value, T_STRING);
|
632
|
+
|
633
|
+
Data_Get_Struct(self, appsignal_span_t, span);
|
634
|
+
|
635
|
+
appsignal_set_span_attribute_string(
|
636
|
+
span,
|
637
|
+
make_appsignal_string(key),
|
638
|
+
make_appsignal_string(value)
|
639
|
+
);
|
640
|
+
|
641
|
+
return Qnil;
|
642
|
+
}
|
643
|
+
|
644
|
+
static VALUE set_span_attribute_int(VALUE self, VALUE key, VALUE value) {
|
645
|
+
appsignal_span_t* span;
|
646
|
+
VALUE value_type = TYPE(value);
|
647
|
+
|
648
|
+
Check_Type(key, T_STRING);
|
649
|
+
|
650
|
+
if (value_type != T_FIXNUM && value_type != T_BIGNUM) {
|
651
|
+
rb_raise(rb_eTypeError, "wrong argument type %s (expected Integer)", rb_obj_classname(value));
|
652
|
+
}
|
653
|
+
|
654
|
+
Data_Get_Struct(self, appsignal_span_t, span);
|
655
|
+
|
656
|
+
appsignal_set_span_attribute_int(
|
657
|
+
span,
|
658
|
+
make_appsignal_string(key),
|
659
|
+
NUM2LONG(value)
|
660
|
+
);
|
661
|
+
|
662
|
+
return Qnil;
|
663
|
+
}
|
664
|
+
|
665
|
+
static VALUE set_span_attribute_bool(VALUE self, VALUE key, VALUE value) {
|
666
|
+
appsignal_span_t* span;
|
667
|
+
|
668
|
+
Check_Type(key, T_STRING);
|
669
|
+
|
670
|
+
Data_Get_Struct(self, appsignal_span_t, span);
|
671
|
+
|
672
|
+
appsignal_set_span_attribute_bool(
|
673
|
+
span,
|
674
|
+
make_appsignal_string(key),
|
675
|
+
RTEST(value)
|
676
|
+
);
|
677
|
+
|
678
|
+
return Qnil;
|
679
|
+
}
|
680
|
+
|
681
|
+
static VALUE set_span_attribute_double(VALUE self, VALUE key, VALUE value) {
|
682
|
+
appsignal_span_t* span;
|
683
|
+
|
684
|
+
Check_Type(key, T_STRING);
|
685
|
+
Check_Type(value, T_FLOAT);
|
686
|
+
|
687
|
+
Data_Get_Struct(self, appsignal_span_t, span);
|
688
|
+
|
689
|
+
appsignal_set_span_attribute_double(
|
690
|
+
span,
|
691
|
+
make_appsignal_string(key),
|
692
|
+
NUM2DBL(value)
|
693
|
+
);
|
694
|
+
|
695
|
+
return Qnil;
|
696
|
+
}
|
697
|
+
|
698
|
+
static VALUE span_to_json(VALUE self) {
|
699
|
+
appsignal_span_t* span;
|
700
|
+
appsignal_string_t json;
|
701
|
+
|
702
|
+
Data_Get_Struct(self, appsignal_span_t, span);
|
703
|
+
|
704
|
+
json = appsignal_span_to_json(span);
|
705
|
+
|
706
|
+
if (json.len == 0) {
|
707
|
+
return Qnil;
|
708
|
+
} else {
|
709
|
+
return make_ruby_string(json);
|
710
|
+
}
|
711
|
+
}
|
712
|
+
|
713
|
+
static VALUE close_span(VALUE self) {
|
714
|
+
appsignal_span_t* span;
|
715
|
+
|
716
|
+
Data_Get_Struct(self, appsignal_span_t, span);
|
717
|
+
|
718
|
+
appsignal_close_span(span);
|
719
|
+
|
720
|
+
return Qnil;
|
721
|
+
}
|
722
|
+
|
548
723
|
static VALUE set_gauge(VALUE self, VALUE key, VALUE value, VALUE tags) {
|
549
724
|
appsignal_data_t* tags_data;
|
550
725
|
|
@@ -652,6 +827,7 @@ void Init_appsignal_extension(void) {
|
|
652
827
|
Extension = rb_define_class_under(Appsignal, "Extension", rb_cObject);
|
653
828
|
Transaction = rb_define_class_under(Extension, "Transaction", rb_cObject);
|
654
829
|
Data = rb_define_class_under(Extension, "Data", rb_cObject);
|
830
|
+
Span = rb_define_class_under(Extension, "Span", rb_cObject);
|
655
831
|
|
656
832
|
// Starting and stopping
|
657
833
|
rb_define_singleton_method(Extension, "start", start, 0);
|
@@ -705,6 +881,31 @@ void Init_appsignal_extension(void) {
|
|
705
881
|
// Get JSON content of a data
|
706
882
|
rb_define_method(Data, "to_s", data_to_s, 0);
|
707
883
|
|
884
|
+
// Create a span
|
885
|
+
rb_define_singleton_method(Span, "root", root_span_new, 1);
|
886
|
+
rb_define_method(Span, "child", child_span_new, 0);
|
887
|
+
|
888
|
+
// Set span error
|
889
|
+
rb_define_method(Span, "add_error", add_span_error, 3);
|
890
|
+
|
891
|
+
// Set span sample data
|
892
|
+
rb_define_method(Span, "set_sample_data", set_span_sample_data, 2);
|
893
|
+
|
894
|
+
// Span name and namespace
|
895
|
+
rb_define_method(Span, "set_name", set_span_name, 1);
|
896
|
+
|
897
|
+
// Set attributes on a span
|
898
|
+
rb_define_method(Span, "set_attribute_string", set_span_attribute_string, 2);
|
899
|
+
rb_define_method(Span, "set_attribute_int", set_span_attribute_int, 2);
|
900
|
+
rb_define_method(Span, "set_attribute_bool", set_span_attribute_bool, 2);
|
901
|
+
rb_define_method(Span, "set_attribute_double", set_span_attribute_double, 2);
|
902
|
+
|
903
|
+
// Span to json
|
904
|
+
rb_define_method(Span, "to_json", span_to_json, 0);
|
905
|
+
|
906
|
+
// Close span
|
907
|
+
rb_define_method(Span, "close", close_span, 0);
|
908
|
+
|
708
909
|
// Other helper methods
|
709
910
|
rb_define_singleton_method(Extension, "install_allocation_event_hook", install_allocation_event_hook, 0);
|
710
911
|
rb_define_singleton_method(Extension, "running_in_container?", running_in_container, 0);
|
data/ext/base.rb
CHANGED
@@ -2,6 +2,7 @@ require "digest"
|
|
2
2
|
require "fileutils"
|
3
3
|
require "open-uri"
|
4
4
|
require "zlib"
|
5
|
+
require "json"
|
5
6
|
require "yaml"
|
6
7
|
require "rubygems/package"
|
7
8
|
require File.expand_path("../../lib/appsignal/version.rb", __FILE__)
|
@@ -60,7 +61,7 @@ end
|
|
60
61
|
|
61
62
|
def write_report
|
62
63
|
File.open(File.join(EXT_PATH, "install.report"), "w") do |file|
|
63
|
-
file.write
|
64
|
+
file.write JSON.generate(report)
|
64
65
|
end
|
65
66
|
end
|
66
67
|
|
@@ -32,20 +32,6 @@ module Appsignal
|
|
32
32
|
|
33
33
|
IO.binread(path, length, offset)
|
34
34
|
end
|
35
|
-
|
36
|
-
def self.parse_yaml(contents)
|
37
|
-
if YAML.respond_to? :safe_load
|
38
|
-
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.6.0")
|
39
|
-
# Use keyword params for Ruby 2.6 and up
|
40
|
-
YAML.safe_load(contents, :permitted_classes => [Time])
|
41
|
-
else
|
42
|
-
YAML.safe_load(contents, [Time])
|
43
|
-
end
|
44
|
-
else
|
45
|
-
# Support for Ruby versions without YAML.safe_load
|
46
|
-
YAML.load(contents) # rubocop:disable Security/YAMLLoad
|
47
|
-
end
|
48
|
-
end
|
49
35
|
end
|
50
36
|
end
|
51
37
|
end
|
@@ -352,8 +352,8 @@ module Appsignal
|
|
352
352
|
def fetch_installation_report
|
353
353
|
path = File.expand_path("../../../../ext/install.report", __FILE__)
|
354
354
|
raw_report = File.read(path)
|
355
|
-
|
356
|
-
rescue StandardError,
|
355
|
+
JSON.parse(raw_report)
|
356
|
+
rescue StandardError, JSON::ParserError => e # rubocop:disable Lint/ShadowedException
|
357
357
|
{
|
358
358
|
"parsing_error" => {
|
359
359
|
"error" => "#{e.class}: #{e}",
|
@@ -411,7 +411,7 @@ module Appsignal
|
|
411
411
|
def print_installation_build_report(report)
|
412
412
|
report = report.fetch("build", {})
|
413
413
|
puts " Build details"
|
414
|
-
puts_format "Install time", report["time"]
|
414
|
+
puts_format "Install time", report["time"], :level => 2
|
415
415
|
puts_format "Architecture", report["architecture"], :level => 2
|
416
416
|
puts_format "Target", report["target"], :level => 2
|
417
417
|
puts_format "Musl override", report["musl_override"], :level => 2
|
@@ -474,7 +474,6 @@ module Appsignal
|
|
474
474
|
:env => config.env_config
|
475
475
|
}
|
476
476
|
}
|
477
|
-
print_environment(config)
|
478
477
|
print_config_options(config)
|
479
478
|
end
|
480
479
|
|
@@ -483,7 +482,7 @@ module Appsignal
|
|
483
482
|
option = :env
|
484
483
|
option_sources = sources_for_option(option)
|
485
484
|
sources_label = config_sources_label(option, option_sources)
|
486
|
-
print "
|
485
|
+
print " environment: #{format_config_option(env)}"
|
487
486
|
|
488
487
|
if env == ""
|
489
488
|
message = " Warning: No environment set, no config loaded!\n" \
|
@@ -497,10 +496,22 @@ module Appsignal
|
|
497
496
|
end
|
498
497
|
|
499
498
|
def print_config_options(config)
|
500
|
-
|
499
|
+
# We add the nullified "environment" key to print it ordered
|
500
|
+
# instead of adding it at the top of the list.
|
501
|
+
ordered_config_options = config
|
502
|
+
.config_hash
|
503
|
+
.merge(:environment => nil)
|
504
|
+
.sort
|
505
|
+
|
506
|
+
ordered_config_options.each do |key, value|
|
501
507
|
option_sources = sources_for_option(key)
|
502
508
|
sources_label = config_sources_label(key, option_sources)
|
503
|
-
|
509
|
+
|
510
|
+
if key == :environment
|
511
|
+
print_environment(config)
|
512
|
+
else
|
513
|
+
puts " #{key}: #{format_config_option(value)}#{sources_label}"
|
514
|
+
end
|
504
515
|
end
|
505
516
|
|
506
517
|
puts "\nRead more about how the diagnose config output is rendered\n"\
|
@@ -566,7 +577,7 @@ module Appsignal
|
|
566
577
|
when "401"
|
567
578
|
["invalid", :red]
|
568
579
|
else
|
569
|
-
["Failed
|
580
|
+
["Failed to validate: status #{status}\n#{error.inspect}", :red]
|
570
581
|
end
|
571
582
|
data[:validation][:push_api_key] = result
|
572
583
|
puts_value "Validating Push API key", colorize(result, color)
|