appsignal 3.0.14-java → 3.0.18-java

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,61 @@
1
1
  # AppSignal for Ruby gem Changelog
2
2
 
3
+ ## 3.0.18
4
+
5
+ ### Added
6
+
7
+ - [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.
8
+
9
+ ## 3.0.17
10
+
11
+ ### Fixed
12
+
13
+ - [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.
14
+
15
+ ## 3.0.16
16
+
17
+ ### Added
18
+
19
+ - [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.
20
+ - [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
21
+ AppSignal's will log and up. The "debug" option will log all "debug", "info", "warning" and
22
+ "error" log messages. The default value is: "info"
23
+
24
+ The allowed values are:
25
+ - error
26
+ - warning
27
+ - info
28
+ - debug
29
+ - [6b2ecca2](https://github.com/appsignal/appsignal-ruby/commit/6b2ecca24603061f1b35800f60b0ee6e9f314998) patch - Clean up index values in error messages from PG index violation errors.
30
+
31
+ ### Changed
32
+
33
+ - [25bde454](https://github.com/appsignal/appsignal-ruby/commit/25bde454f82776f8d2ea1fd4dbb00a73e414076e) patch - Order the config options alphabetically in diagnose report output.
34
+ - [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.
35
+ - [fe226e99](https://github.com/appsignal/appsignal-ruby/commit/fe226e99f262bfa46e7a7630defe2fe90f8a3a13) patch - Standardize diagnose validation failure message. Explain the diagnose request failed and why.
36
+ - [fe226e99](https://github.com/appsignal/appsignal-ruby/commit/fe226e99f262bfa46e7a7630defe2fe90f8a3a13) patch - Bump agent to v-5b63505
37
+
38
+ - Only filter parameters with the `filter_parameters` config option.
39
+ - Only filter session data with the `filter_session_data` config option.
40
+ - [3ad95ea5](https://github.com/appsignal/appsignal-ruby/commit/3ad95ea5dd8a9488d293a652231950bd4a721e6c) patch - Bump agent to v-0db01c2
41
+
42
+ - Add `log_level` config option in extension.
43
+ - Deprecate `debug` and `transaction_debug_mode` option in extension.
44
+
45
+ ### Deprecated
46
+
47
+ - [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"
48
+ config option.
49
+
50
+ ## 3.0.15
51
+
52
+ - [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.
53
+ - [fd6faf16](https://github.com/appsignal/appsignal-ruby/commit/fd6faf16d9feb73c3076c2e1283f6101dc4abf97) patch - Bump agent to 09308fb
54
+
55
+ - Update sql_lexer dependency with support for reversed operators in queries.
56
+ - Add debug level logging to custom metrics in transaction_debug_mode.
57
+ - Add hostname config option to standalone agent.
58
+
3
59
  ## 3.0.14
4
60
 
5
61
  - [c40f6d75](https://github.com/appsignal/appsignal-ruby/commit/c40f6d759e8d516cc47bd55cc83bfcb680fbd1ea) patch - Add minutely probe that collects metrics for :class_serial and :global_constant_state from RubyVM.
data/appsignal.gemspec CHANGED
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  require File.expand_path("../lib/appsignal/version", __FILE__)
4
2
 
5
3
  Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
data/build_matrix.yml CHANGED
@@ -11,7 +11,7 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
11
11
  auto_cancel:
12
12
  running:
13
13
  # Ignore main AND develop branch as we want it to build all workflows
14
- when: "branch != 'main' AND branch != 'develop' AND branch != 'diagnose-testing'"
14
+ when: "branch != 'main' AND branch != 'develop'"
15
15
 
16
16
  global_job_config:
17
17
  env_vars:
@@ -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.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.6
79
+ value: 2.6.9
80
80
  - name: GEMSET
81
81
  value: no_dependencies
82
82
  - name: BUNDLE_GEMFILE
@@ -93,12 +93,8 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
93
93
  task:
94
94
  jobs:
95
95
  - name: Git Lint (Lintje)
96
- env_vars:
97
- - name: LINTJE_VERSION
98
- value: 0.3.0
99
96
  commands:
100
- - script/install_lintje
101
- - $HOME/bin/lintje $SEMAPHORE_GIT_COMMIT_RANGE
97
+ - script/lint_git
102
98
  - name: Integration tests
103
99
  dependencies:
104
100
  - Validation
@@ -115,7 +111,7 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
115
111
  - name: Diagnose
116
112
  env_vars:
117
113
  - name: RUBY_VERSION
118
- value: 2.6.6
114
+ value: 3.0.2
119
115
  - name: LANGUAGE
120
116
  value: ruby
121
117
  commands:
@@ -168,6 +164,7 @@ matrix:
168
164
  - "no_dependencies"
169
165
  - "rails-5.2"
170
166
  - "rails-6.0"
167
+ - "rails-7.0"
171
168
 
172
169
  ruby:
173
170
  - ruby: "2.0.0-p648"
@@ -188,9 +185,10 @@ matrix:
188
185
  gems: "none"
189
186
  - ruby: "2.5.8"
190
187
  gems: "minimal"
191
- - ruby: "2.6.6"
192
- - ruby: "2.7.3"
193
- - ruby: "3.0.1"
188
+ - ruby: "2.6.9"
189
+ - ruby: "2.7.5"
190
+ - ruby: "3.0.3"
191
+ - ruby: "3.1.0"
194
192
  - ruby: "jruby-9.2.19.0"
195
193
  gems: "minimal"
196
194
  env_vars:
@@ -208,28 +206,33 @@ matrix:
208
206
  bundler: "1.17.3"
209
207
  exclude:
210
208
  ruby:
211
- - "2.6.6"
212
- - "2.7.3"
213
- - "3.0.1"
209
+ - "2.6.9"
210
+ - "2.7.5"
211
+ - "3.0.3"
212
+ - "3.1.0"
214
213
  - gem: "rails-4.2"
215
214
  bundler: "1.17.3"
216
215
  exclude:
217
216
  ruby:
218
- - "2.6.6"
219
- - "2.7.3"
220
- - "3.0.1"
217
+ - "2.6.9"
218
+ - "2.7.5"
219
+ - "3.0.3"
220
+ - "3.1.0"
221
221
  - gem: "rails-5.0"
222
222
  exclude:
223
223
  ruby:
224
- - "3.0.1"
224
+ - "3.0.3"
225
+ - "3.1.0"
225
226
  - gem: "rails-5.1"
226
227
  exclude:
227
228
  ruby:
228
- - "3.0.1"
229
+ - "3.0.3"
230
+ - "3.1.0"
229
231
  - gem: "rails-5.2"
230
232
  exclude:
231
233
  ruby:
232
- - "3.0.1"
234
+ - "3.0.3"
235
+ - "3.1.0"
233
236
  - gem: "rails-6.0"
234
237
  exclude:
235
238
  ruby:
@@ -237,16 +240,30 @@ matrix:
237
240
  - "2.2.10"
238
241
  - "2.3.8"
239
242
  - "2.4.10"
243
+ - "3.1.0"
244
+ - gem: "rails-7.0"
245
+ exclude:
246
+ ruby:
247
+ - "2.1.10"
248
+ - "2.2.10"
249
+ - "2.3.8"
250
+ - "2.4.10"
251
+ - "2.5.8"
252
+ - "2.6.9"
253
+ - "3.1.0"
254
+ - "jruby-9.2.19.0"
240
255
  - gem: "resque-1"
241
256
  bundler: "1.17.3"
242
257
  exclude:
243
258
  ruby:
244
- - "3.0.1"
259
+ - "3.0.3"
260
+ - "3.1.0"
245
261
  - gem: "resque-2"
246
262
  - gem: "sequel"
247
263
  - gem: "sequel-435"
248
264
  exclude:
249
265
  ruby:
250
- - "3.0.1"
266
+ - "3.0.3"
267
+ - "3.1.0"
251
268
  - gem: "sinatra"
252
269
  - 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: '7376537'
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: 108f022d9def20cea03aae52f9c07e8f35ef64a2c046edaad01a38966e1e45a7
13
+ checksum: 59bb7f5aea47ccea89b48cc323371fd87609592945ae8692f36063a635970e22
14
14
  filename: appsignal-x86_64-darwin-all-static.tar.gz
15
15
  dynamic:
16
- checksum: da1ed61e3a2b3b0aac3557dfa1d394d3cfaa06dd1c523800b3aa4036f603d6dd
16
+ checksum: ce2d489170fdd84be1467d24e5c13782cf97912b3c7dbaaebe9e074d56e711a2
17
17
  filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
18
18
  universal-darwin:
19
19
  static:
20
- checksum: 108f022d9def20cea03aae52f9c07e8f35ef64a2c046edaad01a38966e1e45a7
20
+ checksum: 59bb7f5aea47ccea89b48cc323371fd87609592945ae8692f36063a635970e22
21
21
  filename: appsignal-x86_64-darwin-all-static.tar.gz
22
22
  dynamic:
23
- checksum: da1ed61e3a2b3b0aac3557dfa1d394d3cfaa06dd1c523800b3aa4036f603d6dd
23
+ checksum: ce2d489170fdd84be1467d24e5c13782cf97912b3c7dbaaebe9e074d56e711a2
24
24
  filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
25
25
  aarch64-darwin:
26
26
  static:
27
- checksum: 0eacd24a3a053f2f80c8c7aeb7fafa9e851588ddbe798de8f40277b77e2819d5
27
+ checksum: aa37596a85d65d46fc5bba25d4d059e98655709e6c44ee39e7c6ba72398ad704
28
28
  filename: appsignal-aarch64-darwin-all-static.tar.gz
29
29
  dynamic:
30
- checksum: ef50dbb8f69ce25bc9d6145df2df71e105c7c48a66b42005f5529d5671b9618e
30
+ checksum: b40026410702c1bb3ac974c9648d464e0551956dc933deff22543f10cca81e46
31
31
  filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
32
32
  arm64-darwin:
33
33
  static:
34
- checksum: 0eacd24a3a053f2f80c8c7aeb7fafa9e851588ddbe798de8f40277b77e2819d5
34
+ checksum: aa37596a85d65d46fc5bba25d4d059e98655709e6c44ee39e7c6ba72398ad704
35
35
  filename: appsignal-aarch64-darwin-all-static.tar.gz
36
36
  dynamic:
37
- checksum: ef50dbb8f69ce25bc9d6145df2df71e105c7c48a66b42005f5529d5671b9618e
37
+ checksum: b40026410702c1bb3ac974c9648d464e0551956dc933deff22543f10cca81e46
38
38
  filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
39
39
  arm-darwin:
40
40
  static:
41
- checksum: 0eacd24a3a053f2f80c8c7aeb7fafa9e851588ddbe798de8f40277b77e2819d5
41
+ checksum: aa37596a85d65d46fc5bba25d4d059e98655709e6c44ee39e7c6ba72398ad704
42
42
  filename: appsignal-aarch64-darwin-all-static.tar.gz
43
43
  dynamic:
44
- checksum: ef50dbb8f69ce25bc9d6145df2df71e105c7c48a66b42005f5529d5671b9618e
44
+ checksum: b40026410702c1bb3ac974c9648d464e0551956dc933deff22543f10cca81e46
45
45
  filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
46
46
  aarch64-linux:
47
47
  static:
48
- checksum: e45c227bf87d855e0a94d3fcb42a96a4140458f796c67865c650ef3ff1275c57
48
+ checksum: 12c5659d5a5d67ee641bdb1c38ef842b7687811fdec1f9edf8e196a2ed596405
49
49
  filename: appsignal-aarch64-linux-all-static.tar.gz
50
50
  dynamic:
51
- checksum: 36468b88d52d5a9bf139bf6bc58ecf1726691b3e5897d531f3ed444a839366e0
51
+ checksum: 8301ab5f64af1c185860314682fbfd89027ea5e4850d8beb222613ca5455358a
52
52
  filename: appsignal-aarch64-linux-all-dynamic.tar.gz
53
53
  i686-linux:
54
54
  static:
55
- checksum: 52a6e693650710f1a8b2b389d4a3dc7194069a4eb507b02b068e05f60b92e790
55
+ checksum: afebd51e26b8d21923a8adcbc8fda7bbd29d4e12573f53895e3a650fcd84ffd5
56
56
  filename: appsignal-i686-linux-all-static.tar.gz
57
57
  dynamic:
58
- checksum: 5365cff91857b87522a524a8e7ba3c19ea2306d4b0b5ea994afd18bdece4e414
58
+ checksum: e0ed425a1d92ad7e9beb83f5b7c896f8606773cc599337a198536a150ba76c51
59
59
  filename: appsignal-i686-linux-all-dynamic.tar.gz
60
60
  x86-linux:
61
61
  static:
62
- checksum: 52a6e693650710f1a8b2b389d4a3dc7194069a4eb507b02b068e05f60b92e790
62
+ checksum: afebd51e26b8d21923a8adcbc8fda7bbd29d4e12573f53895e3a650fcd84ffd5
63
63
  filename: appsignal-i686-linux-all-static.tar.gz
64
64
  dynamic:
65
- checksum: 5365cff91857b87522a524a8e7ba3c19ea2306d4b0b5ea994afd18bdece4e414
65
+ checksum: e0ed425a1d92ad7e9beb83f5b7c896f8606773cc599337a198536a150ba76c51
66
66
  filename: appsignal-i686-linux-all-dynamic.tar.gz
67
67
  x86_64-linux:
68
68
  static:
69
- checksum: 8ee5443ca68a3cbac7b63a079bfd734fffd84dbdeab1b9fae7379d7da544d096
69
+ checksum: 563eb5c9daeec67a760ac236b2848aee4ec0e39dca1368150a6d99844d4d665f
70
70
  filename: appsignal-x86_64-linux-all-static.tar.gz
71
71
  dynamic:
72
- checksum: 46c4597cc9cefea80e0a8105998125308dbdfba52939c5bdd8685cbe7493df99
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: 4e01355da3a638bf1fefda47786323eb76345a49e77afab42d79df8510f52e07
76
+ checksum: 2ecad2b2bdd362d9d871322eac79370d12314e3d32a53c83be17d054e91f188d
77
77
  filename: appsignal-x86_64-linux-musl-all-static.tar.gz
78
78
  dynamic:
79
- checksum: 33d98d3c11670d92ed51df76f30c6024204a2d8d258df5745b50b6319751b377
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: 6ba022dc3c66b3ff53316ef55b4841e329dc84c0c585dcd87314bcd9ffae9aab
83
+ checksum: 2eaa4beeb3322ec3c6007f4a8ec483405f8ade4c372031a068bbedf05da9443d
84
84
  filename: appsignal-x86_64-freebsd-all-static.tar.gz
85
85
  dynamic:
86
- checksum: cdce0bf8a9eb0b8496904594a282c58f6c295b1e7c521ed3e4146ea73fb09b0d
86
+ checksum: 4805995f0b10d4b5183e4a2430af19638372a4f290d95a123a0874b2f3878d8e
87
87
  filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
88
88
  amd64-freebsd:
89
89
  static:
90
- checksum: 6ba022dc3c66b3ff53316ef55b4841e329dc84c0c585dcd87314bcd9ffae9aab
90
+ checksum: 2eaa4beeb3322ec3c6007f4a8ec483405f8ade4c372031a068bbedf05da9443d
91
91
  filename: appsignal-x86_64-freebsd-all-static.tar.gz
92
92
  dynamic:
93
- checksum: cdce0bf8a9eb0b8496904594a282c58f6c295b1e7c521ed3e4146ea73fb09b0d
93
+ checksum: 4805995f0b10d4b5183e4a2430af19638372a4f290d95a123a0874b2f3878d8e
94
94
  filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
@@ -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);
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', '~> 7.0.0'
4
+ gem "sidekiq"
5
+ gem "rake", "> 12.2"
6
+
7
+ gemspec :path => '../'