appsignal 4.3.2 → 4.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -0
- data/build_matrix.yml +12 -11
- data/ext/appsignal_extension.c +88 -71
- data/lib/appsignal/config.rb +4 -0
- data/lib/appsignal/environment.rb +1 -0
- data/lib/appsignal/hooks/ownership.rb +44 -0
- data/lib/appsignal/hooks.rb +1 -0
- data/lib/appsignal/integrations/ownership.rb +51 -0
- data/lib/appsignal/integrations/rake.rb +14 -2
- data/lib/appsignal/transaction.rb +52 -0
- data/lib/appsignal/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0ba9c95d270a611f4b26314db6d6a62a5ffb59e76bd8b797e4f272557ec70d8
|
4
|
+
data.tar.gz: 2318a7c02f13fe76b5d2c9c054eb900f9e3342c4b5e5d8108285b709a3610a74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55b25b22f9a2d60c4973c547bd63aa8de67d6fcb83ac5aa47a63b8c0bf19e368bf09c4f09c1362c7552a133de41321e93957f1ed965973fcd818c0ecce0889fa
|
7
|
+
data.tar.gz: cd0c243ee29a67648b3bb397ae2699b16982395501d43b16821e91a063eec6d6f5f3551e190ad7f7ade12c5b264581aede02e83186f69ceeccf89fc29e509e6f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,40 @@
|
|
1
1
|
# AppSignal for Ruby gem Changelog
|
2
2
|
|
3
|
+
## 4.3.3
|
4
|
+
|
5
|
+
_Published on 2025-01-17._
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
- Add support for the [Ownership](https://github.com/ankane/ownership) gem, which is used to mark different segments of the application as owned by specific teams.
|
10
|
+
|
11
|
+
The AppSignal sample will be tagged with the given owner:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
class OrdersController < ApplicationController
|
15
|
+
owner :logistics
|
16
|
+
# Transactions for requests handled by this controller will be tagged
|
17
|
+
# in AppSignal with the "owner" tag set to "logistics"
|
18
|
+
end
|
19
|
+
```
|
20
|
+
|
21
|
+
If several owners are set within the same transaction, the last owner will take precedence. If an error is reported in the transaction, the owner tag will be set to the owner that was set when the error was raised.
|
22
|
+
|
23
|
+
Set the [`ownership_set_namespace` configuration option](https://docs.appsignal.com/ruby/configuration/options.html#option-ownership_set_namespace) to `true` to also set the AppSignal sample's namespace to the owner. Note that doing so will cause existing performance and error incidents to be re-created with the new namespace.
|
24
|
+
|
25
|
+
Set the [`instrument_ownership` configuration option](https://docs.appsignal.com/ruby/configuration/options.html#option-instrument_ownership) to `false` to disable the integration with the Ownership gem.
|
26
|
+
|
27
|
+
(patch [865b348e](https://github.com/appsignal/appsignal-ruby/commit/865b348e1cf37193e3c31176dad47cbbd5d810bb))
|
28
|
+
|
29
|
+
### Changed
|
30
|
+
|
31
|
+
- Do not report `SystemExit` errors from our Rake integration. (patch [ad4f1a25](https://github.com/appsignal/appsignal-ruby/commit/ad4f1a250f00f1d1997932a3f108b0cf6b99ea43))
|
32
|
+
- Do not report `SignalException` errors from our Rake integration. (patch [7c07a596](https://github.com/appsignal/appsignal-ruby/commit/7c07a59622426ca565c538a0c239270ebbd54f4c))
|
33
|
+
|
34
|
+
### Fixed
|
35
|
+
|
36
|
+
- Fix deprecation warnings when building the AppSignal gem's native extension on Ruby 3.4, by porting the extension to use the TypedData API. (patch [e2d186c9](https://github.com/appsignal/appsignal-ruby/commit/e2d186c9e79a5d03d3692c6ed84ca085e1383031))
|
37
|
+
|
3
38
|
## 4.3.2
|
4
39
|
|
5
40
|
_Published on 2024-12-31._
|
data/build_matrix.yml
CHANGED
@@ -88,7 +88,7 @@ matrix:
|
|
88
88
|
- "rails-8.0"
|
89
89
|
|
90
90
|
ruby:
|
91
|
-
- ruby: "3.4.
|
91
|
+
- ruby: "3.4.1"
|
92
92
|
- ruby: "3.3.4"
|
93
93
|
- ruby: "3.2.5"
|
94
94
|
- ruby: "3.1.6"
|
@@ -103,7 +103,7 @@ matrix:
|
|
103
103
|
- gem: "dry-monitor"
|
104
104
|
only:
|
105
105
|
ruby:
|
106
|
-
- "3.4.
|
106
|
+
- "3.4.1"
|
107
107
|
- "3.3.4"
|
108
108
|
- "3.2.5"
|
109
109
|
- "3.1.6"
|
@@ -112,7 +112,7 @@ matrix:
|
|
112
112
|
- gem: "hanami-2.0"
|
113
113
|
only:
|
114
114
|
ruby:
|
115
|
-
- "3.4.
|
115
|
+
- "3.4.1"
|
116
116
|
- "3.3.4"
|
117
117
|
- "3.2.5"
|
118
118
|
- "3.1.6"
|
@@ -120,7 +120,7 @@ matrix:
|
|
120
120
|
- gem: "hanami-2.1"
|
121
121
|
only:
|
122
122
|
ruby:
|
123
|
-
- "3.4.
|
123
|
+
- "3.4.1"
|
124
124
|
- "3.3.4"
|
125
125
|
- "3.2.5"
|
126
126
|
- "3.1.6"
|
@@ -128,16 +128,17 @@ matrix:
|
|
128
128
|
- gem: "hanami-2.2"
|
129
129
|
only:
|
130
130
|
ruby:
|
131
|
-
- "3.4.
|
131
|
+
- "3.4.1"
|
132
132
|
- "3.3.4"
|
133
133
|
- "3.2.5"
|
134
134
|
- "3.1.6"
|
135
135
|
- gem: "http5"
|
136
|
+
- gem: "ownership"
|
136
137
|
- gem: "padrino"
|
137
138
|
- gem: "psych-3"
|
138
139
|
only:
|
139
140
|
ruby:
|
140
|
-
- "3.4.
|
141
|
+
- "3.4.1"
|
141
142
|
- "3.3.4"
|
142
143
|
- "3.2.5"
|
143
144
|
- "3.1.6"
|
@@ -146,7 +147,7 @@ matrix:
|
|
146
147
|
- gem: "psych-4"
|
147
148
|
only:
|
148
149
|
ruby:
|
149
|
-
- "3.4.
|
150
|
+
- "3.4.1"
|
150
151
|
- "3.3.4"
|
151
152
|
- "3.2.5"
|
152
153
|
- "3.1.6"
|
@@ -172,7 +173,7 @@ matrix:
|
|
172
173
|
- gem: "rails-7.0"
|
173
174
|
only:
|
174
175
|
ruby:
|
175
|
-
- "3.4.
|
176
|
+
- "3.4.1"
|
176
177
|
- "3.3.4"
|
177
178
|
- "3.2.5"
|
178
179
|
- "3.1.6"
|
@@ -182,7 +183,7 @@ matrix:
|
|
182
183
|
- gem: "rails-7.1"
|
183
184
|
only:
|
184
185
|
ruby:
|
185
|
-
- "3.4.
|
186
|
+
- "3.4.1"
|
186
187
|
- "3.3.4"
|
187
188
|
- "3.2.5"
|
188
189
|
- "3.1.6"
|
@@ -191,7 +192,7 @@ matrix:
|
|
191
192
|
- gem: "rails-7.2"
|
192
193
|
only:
|
193
194
|
ruby:
|
194
|
-
- "3.4.
|
195
|
+
- "3.4.1"
|
195
196
|
- "3.3.4"
|
196
197
|
- "3.2.5"
|
197
198
|
- "3.1.6"
|
@@ -199,7 +200,7 @@ matrix:
|
|
199
200
|
- gem: "rails-8.0"
|
200
201
|
only:
|
201
202
|
ruby:
|
202
|
-
- "3.4.
|
203
|
+
- "3.4.1"
|
203
204
|
- "3.3.4"
|
204
205
|
- "3.2.5"
|
205
206
|
- gem: "sequel"
|
data/ext/appsignal_extension.c
CHANGED
@@ -15,6 +15,30 @@ static inline VALUE make_ruby_string(appsignal_string_t string) {
|
|
15
15
|
return str;
|
16
16
|
}
|
17
17
|
|
18
|
+
const rb_data_type_t transaction_data_type = {
|
19
|
+
.wrap_struct_name = "Appsignal::Extension::Transaction",
|
20
|
+
.function = {
|
21
|
+
.dfree = appsignal_free_transaction,
|
22
|
+
},
|
23
|
+
.flags = RUBY_TYPED_FREE_IMMEDIATELY,
|
24
|
+
};
|
25
|
+
|
26
|
+
const rb_data_type_t data_data_type = {
|
27
|
+
.wrap_struct_name = "Appsignal::Extension::Data",
|
28
|
+
.function = {
|
29
|
+
.dfree = appsignal_free_data,
|
30
|
+
},
|
31
|
+
.flags = RUBY_TYPED_FREE_IMMEDIATELY,
|
32
|
+
};
|
33
|
+
|
34
|
+
const rb_data_type_t span_data_type = {
|
35
|
+
.wrap_struct_name = "Appsignal::Extension::Span",
|
36
|
+
.function = {
|
37
|
+
.dfree = appsignal_free_span,
|
38
|
+
},
|
39
|
+
.flags = RUBY_TYPED_FREE_IMMEDIATELY,
|
40
|
+
};
|
41
|
+
|
18
42
|
VALUE Appsignal;
|
19
43
|
VALUE Extension;
|
20
44
|
VALUE Transaction;
|
@@ -64,7 +88,7 @@ static VALUE start_transaction(VALUE self, VALUE transaction_id, VALUE namespace
|
|
64
88
|
);
|
65
89
|
|
66
90
|
if (transaction) {
|
67
|
-
return
|
91
|
+
return TypedData_Wrap_Struct(Transaction, &transaction_data_type, transaction);
|
68
92
|
} else {
|
69
93
|
return Qnil;
|
70
94
|
}
|
@@ -75,7 +99,7 @@ static VALUE start_event(VALUE self, VALUE gc_duration_ms) {
|
|
75
99
|
|
76
100
|
Check_Type(gc_duration_ms, T_FIXNUM);
|
77
101
|
|
78
|
-
|
102
|
+
TypedData_Get_Struct(self, appsignal_transaction_t, &transaction_data_type, transaction);
|
79
103
|
|
80
104
|
appsignal_start_event(transaction, NUM2LONG(gc_duration_ms));
|
81
105
|
|
@@ -91,7 +115,7 @@ static VALUE finish_event(VALUE self, VALUE name, VALUE title, VALUE body, VALUE
|
|
91
115
|
Check_Type(title, T_STRING);
|
92
116
|
Check_Type(body_format, T_FIXNUM);
|
93
117
|
|
94
|
-
|
118
|
+
TypedData_Get_Struct(self, appsignal_transaction_t, &transaction_data_type, transaction);
|
95
119
|
|
96
120
|
body_type = TYPE(body);
|
97
121
|
if (body_type == T_STRING) {
|
@@ -103,8 +127,8 @@ static VALUE finish_event(VALUE self, VALUE name, VALUE title, VALUE body, VALUE
|
|
103
127
|
FIX2INT(body_format),
|
104
128
|
FIX2LONG(gc_duration_ms)
|
105
129
|
);
|
106
|
-
} else if (body_type ==
|
107
|
-
|
130
|
+
} else if (body_type == T_DATA) {
|
131
|
+
TypedData_Get_Struct(body, appsignal_data_t, &data_data_type, body_data);
|
108
132
|
appsignal_finish_event_data(
|
109
133
|
transaction,
|
110
134
|
make_appsignal_string(name),
|
@@ -134,7 +158,7 @@ static VALUE record_event(VALUE self, VALUE name, VALUE title, VALUE body, VALUE
|
|
134
158
|
}
|
135
159
|
Check_Type(body_format, T_FIXNUM);
|
136
160
|
|
137
|
-
|
161
|
+
TypedData_Get_Struct(self, appsignal_transaction_t, &transaction_data_type, transaction);
|
138
162
|
|
139
163
|
body_type = TYPE(body);
|
140
164
|
if (body_type == T_STRING) {
|
@@ -147,8 +171,8 @@ static VALUE record_event(VALUE self, VALUE name, VALUE title, VALUE body, VALUE
|
|
147
171
|
NUM2LONG(duration),
|
148
172
|
NUM2LONG(gc_duration_ms)
|
149
173
|
);
|
150
|
-
} else if (body_type ==
|
151
|
-
|
174
|
+
} else if (body_type == T_DATA) {
|
175
|
+
TypedData_Get_Struct(body, appsignal_data_t, &data_data_type, body_data);
|
152
176
|
appsignal_record_event_data(
|
153
177
|
transaction,
|
154
178
|
make_appsignal_string(name),
|
@@ -171,10 +195,10 @@ static VALUE set_transaction_error(VALUE self, VALUE name, VALUE message, VALUE
|
|
171
195
|
|
172
196
|
Check_Type(name, T_STRING);
|
173
197
|
Check_Type(message, T_STRING);
|
174
|
-
Check_Type(backtrace, RUBY_T_DATA);
|
175
198
|
|
176
|
-
|
177
|
-
|
199
|
+
backtrace_data = rb_check_typeddata(backtrace, &data_data_type);
|
200
|
+
|
201
|
+
TypedData_Get_Struct(self, appsignal_transaction_t, &transaction_data_type, transaction);
|
178
202
|
|
179
203
|
appsignal_set_transaction_error(
|
180
204
|
transaction,
|
@@ -190,10 +214,10 @@ static VALUE set_transaction_sample_data(VALUE self, VALUE key, VALUE payload) {
|
|
190
214
|
appsignal_data_t* payload_data;
|
191
215
|
|
192
216
|
Check_Type(key, T_STRING);
|
193
|
-
Check_Type(payload, RUBY_T_DATA);
|
194
217
|
|
195
|
-
|
196
|
-
|
218
|
+
payload_data = rb_check_typeddata(payload, &data_data_type);
|
219
|
+
|
220
|
+
TypedData_Get_Struct(self, appsignal_transaction_t, &transaction_data_type, transaction);
|
197
221
|
|
198
222
|
appsignal_set_transaction_sample_data(
|
199
223
|
transaction,
|
@@ -207,7 +231,7 @@ static VALUE set_transaction_action(VALUE self, VALUE action) {
|
|
207
231
|
appsignal_transaction_t* transaction;
|
208
232
|
|
209
233
|
Check_Type(action, T_STRING);
|
210
|
-
|
234
|
+
TypedData_Get_Struct(self, appsignal_transaction_t, &transaction_data_type, transaction);
|
211
235
|
|
212
236
|
appsignal_set_transaction_action(
|
213
237
|
transaction,
|
@@ -220,7 +244,7 @@ static VALUE set_transaction_namespace(VALUE self, VALUE namespace) {
|
|
220
244
|
appsignal_transaction_t* transaction;
|
221
245
|
|
222
246
|
Check_Type(namespace, T_STRING);
|
223
|
-
|
247
|
+
TypedData_Get_Struct(self, appsignal_transaction_t, &transaction_data_type, transaction);
|
224
248
|
|
225
249
|
appsignal_set_transaction_namespace(
|
226
250
|
transaction,
|
@@ -238,7 +262,7 @@ static VALUE set_transaction_queue_start(VALUE self, VALUE queue_start) {
|
|
238
262
|
rb_raise(rb_eTypeError, "queue_start should be an Integer");
|
239
263
|
}
|
240
264
|
|
241
|
-
|
265
|
+
TypedData_Get_Struct(self, appsignal_transaction_t, &transaction_data_type, transaction);
|
242
266
|
|
243
267
|
appsignal_set_transaction_queue_start(
|
244
268
|
transaction,
|
@@ -252,7 +276,7 @@ static VALUE set_transaction_metadata(VALUE self, VALUE key, VALUE value) {
|
|
252
276
|
|
253
277
|
Check_Type(key, T_STRING);
|
254
278
|
Check_Type(value, T_STRING);
|
255
|
-
|
279
|
+
TypedData_Get_Struct(self, appsignal_transaction_t, &transaction_data_type, transaction);
|
256
280
|
|
257
281
|
appsignal_set_transaction_metadata(
|
258
282
|
transaction,
|
@@ -267,7 +291,7 @@ static VALUE finish_transaction(VALUE self, VALUE gc_duration_ms) {
|
|
267
291
|
int sample;
|
268
292
|
|
269
293
|
Check_Type(gc_duration_ms, T_FIXNUM);
|
270
|
-
|
294
|
+
TypedData_Get_Struct(self, appsignal_transaction_t, &transaction_data_type, transaction);
|
271
295
|
|
272
296
|
sample = appsignal_finish_transaction(transaction, NUM2LONG(gc_duration_ms));
|
273
297
|
return sample == 1 ? Qtrue : Qfalse;
|
@@ -278,7 +302,7 @@ static VALUE duplicate_transaction(VALUE self, VALUE new_transaction_id) {
|
|
278
302
|
appsignal_transaction_t* duplicate_transaction;
|
279
303
|
|
280
304
|
Check_Type(new_transaction_id, T_STRING);
|
281
|
-
|
305
|
+
TypedData_Get_Struct(self, appsignal_transaction_t, &transaction_data_type, transaction);
|
282
306
|
|
283
307
|
duplicate_transaction = appsignal_duplicate_transaction(
|
284
308
|
transaction,
|
@@ -286,10 +310,9 @@ static VALUE duplicate_transaction(VALUE self, VALUE new_transaction_id) {
|
|
286
310
|
);
|
287
311
|
|
288
312
|
if (duplicate_transaction) {
|
289
|
-
return
|
313
|
+
return TypedData_Wrap_Struct(
|
290
314
|
Transaction,
|
291
|
-
|
292
|
-
appsignal_free_transaction,
|
315
|
+
&transaction_data_type,
|
293
316
|
duplicate_transaction
|
294
317
|
);
|
295
318
|
} else {
|
@@ -300,7 +323,7 @@ static VALUE duplicate_transaction(VALUE self, VALUE new_transaction_id) {
|
|
300
323
|
static VALUE complete_transaction(VALUE self) {
|
301
324
|
appsignal_transaction_t* transaction;
|
302
325
|
|
303
|
-
|
326
|
+
TypedData_Get_Struct(self, appsignal_transaction_t, &transaction_data_type, transaction);
|
304
327
|
|
305
328
|
appsignal_complete_transaction(transaction);
|
306
329
|
return Qnil;
|
@@ -310,7 +333,7 @@ static VALUE transaction_to_json(VALUE self) {
|
|
310
333
|
appsignal_transaction_t* transaction;
|
311
334
|
appsignal_string_t json;
|
312
335
|
|
313
|
-
|
336
|
+
TypedData_Get_Struct(self, appsignal_transaction_t, &transaction_data_type, transaction);
|
314
337
|
|
315
338
|
json = appsignal_transaction_to_json(transaction);
|
316
339
|
|
@@ -327,7 +350,7 @@ static VALUE data_map_new(VALUE self) {
|
|
327
350
|
data = appsignal_data_map_new();
|
328
351
|
|
329
352
|
if (data) {
|
330
|
-
return
|
353
|
+
return TypedData_Wrap_Struct(Data, &data_data_type, data);
|
331
354
|
} else {
|
332
355
|
return Qnil;
|
333
356
|
}
|
@@ -339,7 +362,7 @@ static VALUE data_array_new(VALUE self) {
|
|
339
362
|
data = appsignal_data_array_new();
|
340
363
|
|
341
364
|
if (data) {
|
342
|
-
return
|
365
|
+
return TypedData_Wrap_Struct(Data, &data_data_type, data);
|
343
366
|
} else {
|
344
367
|
return Qnil;
|
345
368
|
}
|
@@ -351,7 +374,7 @@ static VALUE data_set_string(VALUE self, VALUE key, VALUE value) {
|
|
351
374
|
Check_Type(key, T_STRING);
|
352
375
|
Check_Type(value, T_STRING);
|
353
376
|
|
354
|
-
|
377
|
+
TypedData_Get_Struct(self, appsignal_data_t, &data_data_type, data);
|
355
378
|
|
356
379
|
appsignal_data_map_set_string(
|
357
380
|
data,
|
@@ -371,7 +394,7 @@ static VALUE data_set_integer(VALUE self, VALUE key, VALUE value) {
|
|
371
394
|
rb_raise(rb_eTypeError, "wrong argument type %s (expected Integer)", rb_obj_classname(value));
|
372
395
|
}
|
373
396
|
|
374
|
-
|
397
|
+
TypedData_Get_Struct(self, appsignal_data_t, &data_data_type, data);
|
375
398
|
|
376
399
|
appsignal_data_map_set_integer(
|
377
400
|
data,
|
@@ -388,7 +411,7 @@ static VALUE data_set_float(VALUE self, VALUE key, VALUE value) {
|
|
388
411
|
Check_Type(key, T_STRING);
|
389
412
|
Check_Type(value, T_FLOAT);
|
390
413
|
|
391
|
-
|
414
|
+
TypedData_Get_Struct(self, appsignal_data_t, &data_data_type, data);
|
392
415
|
|
393
416
|
appsignal_data_map_set_float(
|
394
417
|
data,
|
@@ -404,7 +427,7 @@ static VALUE data_set_boolean(VALUE self, VALUE key, VALUE value) {
|
|
404
427
|
|
405
428
|
Check_Type(key, T_STRING);
|
406
429
|
|
407
|
-
|
430
|
+
TypedData_Get_Struct(self, appsignal_data_t, &data_data_type, data);
|
408
431
|
|
409
432
|
appsignal_data_map_set_boolean(
|
410
433
|
data,
|
@@ -420,7 +443,7 @@ static VALUE data_set_nil(VALUE self, VALUE key) {
|
|
420
443
|
|
421
444
|
Check_Type(key, T_STRING);
|
422
445
|
|
423
|
-
|
446
|
+
TypedData_Get_Struct(self, appsignal_data_t, &data_data_type, data);
|
424
447
|
|
425
448
|
appsignal_data_map_set_null(
|
426
449
|
data,
|
@@ -435,10 +458,9 @@ static VALUE data_set_data(VALUE self, VALUE key, VALUE value) {
|
|
435
458
|
appsignal_data_t* value_data;
|
436
459
|
|
437
460
|
Check_Type(key, T_STRING);
|
438
|
-
|
461
|
+
value_data = rb_check_typeddata(value, &data_data_type);
|
439
462
|
|
440
|
-
|
441
|
-
Data_Get_Struct(value, appsignal_data_t, value_data);
|
463
|
+
TypedData_Get_Struct(self, appsignal_data_t, &data_data_type, data);
|
442
464
|
|
443
465
|
appsignal_data_map_set_data(
|
444
466
|
data,
|
@@ -454,7 +476,7 @@ static VALUE data_append_string(VALUE self, VALUE value) {
|
|
454
476
|
|
455
477
|
Check_Type(value, T_STRING);
|
456
478
|
|
457
|
-
|
479
|
+
TypedData_Get_Struct(self, appsignal_data_t, &data_data_type, data);
|
458
480
|
|
459
481
|
appsignal_data_array_append_string(
|
460
482
|
data,
|
@@ -472,7 +494,7 @@ static VALUE data_append_integer(VALUE self, VALUE value) {
|
|
472
494
|
rb_raise(rb_eTypeError, "wrong argument type %s (expected Integer)", rb_obj_classname(value));
|
473
495
|
}
|
474
496
|
|
475
|
-
|
497
|
+
TypedData_Get_Struct(self, appsignal_data_t, &data_data_type, data);
|
476
498
|
|
477
499
|
appsignal_data_array_append_integer(
|
478
500
|
data,
|
@@ -487,7 +509,7 @@ static VALUE data_append_float(VALUE self, VALUE value) {
|
|
487
509
|
|
488
510
|
Check_Type(value, T_FLOAT);
|
489
511
|
|
490
|
-
|
512
|
+
TypedData_Get_Struct(self, appsignal_data_t, &data_data_type, data);
|
491
513
|
|
492
514
|
appsignal_data_array_append_float(
|
493
515
|
data,
|
@@ -500,7 +522,7 @@ static VALUE data_append_float(VALUE self, VALUE value) {
|
|
500
522
|
static VALUE data_append_boolean(VALUE self, VALUE value) {
|
501
523
|
appsignal_data_t* data;
|
502
524
|
|
503
|
-
|
525
|
+
TypedData_Get_Struct(self, appsignal_data_t, &data_data_type, data);
|
504
526
|
|
505
527
|
appsignal_data_array_append_boolean(
|
506
528
|
data,
|
@@ -513,7 +535,7 @@ static VALUE data_append_boolean(VALUE self, VALUE value) {
|
|
513
535
|
static VALUE data_append_nil(VALUE self) {
|
514
536
|
appsignal_data_t* data;
|
515
537
|
|
516
|
-
|
538
|
+
TypedData_Get_Struct(self, appsignal_data_t, &data_data_type, data);
|
517
539
|
|
518
540
|
appsignal_data_array_append_null(data);
|
519
541
|
|
@@ -524,10 +546,9 @@ static VALUE data_append_data(VALUE self, VALUE value) {
|
|
524
546
|
appsignal_data_t* data;
|
525
547
|
appsignal_data_t* value_data;
|
526
548
|
|
527
|
-
|
549
|
+
value_data = rb_check_typeddata(value, &data_data_type);
|
528
550
|
|
529
|
-
|
530
|
-
Data_Get_Struct(value, appsignal_data_t, value_data);
|
551
|
+
TypedData_Get_Struct(self, appsignal_data_t, &data_data_type, data);
|
531
552
|
|
532
553
|
appsignal_data_array_append_data(
|
533
554
|
data,
|
@@ -541,12 +562,12 @@ static VALUE data_equal(VALUE self, VALUE other) {
|
|
541
562
|
appsignal_data_t* data;
|
542
563
|
appsignal_data_t* other_data;
|
543
564
|
|
544
|
-
if (TYPE(other) !=
|
565
|
+
if (TYPE(other) != T_DATA) {
|
545
566
|
return Qfalse;
|
546
567
|
}
|
547
568
|
|
548
|
-
|
549
|
-
|
569
|
+
TypedData_Get_Struct(self, appsignal_data_t, &data_data_type, data);
|
570
|
+
TypedData_Get_Struct(other, appsignal_data_t, &data_data_type, other_data);
|
550
571
|
|
551
572
|
if (appsignal_data_equal(data, other_data) == 1) {
|
552
573
|
return Qtrue;
|
@@ -559,7 +580,7 @@ static VALUE data_to_s(VALUE self) {
|
|
559
580
|
appsignal_data_t* data;
|
560
581
|
appsignal_string_t json;
|
561
582
|
|
562
|
-
|
583
|
+
TypedData_Get_Struct(self, appsignal_data_t, &data_data_type, data);
|
563
584
|
|
564
585
|
json = appsignal_data_to_json(data);
|
565
586
|
|
@@ -578,7 +599,7 @@ static VALUE root_span_new(VALUE self, VALUE namespace) {
|
|
578
599
|
span = appsignal_create_root_span(make_appsignal_string(namespace));
|
579
600
|
|
580
601
|
if (span) {
|
581
|
-
return
|
602
|
+
return TypedData_Wrap_Struct(Span, &span_data_type, span);
|
582
603
|
} else {
|
583
604
|
return Qnil;
|
584
605
|
}
|
@@ -588,12 +609,12 @@ static VALUE child_span_new(VALUE self) {
|
|
588
609
|
appsignal_span_t* parent;
|
589
610
|
appsignal_span_t* span;
|
590
611
|
|
591
|
-
|
612
|
+
TypedData_Get_Struct(self, appsignal_span_t, &span_data_type, parent);
|
592
613
|
|
593
614
|
span = appsignal_create_child_span(parent);
|
594
615
|
|
595
616
|
if (span) {
|
596
|
-
return
|
617
|
+
return TypedData_Wrap_Struct(Span, &span_data_type, span);
|
597
618
|
} else {
|
598
619
|
return Qnil;
|
599
620
|
}
|
@@ -604,7 +625,7 @@ static VALUE set_span_name(VALUE self, VALUE name) {
|
|
604
625
|
|
605
626
|
Check_Type(name, T_STRING);
|
606
627
|
|
607
|
-
|
628
|
+
TypedData_Get_Struct(self, appsignal_span_t, &span_data_type, span);
|
608
629
|
|
609
630
|
appsignal_set_span_name(span, make_appsignal_string(name));
|
610
631
|
return Qnil;
|
@@ -616,10 +637,10 @@ static VALUE add_span_error(VALUE self, VALUE name, VALUE message, VALUE backtra
|
|
616
637
|
|
617
638
|
Check_Type(name, T_STRING);
|
618
639
|
Check_Type(message, T_STRING);
|
619
|
-
Check_Type(backtrace, RUBY_T_DATA);
|
620
640
|
|
621
|
-
|
622
|
-
|
641
|
+
backtrace_data = rb_check_typeddata(backtrace, &data_data_type);
|
642
|
+
|
643
|
+
TypedData_Get_Struct(self, appsignal_span_t, &span_data_type, span);
|
623
644
|
|
624
645
|
appsignal_add_span_error(
|
625
646
|
span,
|
@@ -635,10 +656,10 @@ static VALUE set_span_sample_data(VALUE self, VALUE key, VALUE payload) {
|
|
635
656
|
appsignal_data_t* payload_data;
|
636
657
|
|
637
658
|
Check_Type(key, T_STRING);
|
638
|
-
Check_Type(payload, RUBY_T_DATA);
|
639
659
|
|
640
|
-
|
641
|
-
|
660
|
+
payload_data = rb_check_typeddata(payload, &data_data_type);
|
661
|
+
|
662
|
+
TypedData_Get_Struct(self, appsignal_span_t, &span_data_type, span);
|
642
663
|
|
643
664
|
appsignal_set_span_sample_data(
|
644
665
|
span,
|
@@ -654,7 +675,7 @@ static VALUE set_span_attribute_string(VALUE self, VALUE key, VALUE value) {
|
|
654
675
|
Check_Type(key, T_STRING);
|
655
676
|
Check_Type(value, T_STRING);
|
656
677
|
|
657
|
-
|
678
|
+
TypedData_Get_Struct(self, appsignal_span_t, &span_data_type, span);
|
658
679
|
|
659
680
|
appsignal_set_span_attribute_string(
|
660
681
|
span,
|
@@ -675,7 +696,7 @@ static VALUE set_span_attribute_int(VALUE self, VALUE key, VALUE value) {
|
|
675
696
|
rb_raise(rb_eTypeError, "wrong argument type %s (expected Integer)", rb_obj_classname(value));
|
676
697
|
}
|
677
698
|
|
678
|
-
|
699
|
+
TypedData_Get_Struct(self, appsignal_span_t, &span_data_type, span);
|
679
700
|
|
680
701
|
appsignal_set_span_attribute_int(
|
681
702
|
span,
|
@@ -691,7 +712,7 @@ static VALUE set_span_attribute_bool(VALUE self, VALUE key, VALUE value) {
|
|
691
712
|
|
692
713
|
Check_Type(key, T_STRING);
|
693
714
|
|
694
|
-
|
715
|
+
TypedData_Get_Struct(self, appsignal_span_t, &span_data_type, span);
|
695
716
|
|
696
717
|
appsignal_set_span_attribute_bool(
|
697
718
|
span,
|
@@ -708,7 +729,7 @@ static VALUE set_span_attribute_double(VALUE self, VALUE key, VALUE value) {
|
|
708
729
|
Check_Type(key, T_STRING);
|
709
730
|
Check_Type(value, T_FLOAT);
|
710
731
|
|
711
|
-
|
732
|
+
TypedData_Get_Struct(self, appsignal_span_t, &span_data_type, span);
|
712
733
|
|
713
734
|
appsignal_set_span_attribute_double(
|
714
735
|
span,
|
@@ -723,7 +744,7 @@ static VALUE span_to_json(VALUE self) {
|
|
723
744
|
appsignal_span_t* span;
|
724
745
|
appsignal_string_t json;
|
725
746
|
|
726
|
-
|
747
|
+
TypedData_Get_Struct(self, appsignal_span_t, &span_data_type, span);
|
727
748
|
|
728
749
|
json = appsignal_span_to_json(span);
|
729
750
|
|
@@ -737,7 +758,7 @@ static VALUE span_to_json(VALUE self) {
|
|
737
758
|
static VALUE close_span(VALUE self) {
|
738
759
|
appsignal_span_t* span;
|
739
760
|
|
740
|
-
|
761
|
+
TypedData_Get_Struct(self, appsignal_span_t, &span_data_type, span);
|
741
762
|
|
742
763
|
appsignal_close_span(span);
|
743
764
|
|
@@ -751,9 +772,8 @@ static VALUE a_log(VALUE self, VALUE group, VALUE severity, VALUE format, VALUE
|
|
751
772
|
Check_Type(severity, T_FIXNUM);
|
752
773
|
Check_Type(format, T_FIXNUM);
|
753
774
|
Check_Type(message, T_STRING);
|
754
|
-
Check_Type(attributes, RUBY_T_DATA);
|
755
775
|
|
756
|
-
|
776
|
+
attributes_data = rb_check_typeddata(attributes, &data_data_type);
|
757
777
|
|
758
778
|
appsignal_log(
|
759
779
|
make_appsignal_string(group),
|
@@ -771,9 +791,8 @@ static VALUE set_gauge(VALUE self, VALUE key, VALUE value, VALUE tags) {
|
|
771
791
|
|
772
792
|
Check_Type(key, T_STRING);
|
773
793
|
Check_Type(value, T_FLOAT);
|
774
|
-
Check_Type(tags, RUBY_T_DATA);
|
775
794
|
|
776
|
-
|
795
|
+
tags_data = rb_check_typeddata(tags, &data_data_type);
|
777
796
|
|
778
797
|
appsignal_set_gauge(
|
779
798
|
make_appsignal_string(key),
|
@@ -788,9 +807,8 @@ static VALUE increment_counter(VALUE self, VALUE key, VALUE count, VALUE tags) {
|
|
788
807
|
|
789
808
|
Check_Type(key, T_STRING);
|
790
809
|
Check_Type(count, T_FLOAT);
|
791
|
-
Check_Type(tags, RUBY_T_DATA);
|
792
810
|
|
793
|
-
|
811
|
+
tags_data = rb_check_typeddata(tags, &data_data_type);
|
794
812
|
|
795
813
|
appsignal_increment_counter(
|
796
814
|
make_appsignal_string(key),
|
@@ -805,9 +823,8 @@ static VALUE add_distribution_value(VALUE self, VALUE key, VALUE value, VALUE ta
|
|
805
823
|
|
806
824
|
Check_Type(key, T_STRING);
|
807
825
|
Check_Type(value, T_FLOAT);
|
808
|
-
Check_Type(tags, RUBY_T_DATA);
|
809
826
|
|
810
|
-
|
827
|
+
tags_data = rb_check_typeddata(tags, &data_data_type);
|
811
828
|
|
812
829
|
appsignal_add_distribution_value(
|
813
830
|
make_appsignal_string(key),
|
data/lib/appsignal/config.rb
CHANGED
@@ -111,10 +111,12 @@ module Appsignal
|
|
111
111
|
:ignore_namespaces => [],
|
112
112
|
:instrument_http_rb => true,
|
113
113
|
:instrument_net_http => true,
|
114
|
+
:instrument_ownership => true,
|
114
115
|
:instrument_redis => true,
|
115
116
|
:instrument_sequel => true,
|
116
117
|
:log => "file",
|
117
118
|
:logging_endpoint => "https://appsignal-endpoint.net",
|
119
|
+
:ownership_set_namespace => false,
|
118
120
|
:request_headers => %w[
|
119
121
|
HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING
|
120
122
|
HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_CONNECTION
|
@@ -181,8 +183,10 @@ module Appsignal
|
|
181
183
|
:files_world_accessible => "APPSIGNAL_FILES_WORLD_ACCESSIBLE",
|
182
184
|
:instrument_http_rb => "APPSIGNAL_INSTRUMENT_HTTP_RB",
|
183
185
|
:instrument_net_http => "APPSIGNAL_INSTRUMENT_NET_HTTP",
|
186
|
+
:instrument_ownership => "APPSIGNAL_INSTRUMENT_OWNERSHIP",
|
184
187
|
:instrument_redis => "APPSIGNAL_INSTRUMENT_REDIS",
|
185
188
|
:instrument_sequel => "APPSIGNAL_INSTRUMENT_SEQUEL",
|
189
|
+
:ownership_set_namespace => "APPSIGNAL_OWNERSHIP_SET_NAMESPACE",
|
186
190
|
:running_in_container => "APPSIGNAL_RUNNING_IN_CONTAINER",
|
187
191
|
:send_environment_metadata => "APPSIGNAL_SEND_ENVIRONMENT_METADATA",
|
188
192
|
:send_params => "APPSIGNAL_SEND_PARAMS",
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appsignal
|
4
|
+
class Hooks
|
5
|
+
# @api private
|
6
|
+
class OwnershipHook < Appsignal::Hooks::Hook
|
7
|
+
register :ownership
|
8
|
+
|
9
|
+
def dependencies_present?
|
10
|
+
defined?(::Ownership) &&
|
11
|
+
Gem::Version.new(::Ownership::VERSION) >= Gem::Version.new("0.2.0") &&
|
12
|
+
Appsignal.config &&
|
13
|
+
Appsignal.config[:instrument_ownership]
|
14
|
+
end
|
15
|
+
|
16
|
+
def install
|
17
|
+
require "appsignal/integrations/ownership"
|
18
|
+
|
19
|
+
# If a transaction is created in a code context that has an owner,
|
20
|
+
# set the namespace of the transaction to the owner.
|
21
|
+
Appsignal::Transaction.after_create <<
|
22
|
+
Appsignal::Integrations::OwnershipIntegrationHelper.method(:after_create)
|
23
|
+
|
24
|
+
# If an error was reported in a code context that has an owner,
|
25
|
+
# set the namespace of the transaction to the owner.
|
26
|
+
# In some circumstances, this will be more accurate than the last owner
|
27
|
+
# that was set for the transaction, which is what would otherwise be
|
28
|
+
# reported.
|
29
|
+
Appsignal::Transaction.before_complete <<
|
30
|
+
Appsignal::Integrations::OwnershipIntegrationHelper.method(:before_complete)
|
31
|
+
|
32
|
+
# If an owner is set in a code context that has an active transaction,
|
33
|
+
# set the namespace of the transaction to the owner.
|
34
|
+
unless ::Ownership.singleton_class.included_modules.include?(
|
35
|
+
Appsignal::Integrations::OwnershipIntegration
|
36
|
+
)
|
37
|
+
::Ownership.singleton_class.prepend Appsignal::Integrations::OwnershipIntegration
|
38
|
+
end
|
39
|
+
|
40
|
+
Appsignal::Environment.report_enabled("ownership")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/appsignal/hooks.rb
CHANGED
@@ -84,6 +84,7 @@ require "appsignal/hooks/dry_monitor"
|
|
84
84
|
require "appsignal/hooks/http"
|
85
85
|
require "appsignal/hooks/mri"
|
86
86
|
require "appsignal/hooks/net_http"
|
87
|
+
require "appsignal/hooks/ownership"
|
87
88
|
require "appsignal/hooks/passenger"
|
88
89
|
require "appsignal/hooks/puma"
|
89
90
|
require "appsignal/hooks/rake"
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appsignal
|
4
|
+
module Integrations
|
5
|
+
# @api private
|
6
|
+
module OwnershipIntegration
|
7
|
+
# Implement the `around_change` logic by monkey-patching the reader,
|
8
|
+
# instead of by using the `around_change=` writer. This allows customers
|
9
|
+
# to use the `around_change=` writer in their own code without
|
10
|
+
# accidentally overriding AppSignal's instrumentation.
|
11
|
+
def around_change
|
12
|
+
proc do |owner, block|
|
13
|
+
OwnershipIntegrationHelper.set(Appsignal::Transaction.current, owner)
|
14
|
+
|
15
|
+
original = super
|
16
|
+
|
17
|
+
if original
|
18
|
+
original.call(owner, block)
|
19
|
+
else
|
20
|
+
block.call
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
module OwnershipIntegrationHelper
|
27
|
+
class << self
|
28
|
+
def set(transaction, owner)
|
29
|
+
return if owner.nil?
|
30
|
+
|
31
|
+
transaction.add_tags(:owner => owner)
|
32
|
+
transaction.set_namespace(owner) if set_namespace?
|
33
|
+
end
|
34
|
+
|
35
|
+
def after_create(transaction)
|
36
|
+
set(transaction, ::Ownership.owner)
|
37
|
+
end
|
38
|
+
|
39
|
+
def before_complete(transaction, error)
|
40
|
+
set(transaction, error.owner) if error.respond_to?(:owner)
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def set_namespace?
|
46
|
+
Appsignal.config && Appsignal.config[:ownership_set_namespace]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -4,6 +4,16 @@ module Appsignal
|
|
4
4
|
module Integrations
|
5
5
|
# @api private
|
6
6
|
module RakeIntegration
|
7
|
+
IGNORED_ERRORS = [
|
8
|
+
# Normal exits from the application we do not need to report
|
9
|
+
SystemExit,
|
10
|
+
SignalException
|
11
|
+
].freeze
|
12
|
+
|
13
|
+
def self.ignored_error?(error)
|
14
|
+
IGNORED_ERRORS.include?(error.class)
|
15
|
+
end
|
16
|
+
|
7
17
|
def execute(*args)
|
8
18
|
transaction =
|
9
19
|
if Appsignal.config[:enable_rake_performance_instrumentation]
|
@@ -16,8 +26,10 @@ module Appsignal
|
|
16
26
|
end
|
17
27
|
rescue Exception => error # rubocop:disable Lint/RescueException
|
18
28
|
Appsignal::Integrations::RakeIntegrationHelper.register_at_exit_hook
|
19
|
-
|
20
|
-
|
29
|
+
unless RakeIntegration.ignored_error?(error)
|
30
|
+
transaction ||= _appsignal_create_transaction
|
31
|
+
transaction.set_error(error)
|
32
|
+
end
|
21
33
|
raise error
|
22
34
|
ensure
|
23
35
|
if transaction
|
@@ -44,6 +44,40 @@ module Appsignal
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
# @api private
|
48
|
+
# @return [Array<Proc>]
|
49
|
+
# Add a block, if given, to be executed after a transaction is created.
|
50
|
+
# The block will be called with the transaction as an argument.
|
51
|
+
# Returns the array of blocks that will be executed after a transaction
|
52
|
+
# is created.
|
53
|
+
def after_create(&block)
|
54
|
+
@after_create ||= Set.new
|
55
|
+
|
56
|
+
return @after_create if block.nil?
|
57
|
+
|
58
|
+
@after_create << block
|
59
|
+
end
|
60
|
+
|
61
|
+
# @api private
|
62
|
+
# @return [Array<Proc>]
|
63
|
+
# Add a block, if given, to be executed before a transaction is completed.
|
64
|
+
# This happens after duplicating the transaction for each error that was
|
65
|
+
# reported in the transaction -- that is, when a transaction with
|
66
|
+
# several errors is completed, the block will be called once for each
|
67
|
+
# error, with the transaction (either the original one or a duplicate of it)
|
68
|
+
# that has each of the errors set.
|
69
|
+
# The block will be called with the transaction as the first argument,
|
70
|
+
# and the error reported by the transaction, if any, as the second argument.
|
71
|
+
# Returns the array of blocks that will be executed before a transaction is
|
72
|
+
# completed.
|
73
|
+
def before_complete(&block)
|
74
|
+
@before_complete ||= Set.new
|
75
|
+
|
76
|
+
return @before_complete if block.nil?
|
77
|
+
|
78
|
+
@before_complete << block
|
79
|
+
end
|
80
|
+
|
47
81
|
# @api private
|
48
82
|
def set_current_transaction(transaction)
|
49
83
|
Thread.current[:appsignal_transaction] = transaction
|
@@ -137,6 +171,8 @@ module Appsignal
|
|
137
171
|
@namespace,
|
138
172
|
0
|
139
173
|
) || Appsignal::Extension::MockTransaction.new
|
174
|
+
|
175
|
+
run_after_create_hooks
|
140
176
|
end
|
141
177
|
|
142
178
|
# @api private
|
@@ -192,7 +228,11 @@ module Appsignal
|
|
192
228
|
end
|
193
229
|
end
|
194
230
|
end
|
231
|
+
|
232
|
+
run_before_complete_hooks
|
233
|
+
|
195
234
|
sample_data if should_sample
|
235
|
+
|
196
236
|
@ext.complete
|
197
237
|
end
|
198
238
|
|
@@ -596,6 +636,18 @@ module Appsignal
|
|
596
636
|
|
597
637
|
attr_reader :breadcrumbs
|
598
638
|
|
639
|
+
def run_after_create_hooks
|
640
|
+
self.class.after_create.each do |block|
|
641
|
+
block.call(self)
|
642
|
+
end
|
643
|
+
end
|
644
|
+
|
645
|
+
def run_before_complete_hooks
|
646
|
+
self.class.before_complete.each do |block|
|
647
|
+
block.call(self, @error_set)
|
648
|
+
end
|
649
|
+
end
|
650
|
+
|
599
651
|
def _set_error(error)
|
600
652
|
backtrace = cleaned_backtrace(error.backtrace)
|
601
653
|
@ext.set_error(
|
data/lib/appsignal/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appsignal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.3.
|
4
|
+
version: 4.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2025-01-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: logger
|
@@ -210,6 +210,7 @@ files:
|
|
210
210
|
- lib/appsignal/hooks/mongo_ruby_driver.rb
|
211
211
|
- lib/appsignal/hooks/mri.rb
|
212
212
|
- lib/appsignal/hooks/net_http.rb
|
213
|
+
- lib/appsignal/hooks/ownership.rb
|
213
214
|
- lib/appsignal/hooks/passenger.rb
|
214
215
|
- lib/appsignal/hooks/puma.rb
|
215
216
|
- lib/appsignal/hooks/que.rb
|
@@ -234,6 +235,7 @@ files:
|
|
234
235
|
- lib/appsignal/integrations/mongo_ruby_driver.rb
|
235
236
|
- lib/appsignal/integrations/net_http.rb
|
236
237
|
- lib/appsignal/integrations/object.rb
|
238
|
+
- lib/appsignal/integrations/ownership.rb
|
237
239
|
- lib/appsignal/integrations/puma.rb
|
238
240
|
- lib/appsignal/integrations/que.rb
|
239
241
|
- lib/appsignal/integrations/railtie.rb
|