appsignal 3.0.13-java → 3.0.17-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.semaphore/semaphore.yml +3 -7
- data/CHANGELOG.md +59 -0
- data/build_matrix.yml +3 -7
- data/ext/agent.yml +29 -25
- data/ext/appsignal_extension.c +201 -0
- data/lib/appsignal/cli/diagnose.rb +69 -34
- data/lib/appsignal/config.rb +89 -55
- data/lib/appsignal/extension/jruby.rb +147 -0
- data/lib/appsignal/extension.rb +5 -0
- data/lib/appsignal/hooks/mri.rb +16 -0
- data/lib/appsignal/hooks.rb +1 -0
- data/lib/appsignal/probes/mri.rb +26 -0
- data/lib/appsignal/probes.rb +1 -0
- data/lib/appsignal/span.rb +92 -0
- data/lib/appsignal/transaction.rb +12 -1
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +4 -10
- data/script/{install_lintje → lint_git} +4 -0
- data/spec/lib/appsignal/cli/diagnose_spec.rb +27 -23
- data/spec/lib/appsignal/config_spec.rb +104 -19
- data/spec/lib/appsignal/hooks/mri_spec.rb +23 -0
- data/spec/lib/appsignal/probes/mri_spec.rb +33 -0
- data/spec/lib/appsignal/span_spec.rb +141 -0
- data/spec/lib/appsignal/transaction_spec.rb +25 -0
- data/spec/lib/appsignal_spec.rb +1 -1
- data/spec/support/helpers/dependency_helper.rb +4 -0
- metadata +13 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84c66fc5245b46c64b7a4d031d54d5962b722cddbd70a29fc56629d398192ceb
|
4
|
+
data.tar.gz: '095d567f4576b945245623cdfc3adb5e4d0f13c57be7a346e8839c9cd4dfd917'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3884e316ba9c491956a37059591d6ed67cb2a068346980352d0104ab64b429498145586099470a336e4e6a82cc156fd35414c34729e239eef03a28af4227cfcc
|
7
|
+
data.tar.gz: e8be655962ae38665b68f43ef7255c9638ad36d5be796011e14cde14ef766522489ec3312a16387511b67c990f0e0076f06fd87f3b8f869e83a57a6678677e37
|
data/.semaphore/semaphore.yml
CHANGED
@@ -11,7 +11,7 @@ agent:
|
|
11
11
|
os_image: ubuntu1804
|
12
12
|
auto_cancel:
|
13
13
|
running:
|
14
|
-
when: branch != 'main' AND branch != 'develop'
|
14
|
+
when: branch != 'main' AND branch != 'develop'
|
15
15
|
global_job_config:
|
16
16
|
env_vars:
|
17
17
|
- name: RUNNING_IN_CI
|
@@ -95,12 +95,8 @@ blocks:
|
|
95
95
|
task:
|
96
96
|
jobs:
|
97
97
|
- name: Git Lint (Lintje)
|
98
|
-
env_vars:
|
99
|
-
- name: LINTJE_VERSION
|
100
|
-
value: 0.3.0
|
101
98
|
commands:
|
102
|
-
- script/
|
103
|
-
- "$HOME/bin/lintje $SEMAPHORE_GIT_COMMIT_RANGE"
|
99
|
+
- script/lint_git
|
104
100
|
- name: Integration tests
|
105
101
|
dependencies:
|
106
102
|
- Validation
|
@@ -117,7 +113,7 @@ blocks:
|
|
117
113
|
- name: Diagnose
|
118
114
|
env_vars:
|
119
115
|
- name: RUBY_VERSION
|
120
|
-
value:
|
116
|
+
value: 3.0.2
|
121
117
|
- name: LANGUAGE
|
122
118
|
value: ruby
|
123
119
|
commands:
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,64 @@
|
|
1
1
|
# AppSignal for Ruby gem Changelog
|
2
2
|
|
3
|
+
## 3.0.17
|
4
|
+
|
5
|
+
### Fixed
|
6
|
+
|
7
|
+
- [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.
|
8
|
+
|
9
|
+
## 3.0.16
|
10
|
+
|
11
|
+
### Added
|
12
|
+
|
13
|
+
- [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.
|
14
|
+
- [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
|
15
|
+
AppSignal's will log and up. The "debug" option will log all "debug", "info", "warning" and
|
16
|
+
"error" log messages. The default value is: "info"
|
17
|
+
|
18
|
+
The allowed values are:
|
19
|
+
- error
|
20
|
+
- warning
|
21
|
+
- info
|
22
|
+
- debug
|
23
|
+
- [6b2ecca2](https://github.com/appsignal/appsignal-ruby/commit/6b2ecca24603061f1b35800f60b0ee6e9f314998) patch - Clean up index values in error messages from PG index violation errors.
|
24
|
+
|
25
|
+
### Changed
|
26
|
+
|
27
|
+
- [25bde454](https://github.com/appsignal/appsignal-ruby/commit/25bde454f82776f8d2ea1fd4dbb00a73e414076e) patch - Order the config options alphabetically in diagnose report output.
|
28
|
+
- [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.
|
29
|
+
- [fe226e99](https://github.com/appsignal/appsignal-ruby/commit/fe226e99f262bfa46e7a7630defe2fe90f8a3a13) patch - Standardize diagnose validation failure message. Explain the diagnose request failed and why.
|
30
|
+
- [fe226e99](https://github.com/appsignal/appsignal-ruby/commit/fe226e99f262bfa46e7a7630defe2fe90f8a3a13) patch - Bump agent to v-5b63505
|
31
|
+
|
32
|
+
- Only filter parameters with the `filter_parameters` config option.
|
33
|
+
- Only filter session data with the `filter_session_data` config option.
|
34
|
+
- [3ad95ea5](https://github.com/appsignal/appsignal-ruby/commit/3ad95ea5dd8a9488d293a652231950bd4a721e6c) patch - Bump agent to v-0db01c2
|
35
|
+
|
36
|
+
- Add `log_level` config option in extension.
|
37
|
+
- Deprecate `debug` and `transaction_debug_mode` option in extension.
|
38
|
+
|
39
|
+
### Deprecated
|
40
|
+
|
41
|
+
- [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"
|
42
|
+
config option.
|
43
|
+
|
44
|
+
## 3.0.15
|
45
|
+
|
46
|
+
- [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.
|
47
|
+
- [fd6faf16](https://github.com/appsignal/appsignal-ruby/commit/fd6faf16d9feb73c3076c2e1283f6101dc4abf97) patch - Bump agent to 09308fb
|
48
|
+
|
49
|
+
- Update sql_lexer dependency with support for reversed operators in queries.
|
50
|
+
- Add debug level logging to custom metrics in transaction_debug_mode.
|
51
|
+
- Add hostname config option to standalone agent.
|
52
|
+
|
53
|
+
## 3.0.14
|
54
|
+
|
55
|
+
- [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.
|
56
|
+
- [7c18fb6d](https://github.com/appsignal/appsignal-ruby/commit/7c18fb6db0c72f32adb6803ccde957963977008a) patch - Bump agent to 7376537
|
57
|
+
|
58
|
+
- Support JSON PostgreSQL operator in sql_lexer.
|
59
|
+
- Do not strip comments from SQL queries.
|
60
|
+
- [8d7b80ea](https://github.com/appsignal/appsignal-ruby/commit/8d7b80eafc203c295db037f2547f74a2f217f93f) patch - Add configuration option for the AppSignal agent StatsD server. This is on by default, but you can disable it with `enable_statsd: false`.
|
61
|
+
|
3
62
|
## 3.0.13
|
4
63
|
|
5
64
|
- [5c202185](https://github.com/appsignal/appsignal-ruby/commit/5c20218526e026ab436854508ccfe26ca55e8f15) patch - Bump agent to v-0318770.
|
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'
|
14
|
+
when: "branch != 'main' AND branch != 'develop'"
|
15
15
|
|
16
16
|
global_job_config:
|
17
17
|
env_vars:
|
@@ -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/
|
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:
|
114
|
+
value: 3.0.2
|
119
115
|
- name: LANGUAGE
|
120
116
|
value: ruby
|
121
117
|
commands:
|
data/ext/agent.yml
CHANGED
@@ -1,90 +1,94 @@
|
|
1
|
+
# DO NOT EDIT
|
2
|
+
# This is a generated file by the `rake ship` family of tasks in the
|
3
|
+
# appsignal-agent repository.
|
4
|
+
# Modifications to this file will be overwritten with the next agent release.
|
1
5
|
---
|
2
|
-
version:
|
6
|
+
version: 0db01c2
|
3
7
|
mirrors:
|
4
8
|
- https://appsignal-agent-releases.global.ssl.fastly.net
|
5
9
|
- https://d135dj0rjqvssy.cloudfront.net
|
6
10
|
triples:
|
7
11
|
x86_64-darwin:
|
8
12
|
static:
|
9
|
-
checksum:
|
13
|
+
checksum: 8a7cf35f8c9aa98e7778b720f33b38bfbdedcdedb0047035259ab187517be971
|
10
14
|
filename: appsignal-x86_64-darwin-all-static.tar.gz
|
11
15
|
dynamic:
|
12
|
-
checksum:
|
16
|
+
checksum: 4330f83a44db6f092b3f437d942204e9bf7f7022ae2cc24ade4e7b4137905d03
|
13
17
|
filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
|
14
18
|
universal-darwin:
|
15
19
|
static:
|
16
|
-
checksum:
|
20
|
+
checksum: 8a7cf35f8c9aa98e7778b720f33b38bfbdedcdedb0047035259ab187517be971
|
17
21
|
filename: appsignal-x86_64-darwin-all-static.tar.gz
|
18
22
|
dynamic:
|
19
|
-
checksum:
|
23
|
+
checksum: 4330f83a44db6f092b3f437d942204e9bf7f7022ae2cc24ade4e7b4137905d03
|
20
24
|
filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
|
21
25
|
aarch64-darwin:
|
22
26
|
static:
|
23
|
-
checksum:
|
27
|
+
checksum: a22cd07e656f194dd1921983be6507816b60c79bc0c4623d2cac5c88fda9d407
|
24
28
|
filename: appsignal-aarch64-darwin-all-static.tar.gz
|
25
29
|
dynamic:
|
26
|
-
checksum:
|
30
|
+
checksum: 0535e4506ccd2230dfa59fee5ba00ec6d3a2ff67693bf1b622e7a454fc1a5851
|
27
31
|
filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
|
28
32
|
arm64-darwin:
|
29
33
|
static:
|
30
|
-
checksum:
|
34
|
+
checksum: a22cd07e656f194dd1921983be6507816b60c79bc0c4623d2cac5c88fda9d407
|
31
35
|
filename: appsignal-aarch64-darwin-all-static.tar.gz
|
32
36
|
dynamic:
|
33
|
-
checksum:
|
37
|
+
checksum: 0535e4506ccd2230dfa59fee5ba00ec6d3a2ff67693bf1b622e7a454fc1a5851
|
34
38
|
filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
|
35
39
|
arm-darwin:
|
36
40
|
static:
|
37
|
-
checksum:
|
41
|
+
checksum: a22cd07e656f194dd1921983be6507816b60c79bc0c4623d2cac5c88fda9d407
|
38
42
|
filename: appsignal-aarch64-darwin-all-static.tar.gz
|
39
43
|
dynamic:
|
40
|
-
checksum:
|
44
|
+
checksum: 0535e4506ccd2230dfa59fee5ba00ec6d3a2ff67693bf1b622e7a454fc1a5851
|
41
45
|
filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
|
42
46
|
aarch64-linux:
|
43
47
|
static:
|
44
|
-
checksum:
|
48
|
+
checksum: edf43f1a6b340c0afa07c7b71963def9bb68bd8d62d17cb64a7f7a36f84a4517
|
45
49
|
filename: appsignal-aarch64-linux-all-static.tar.gz
|
46
50
|
dynamic:
|
47
|
-
checksum:
|
51
|
+
checksum: 8390561e1a41e4b8bba8e4f92b9b49f957650eca21d281589143b9c3764f504e
|
48
52
|
filename: appsignal-aarch64-linux-all-dynamic.tar.gz
|
49
53
|
i686-linux:
|
50
54
|
static:
|
51
|
-
checksum:
|
55
|
+
checksum: 4179334f88dc32e00ce62aa196b3e47b4258b12ec48dd3cf722d4f6eeb4dc2c0
|
52
56
|
filename: appsignal-i686-linux-all-static.tar.gz
|
53
57
|
dynamic:
|
54
|
-
checksum:
|
58
|
+
checksum: 7c6bcc88e5d218c1986d1a9f1c9ad728c72e68a440656b2e9228d432ba300f86
|
55
59
|
filename: appsignal-i686-linux-all-dynamic.tar.gz
|
56
60
|
x86-linux:
|
57
61
|
static:
|
58
|
-
checksum:
|
62
|
+
checksum: 4179334f88dc32e00ce62aa196b3e47b4258b12ec48dd3cf722d4f6eeb4dc2c0
|
59
63
|
filename: appsignal-i686-linux-all-static.tar.gz
|
60
64
|
dynamic:
|
61
|
-
checksum:
|
65
|
+
checksum: 7c6bcc88e5d218c1986d1a9f1c9ad728c72e68a440656b2e9228d432ba300f86
|
62
66
|
filename: appsignal-i686-linux-all-dynamic.tar.gz
|
63
67
|
x86_64-linux:
|
64
68
|
static:
|
65
|
-
checksum:
|
69
|
+
checksum: d602823277cac752bdea742d928112cef457bc61ee05b960b316fc052f0cc714
|
66
70
|
filename: appsignal-x86_64-linux-all-static.tar.gz
|
67
71
|
dynamic:
|
68
|
-
checksum:
|
72
|
+
checksum: 2e9e955672dec266b408770638c0503a072410e03526b1eef2170326b083a42f
|
69
73
|
filename: appsignal-x86_64-linux-all-dynamic.tar.gz
|
70
74
|
x86_64-linux-musl:
|
71
75
|
static:
|
72
|
-
checksum:
|
76
|
+
checksum: dfbdff116339b99613fff6ed4092b772e58f0d3e667b7de347b4215fb7ea9d62
|
73
77
|
filename: appsignal-x86_64-linux-musl-all-static.tar.gz
|
74
78
|
dynamic:
|
75
|
-
checksum:
|
79
|
+
checksum: 560835ec657b471d50c765a932385cd0e3b6bdca54d2a5e28b4203e43869cf3d
|
76
80
|
filename: appsignal-x86_64-linux-musl-all-dynamic.tar.gz
|
77
81
|
x86_64-freebsd:
|
78
82
|
static:
|
79
|
-
checksum:
|
83
|
+
checksum: e31a7d89798193857247bd3590a554782fcff64b65d3da86d9c451d3147e961a
|
80
84
|
filename: appsignal-x86_64-freebsd-all-static.tar.gz
|
81
85
|
dynamic:
|
82
|
-
checksum:
|
86
|
+
checksum: e7f007cc385a23977ca93b58439dc720d703b7cc5929ef52a7acd59f74703b92
|
83
87
|
filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
|
84
88
|
amd64-freebsd:
|
85
89
|
static:
|
86
|
-
checksum:
|
90
|
+
checksum: e31a7d89798193857247bd3590a554782fcff64b65d3da86d9c451d3147e961a
|
87
91
|
filename: appsignal-x86_64-freebsd-all-static.tar.gz
|
88
92
|
dynamic:
|
89
|
-
checksum:
|
93
|
+
checksum: e7f007cc385a23977ca93b58439dc720d703b7cc5929ef52a7acd59f74703b92
|
90
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);
|