appsignal 3.1.5-java → 3.2.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.semaphore/semaphore.yml +90 -0
- data/CHANGELOG.md +13 -0
- data/README.md +1 -0
- data/build_matrix.yml +1 -0
- data/ext/agent.yml +27 -27
- data/ext/appsignal_extension.c +22 -0
- data/gemfiles/http5.gemfile +5 -0
- data/lib/appsignal/config.rb +14 -7
- data/lib/appsignal/extension/jruby.rb +14 -0
- data/lib/appsignal/hooks/http.rb +21 -0
- data/lib/appsignal/hooks.rb +1 -0
- data/lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb +1 -1
- data/lib/appsignal/integrations/http.rb +21 -0
- data/lib/appsignal/logger.rb +126 -9
- data/lib/appsignal/probes/sidekiq.rb +46 -5
- data/lib/appsignal/utils/integration_logger.rb +19 -0
- data/lib/appsignal/utils.rb +1 -0
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +4 -4
- data/spec/lib/appsignal/config_spec.rb +16 -0
- data/spec/lib/appsignal/hooks/http_spec.rb +39 -0
- data/spec/lib/appsignal/integrations/http_spec.rb +103 -0
- data/spec/lib/appsignal/logger_spec.rb +84 -15
- data/spec/lib/appsignal/probes/sidekiq_spec.rb +212 -106
- data/spec/lib/appsignal/utils/integration_logger_spec.rb +25 -0
- data/spec/lib/appsignal_spec.rb +4 -4
- data/spec/support/helpers/dependency_helper.rb +4 -0
- data/spec/support/helpers/log_helpers.rb +1 -1
- metadata +13 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6ba59271103947144c9d29a741b03d602449f20e0603e53d775d7a18f7959aaf
|
|
4
|
+
data.tar.gz: ab9233cb944b2f35eaf7639a918306ceac42c4de57a337295eeb72d3249043dc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a7f9e30219e7a1178a13fcc1c3595731a5ebe8734b762f8a10465e644428d9b21482dceff1a984af846f1a947a6444d03450600ba71afd63c4973d177c8629f4
|
|
7
|
+
data.tar.gz: 64477a38482899aed37b742fa3b8d76b9c562edb46973881bb2881a2eaa3d469ea390516d3ab90f02e2675d27df492b0b516d5679feec9690f167d6b6a983c7f
|
data/.semaphore/semaphore.yml
CHANGED
|
@@ -570,6 +570,24 @@ blocks:
|
|
|
570
570
|
value: latest
|
|
571
571
|
commands:
|
|
572
572
|
- "./support/bundler_wrapper exec rake test"
|
|
573
|
+
- name: Ruby 2.6.9 for http5
|
|
574
|
+
env_vars:
|
|
575
|
+
- *2
|
|
576
|
+
- *3
|
|
577
|
+
- *4
|
|
578
|
+
- *5
|
|
579
|
+
- name: RUBY_VERSION
|
|
580
|
+
value: 2.6.9
|
|
581
|
+
- name: GEMSET
|
|
582
|
+
value: http5
|
|
583
|
+
- name: BUNDLE_GEMFILE
|
|
584
|
+
value: gemfiles/http5.gemfile
|
|
585
|
+
- name: _RUBYGEMS_VERSION
|
|
586
|
+
value: latest
|
|
587
|
+
- name: _BUNDLER_VERSION
|
|
588
|
+
value: latest
|
|
589
|
+
commands:
|
|
590
|
+
- "./support/bundler_wrapper exec rake test"
|
|
573
591
|
- name: Ruby 2.6.9 for padrino
|
|
574
592
|
env_vars:
|
|
575
593
|
- *2
|
|
@@ -923,6 +941,24 @@ blocks:
|
|
|
923
941
|
value: latest
|
|
924
942
|
commands:
|
|
925
943
|
- "./support/bundler_wrapper exec rake test"
|
|
944
|
+
- name: Ruby 2.7.5 for http5
|
|
945
|
+
env_vars:
|
|
946
|
+
- *2
|
|
947
|
+
- *3
|
|
948
|
+
- *4
|
|
949
|
+
- *5
|
|
950
|
+
- name: RUBY_VERSION
|
|
951
|
+
value: 2.7.5
|
|
952
|
+
- name: GEMSET
|
|
953
|
+
value: http5
|
|
954
|
+
- name: BUNDLE_GEMFILE
|
|
955
|
+
value: gemfiles/http5.gemfile
|
|
956
|
+
- name: _RUBYGEMS_VERSION
|
|
957
|
+
value: latest
|
|
958
|
+
- name: _BUNDLER_VERSION
|
|
959
|
+
value: latest
|
|
960
|
+
commands:
|
|
961
|
+
- "./support/bundler_wrapper exec rake test"
|
|
926
962
|
- name: Ruby 2.7.5 for padrino
|
|
927
963
|
env_vars:
|
|
928
964
|
- *2
|
|
@@ -1294,6 +1330,24 @@ blocks:
|
|
|
1294
1330
|
value: latest
|
|
1295
1331
|
commands:
|
|
1296
1332
|
- "./support/bundler_wrapper exec rake test"
|
|
1333
|
+
- name: Ruby 3.0.3 for http5
|
|
1334
|
+
env_vars:
|
|
1335
|
+
- *2
|
|
1336
|
+
- *3
|
|
1337
|
+
- *4
|
|
1338
|
+
- *5
|
|
1339
|
+
- name: RUBY_VERSION
|
|
1340
|
+
value: 3.0.3
|
|
1341
|
+
- name: GEMSET
|
|
1342
|
+
value: http5
|
|
1343
|
+
- name: BUNDLE_GEMFILE
|
|
1344
|
+
value: gemfiles/http5.gemfile
|
|
1345
|
+
- name: _RUBYGEMS_VERSION
|
|
1346
|
+
value: latest
|
|
1347
|
+
- name: _BUNDLER_VERSION
|
|
1348
|
+
value: latest
|
|
1349
|
+
commands:
|
|
1350
|
+
- "./support/bundler_wrapper exec rake test"
|
|
1297
1351
|
- name: Ruby 3.0.3 for padrino
|
|
1298
1352
|
env_vars:
|
|
1299
1353
|
- *2
|
|
@@ -1611,6 +1665,24 @@ blocks:
|
|
|
1611
1665
|
value: latest
|
|
1612
1666
|
commands:
|
|
1613
1667
|
- "./support/bundler_wrapper exec rake test"
|
|
1668
|
+
- name: Ruby 3.1.1 for http5
|
|
1669
|
+
env_vars:
|
|
1670
|
+
- *2
|
|
1671
|
+
- *3
|
|
1672
|
+
- *4
|
|
1673
|
+
- *5
|
|
1674
|
+
- name: RUBY_VERSION
|
|
1675
|
+
value: 3.1.1
|
|
1676
|
+
- name: GEMSET
|
|
1677
|
+
value: http5
|
|
1678
|
+
- name: BUNDLE_GEMFILE
|
|
1679
|
+
value: gemfiles/http5.gemfile
|
|
1680
|
+
- name: _RUBYGEMS_VERSION
|
|
1681
|
+
value: latest
|
|
1682
|
+
- name: _BUNDLER_VERSION
|
|
1683
|
+
value: latest
|
|
1684
|
+
commands:
|
|
1685
|
+
- "./support/bundler_wrapper exec rake test"
|
|
1614
1686
|
- name: Ruby 3.1.1 for padrino
|
|
1615
1687
|
env_vars:
|
|
1616
1688
|
- *2
|
|
@@ -1910,6 +1982,24 @@ blocks:
|
|
|
1910
1982
|
value: latest
|
|
1911
1983
|
commands:
|
|
1912
1984
|
- "./support/bundler_wrapper exec rake test"
|
|
1985
|
+
- name: Ruby 3.2.0-preview1 for http5
|
|
1986
|
+
env_vars:
|
|
1987
|
+
- *2
|
|
1988
|
+
- *3
|
|
1989
|
+
- *4
|
|
1990
|
+
- *5
|
|
1991
|
+
- name: RUBY_VERSION
|
|
1992
|
+
value: 3.2.0-preview1
|
|
1993
|
+
- name: GEMSET
|
|
1994
|
+
value: http5
|
|
1995
|
+
- name: BUNDLE_GEMFILE
|
|
1996
|
+
value: gemfiles/http5.gemfile
|
|
1997
|
+
- name: _RUBYGEMS_VERSION
|
|
1998
|
+
value: latest
|
|
1999
|
+
- name: _BUNDLER_VERSION
|
|
2000
|
+
value: latest
|
|
2001
|
+
commands:
|
|
2002
|
+
- "./support/bundler_wrapper exec rake test"
|
|
1913
2003
|
- name: Ruby 3.2.0-preview1 for padrino
|
|
1914
2004
|
env_vars:
|
|
1915
2005
|
- *2
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# AppSignal for Ruby gem Changelog
|
|
2
2
|
|
|
3
|
+
## 3.2.0
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- [199d05c0](https://github.com/appsignal/appsignal-ruby/commit/199d05c0f95be7f2496ddcd05613eb816e9ad4e4) minor - Support the http.rb gem. Any outgoing requests will be tracked as events on the incident event timeline. This instrumentation is activated automatically, but can be disable by setting the `instrumentation_http_rb` option to `false`.
|
|
8
|
+
- [9bcd107d](https://github.com/appsignal/appsignal-ruby/commit/9bcd107de955e557744434fc9f953588a9c7bc49) minor - Support log collection from Ruby apps using the new AppSignal Logging feature. Learn more about [AppSignal's Logging on our docs](https://docs.appsignal.com/logging/platforms/integrations/ruby.html).
|
|
9
|
+
|
|
10
|
+
## 3.1.6
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- [a03b7246](https://github.com/appsignal/appsignal-ruby/commit/a03b72461f5f3b047ca81368cf2bdbeadf078e08) patch - Support Sidekiq 7 in the Sidekiq minutely probe. It will now report metrics to Sidekiq magic dashboard for Sidekiq version 7 and newer.
|
|
15
|
+
|
|
3
16
|
## 3.1.5
|
|
4
17
|
|
|
5
18
|
### Changed
|
data/README.md
CHANGED
|
@@ -232,6 +232,7 @@ configurations you need to run the spec suite with a specific Gemfile.
|
|
|
232
232
|
BUNDLE_GEMFILE=gemfiles/capistrano2.gemfile bundle exec rspec
|
|
233
233
|
BUNDLE_GEMFILE=gemfiles/capistrano3.gemfile bundle exec rspec
|
|
234
234
|
BUNDLE_GEMFILE=gemfiles/grape.gemfile bundle exec rspec
|
|
235
|
+
BUNDLE_GEMFILE=gemfiles/http5.gemfile bundle exec rspec
|
|
235
236
|
BUNDLE_GEMFILE=gemfiles/no_dependencies.gemfile bundle exec rspec
|
|
236
237
|
BUNDLE_GEMFILE=gemfiles/padrino.gemfile bundle exec rspec
|
|
237
238
|
BUNDLE_GEMFILE=gemfiles/que.gemfile bundle exec rspec
|
data/build_matrix.yml
CHANGED
data/ext/agent.yml
CHANGED
|
@@ -3,99 +3,99 @@
|
|
|
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: 9b62288
|
|
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: 5ff2ec4f16f5089e15188670b2c43866c76ab5db2ac07d72878a9816e63171ca
|
|
14
14
|
filename: appsignal-x86_64-darwin-all-static.tar.gz
|
|
15
15
|
dynamic:
|
|
16
|
-
checksum:
|
|
16
|
+
checksum: c7b1ddd0efbd5fb5c48e7124ab13202c7b5fa2624354db66ebc2673d7196ce31
|
|
17
17
|
filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
|
|
18
18
|
universal-darwin:
|
|
19
19
|
static:
|
|
20
|
-
checksum:
|
|
20
|
+
checksum: 5ff2ec4f16f5089e15188670b2c43866c76ab5db2ac07d72878a9816e63171ca
|
|
21
21
|
filename: appsignal-x86_64-darwin-all-static.tar.gz
|
|
22
22
|
dynamic:
|
|
23
|
-
checksum:
|
|
23
|
+
checksum: c7b1ddd0efbd5fb5c48e7124ab13202c7b5fa2624354db66ebc2673d7196ce31
|
|
24
24
|
filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
|
|
25
25
|
aarch64-darwin:
|
|
26
26
|
static:
|
|
27
|
-
checksum:
|
|
27
|
+
checksum: 9dfdfd6697b3eeeb80a30356fdc1d03a79b8601f18cedd1b2c1442e512d2ed6a
|
|
28
28
|
filename: appsignal-aarch64-darwin-all-static.tar.gz
|
|
29
29
|
dynamic:
|
|
30
|
-
checksum:
|
|
30
|
+
checksum: 1fe7a4e2b9e424ccce17c5c7422c84e29531507f672f6cebdd42a3f74feee0b9
|
|
31
31
|
filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
|
|
32
32
|
arm64-darwin:
|
|
33
33
|
static:
|
|
34
|
-
checksum:
|
|
34
|
+
checksum: 9dfdfd6697b3eeeb80a30356fdc1d03a79b8601f18cedd1b2c1442e512d2ed6a
|
|
35
35
|
filename: appsignal-aarch64-darwin-all-static.tar.gz
|
|
36
36
|
dynamic:
|
|
37
|
-
checksum:
|
|
37
|
+
checksum: 1fe7a4e2b9e424ccce17c5c7422c84e29531507f672f6cebdd42a3f74feee0b9
|
|
38
38
|
filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
|
|
39
39
|
arm-darwin:
|
|
40
40
|
static:
|
|
41
|
-
checksum:
|
|
41
|
+
checksum: 9dfdfd6697b3eeeb80a30356fdc1d03a79b8601f18cedd1b2c1442e512d2ed6a
|
|
42
42
|
filename: appsignal-aarch64-darwin-all-static.tar.gz
|
|
43
43
|
dynamic:
|
|
44
|
-
checksum:
|
|
44
|
+
checksum: 1fe7a4e2b9e424ccce17c5c7422c84e29531507f672f6cebdd42a3f74feee0b9
|
|
45
45
|
filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
|
|
46
46
|
aarch64-linux:
|
|
47
47
|
static:
|
|
48
|
-
checksum:
|
|
48
|
+
checksum: 0e5d89aeda1e883c912ff069bb76029a1e3cad69f493865d877ffaffa2b45142
|
|
49
49
|
filename: appsignal-aarch64-linux-all-static.tar.gz
|
|
50
50
|
dynamic:
|
|
51
|
-
checksum:
|
|
51
|
+
checksum: 58b09bf6ca7761a4d68cd9de87a0bb45b3465ace90b62a88d9fe77f629c26d7d
|
|
52
52
|
filename: appsignal-aarch64-linux-all-dynamic.tar.gz
|
|
53
53
|
i686-linux:
|
|
54
54
|
static:
|
|
55
|
-
checksum:
|
|
55
|
+
checksum: ff3cffb1204afd846ba0bb33c50b03f8ada8305527a5908ccfebed6fdcce0e61
|
|
56
56
|
filename: appsignal-i686-linux-all-static.tar.gz
|
|
57
57
|
dynamic:
|
|
58
|
-
checksum:
|
|
58
|
+
checksum: '0895a85c3df276864807f7b2572c96ea8c8cd3cc770b7cf02656c6bd01981b59'
|
|
59
59
|
filename: appsignal-i686-linux-all-dynamic.tar.gz
|
|
60
60
|
x86-linux:
|
|
61
61
|
static:
|
|
62
|
-
checksum:
|
|
62
|
+
checksum: ff3cffb1204afd846ba0bb33c50b03f8ada8305527a5908ccfebed6fdcce0e61
|
|
63
63
|
filename: appsignal-i686-linux-all-static.tar.gz
|
|
64
64
|
dynamic:
|
|
65
|
-
checksum:
|
|
65
|
+
checksum: '0895a85c3df276864807f7b2572c96ea8c8cd3cc770b7cf02656c6bd01981b59'
|
|
66
66
|
filename: appsignal-i686-linux-all-dynamic.tar.gz
|
|
67
67
|
x86_64-linux:
|
|
68
68
|
static:
|
|
69
|
-
checksum:
|
|
69
|
+
checksum: 0b6fe4b343461a1a906fc73edb44bc5b12c75214d21fc81ed26d3eb88588003e
|
|
70
70
|
filename: appsignal-x86_64-linux-all-static.tar.gz
|
|
71
71
|
dynamic:
|
|
72
|
-
checksum:
|
|
72
|
+
checksum: 82117daf3e1c550526f74f4ec66c403bed22aa8600459b749858814589ed688b
|
|
73
73
|
filename: appsignal-x86_64-linux-all-dynamic.tar.gz
|
|
74
74
|
x86_64-linux-musl:
|
|
75
75
|
static:
|
|
76
|
-
checksum:
|
|
76
|
+
checksum: b3f52d7a7a1f4ae8095dd5b1207270dc1797766820d925aca0d09133983c9163
|
|
77
77
|
filename: appsignal-x86_64-linux-musl-all-static.tar.gz
|
|
78
78
|
dynamic:
|
|
79
|
-
checksum:
|
|
79
|
+
checksum: 5de9ddc90fc5beb308eadd5381ac0360692cb32e58dcaf0b0d7ecd3dabf44499
|
|
80
80
|
filename: appsignal-x86_64-linux-musl-all-dynamic.tar.gz
|
|
81
81
|
aarch64-linux-musl:
|
|
82
82
|
static:
|
|
83
|
-
checksum:
|
|
83
|
+
checksum: d306c50cc9f1bc8ea3339b4185b2a60a1c27f17d9067a529b1889d74c6c0a8d6
|
|
84
84
|
filename: appsignal-aarch64-linux-musl-all-static.tar.gz
|
|
85
85
|
dynamic:
|
|
86
|
-
checksum:
|
|
86
|
+
checksum: e3015e05a807ef5027ea8929a917873bcdaf714138ab5d6d028e3c855b3a61d3
|
|
87
87
|
filename: appsignal-aarch64-linux-musl-all-dynamic.tar.gz
|
|
88
88
|
x86_64-freebsd:
|
|
89
89
|
static:
|
|
90
|
-
checksum:
|
|
90
|
+
checksum: 135d2ff898f30b15721eca36569d1a0a5deaaee7b4787937d0888ed49f25019b
|
|
91
91
|
filename: appsignal-x86_64-freebsd-all-static.tar.gz
|
|
92
92
|
dynamic:
|
|
93
|
-
checksum:
|
|
93
|
+
checksum: 873aea3c808b7de431881f2f4b4dae686b20b309e76e3eefbb71e399ebea5284
|
|
94
94
|
filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
|
|
95
95
|
amd64-freebsd:
|
|
96
96
|
static:
|
|
97
|
-
checksum:
|
|
97
|
+
checksum: 135d2ff898f30b15721eca36569d1a0a5deaaee7b4787937d0888ed49f25019b
|
|
98
98
|
filename: appsignal-x86_64-freebsd-all-static.tar.gz
|
|
99
99
|
dynamic:
|
|
100
|
-
checksum:
|
|
100
|
+
checksum: 873aea3c808b7de431881f2f4b4dae686b20b309e76e3eefbb71e399ebea5284
|
|
101
101
|
filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
|
data/ext/appsignal_extension.c
CHANGED
|
@@ -720,6 +720,26 @@ static VALUE close_span(VALUE self) {
|
|
|
720
720
|
return Qnil;
|
|
721
721
|
}
|
|
722
722
|
|
|
723
|
+
static VALUE a_log(VALUE self, VALUE group, VALUE severity, VALUE message, VALUE attributes) {
|
|
724
|
+
appsignal_data_t* attributes_data;
|
|
725
|
+
|
|
726
|
+
Check_Type(group, T_STRING);
|
|
727
|
+
Check_Type(severity, T_FIXNUM);
|
|
728
|
+
Check_Type(message, T_STRING);
|
|
729
|
+
Check_Type(attributes, RUBY_T_DATA);
|
|
730
|
+
|
|
731
|
+
Data_Get_Struct(attributes, appsignal_data_t, attributes_data);
|
|
732
|
+
|
|
733
|
+
appsignal_log(
|
|
734
|
+
make_appsignal_string(group),
|
|
735
|
+
FIX2INT(severity),
|
|
736
|
+
make_appsignal_string(message),
|
|
737
|
+
attributes_data
|
|
738
|
+
);
|
|
739
|
+
|
|
740
|
+
return Qnil;
|
|
741
|
+
}
|
|
742
|
+
|
|
723
743
|
static VALUE set_gauge(VALUE self, VALUE key, VALUE value, VALUE tags) {
|
|
724
744
|
appsignal_data_t* tags_data;
|
|
725
745
|
|
|
@@ -834,6 +854,8 @@ void Init_appsignal_extension(void) {
|
|
|
834
854
|
rb_define_singleton_method(Extension, "stop", stop, 0);
|
|
835
855
|
// Diagnostics
|
|
836
856
|
rb_define_singleton_method(Extension, "diagnose", diagnose, 0);
|
|
857
|
+
// Logging
|
|
858
|
+
rb_define_singleton_method(Extension, "log", a_log, 4);
|
|
837
859
|
|
|
838
860
|
// Server state
|
|
839
861
|
rb_define_singleton_method(Extension, "get_server_state", get_server_state, 1);
|
data/lib/appsignal/config.rb
CHANGED
|
@@ -25,10 +25,12 @@ module Appsignal
|
|
|
25
25
|
:ignore_actions => [],
|
|
26
26
|
:ignore_errors => [],
|
|
27
27
|
:ignore_namespaces => [],
|
|
28
|
+
:instrument_http_rb => true,
|
|
28
29
|
:instrument_net_http => true,
|
|
29
30
|
:instrument_redis => true,
|
|
30
31
|
:instrument_sequel => true,
|
|
31
32
|
:log => "file",
|
|
33
|
+
:logging_endpoint => "https://appsignal-endpoint.net",
|
|
32
34
|
:request_headers => %w[
|
|
33
35
|
HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING
|
|
34
36
|
HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_CONNECTION
|
|
@@ -42,17 +44,17 @@ module Appsignal
|
|
|
42
44
|
}.freeze
|
|
43
45
|
|
|
44
46
|
# @api private
|
|
45
|
-
DEFAULT_LOG_LEVEL = Logger::INFO
|
|
47
|
+
DEFAULT_LOG_LEVEL = ::Logger::INFO
|
|
46
48
|
# Map from the `log_level` config option to Ruby's Logger level value.
|
|
47
49
|
#
|
|
48
50
|
# The trace level doesn't exist in the Ruby logger so it's mapped to debug.
|
|
49
51
|
# @api private
|
|
50
52
|
LOG_LEVEL_MAP = {
|
|
51
|
-
"error" => Logger::ERROR,
|
|
52
|
-
"warn" => Logger::WARN,
|
|
53
|
-
"info" => Logger::INFO,
|
|
54
|
-
"debug" => Logger::DEBUG,
|
|
55
|
-
"trace" => Logger::DEBUG
|
|
53
|
+
"error" => ::Logger::ERROR,
|
|
54
|
+
"warn" => ::Logger::WARN,
|
|
55
|
+
"info" => ::Logger::INFO,
|
|
56
|
+
"debug" => ::Logger::DEBUG,
|
|
57
|
+
"trace" => ::Logger::DEBUG
|
|
56
58
|
}.freeze
|
|
57
59
|
|
|
58
60
|
ENV_TO_KEY_MAPPING = {
|
|
@@ -73,12 +75,14 @@ module Appsignal
|
|
|
73
75
|
"APPSIGNAL_IGNORE_ACTIONS" => :ignore_actions,
|
|
74
76
|
"APPSIGNAL_IGNORE_ERRORS" => :ignore_errors,
|
|
75
77
|
"APPSIGNAL_IGNORE_NAMESPACES" => :ignore_namespaces,
|
|
78
|
+
"APPSIGNAL_INSTRUMENT_HTTP_RB" => :instrument_http_rb,
|
|
76
79
|
"APPSIGNAL_INSTRUMENT_NET_HTTP" => :instrument_net_http,
|
|
77
80
|
"APPSIGNAL_INSTRUMENT_REDIS" => :instrument_redis,
|
|
78
81
|
"APPSIGNAL_INSTRUMENT_SEQUEL" => :instrument_sequel,
|
|
79
82
|
"APPSIGNAL_LOG" => :log,
|
|
80
83
|
"APPSIGNAL_LOG_LEVEL" => :log_level,
|
|
81
84
|
"APPSIGNAL_LOG_PATH" => :log_path,
|
|
85
|
+
"APPSIGNAL_LOGGING_ENDPOINT" => :logging_endpoint,
|
|
82
86
|
"APPSIGNAL_PUSH_API_ENDPOINT" => :endpoint,
|
|
83
87
|
"APPSIGNAL_PUSH_API_KEY" => :push_api_key,
|
|
84
88
|
"APPSIGNAL_REQUEST_HEADERS" => :request_headers,
|
|
@@ -101,6 +105,7 @@ module Appsignal
|
|
|
101
105
|
APPSIGNAL_LOG
|
|
102
106
|
APPSIGNAL_LOG_LEVEL
|
|
103
107
|
APPSIGNAL_LOG_PATH
|
|
108
|
+
APPSIGNAL_LOGGING_ENDPOINT
|
|
104
109
|
APPSIGNAL_PUSH_API_ENDPOINT
|
|
105
110
|
APPSIGNAL_PUSH_API_KEY
|
|
106
111
|
APPSIGNAL_WORKING_DIRECTORY_PATH
|
|
@@ -116,6 +121,7 @@ module Appsignal
|
|
|
116
121
|
APPSIGNAL_ENABLE_MINUTELY_PROBES
|
|
117
122
|
APPSIGNAL_ENABLE_STATSD
|
|
118
123
|
APPSIGNAL_FILES_WORLD_ACCESSIBLE
|
|
124
|
+
APPSIGNAL_INSTRUMENT_HTTP_RB
|
|
119
125
|
APPSIGNAL_INSTRUMENT_NET_HTTP
|
|
120
126
|
APPSIGNAL_INSTRUMENT_REDIS
|
|
121
127
|
APPSIGNAL_INSTRUMENT_SEQUEL
|
|
@@ -260,7 +266,7 @@ module Appsignal
|
|
|
260
266
|
|
|
261
267
|
def log_level
|
|
262
268
|
if config_hash[:debug] || config_hash[:transaction_debug_mode]
|
|
263
|
-
level = Logger::DEBUG
|
|
269
|
+
level = ::Logger::DEBUG
|
|
264
270
|
end
|
|
265
271
|
option = config_hash[:log_level]
|
|
266
272
|
if option
|
|
@@ -320,6 +326,7 @@ module Appsignal
|
|
|
320
326
|
ENV["_APPSIGNAL_LOG"] = config_hash[:log]
|
|
321
327
|
ENV["_APPSIGNAL_LOG_LEVEL"] = config_hash[:log_level]
|
|
322
328
|
ENV["_APPSIGNAL_LOG_FILE_PATH"] = log_file_path.to_s if log_file_path
|
|
329
|
+
ENV["_APPSIGNAL_LOGGING_ENDPOINT"] = config_hash[:logging_endpoint]
|
|
323
330
|
ENV["_APPSIGNAL_PROCESS_NAME"] = $PROGRAM_NAME
|
|
324
331
|
ENV["_APPSIGNAL_PUSH_API_ENDPOINT"] = config_hash[:endpoint]
|
|
325
332
|
ENV["_APPSIGNAL_PUSH_API_KEY"] = config_hash[:push_api_key]
|
|
@@ -81,6 +81,11 @@ module Appsignal
|
|
|
81
81
|
[:appsignal_string, :double, :pointer],
|
|
82
82
|
:void
|
|
83
83
|
|
|
84
|
+
# Logging methods
|
|
85
|
+
attach_function :appsignal_log,
|
|
86
|
+
[:appsignal_string, :int32, :appsignal_string, :pointer],
|
|
87
|
+
:void
|
|
88
|
+
|
|
84
89
|
# Transaction methods
|
|
85
90
|
attach_function :appsignal_free_transaction,
|
|
86
91
|
[:pointer],
|
|
@@ -264,6 +269,15 @@ module Appsignal
|
|
|
264
269
|
make_ruby_string state if state[:len] > 0
|
|
265
270
|
end
|
|
266
271
|
|
|
272
|
+
def log(group, level, message, attributes)
|
|
273
|
+
appsignal_log(
|
|
274
|
+
make_appsignal_string(group),
|
|
275
|
+
level,
|
|
276
|
+
make_appsignal_string(message),
|
|
277
|
+
attributes.pointer
|
|
278
|
+
)
|
|
279
|
+
end
|
|
280
|
+
|
|
267
281
|
def start_transaction(transaction_id, namespace, gc_duration_ms)
|
|
268
282
|
transaction = appsignal_start_transaction(
|
|
269
283
|
make_appsignal_string(transaction_id),
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appsignal
|
|
4
|
+
class Hooks
|
|
5
|
+
# @api private
|
|
6
|
+
class HttpHook < Appsignal::Hooks::Hook
|
|
7
|
+
register :http_rb
|
|
8
|
+
|
|
9
|
+
def dependencies_present?
|
|
10
|
+
defined?(HTTP::Client) && Appsignal.config && Appsignal.config[:instrument_http_rb]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def install
|
|
14
|
+
require "appsignal/integrations/http"
|
|
15
|
+
HTTP::Client.send(:prepend, Appsignal::Integrations::HttpIntegration)
|
|
16
|
+
|
|
17
|
+
Appsignal::Environment.report_enabled("http_rb")
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
data/lib/appsignal/hooks.rb
CHANGED
|
@@ -94,6 +94,7 @@ require "appsignal/hooks/active_job"
|
|
|
94
94
|
require "appsignal/hooks/active_support_notifications"
|
|
95
95
|
require "appsignal/hooks/celluloid"
|
|
96
96
|
require "appsignal/hooks/delayed_job"
|
|
97
|
+
require "appsignal/hooks/http"
|
|
97
98
|
require "appsignal/hooks/mri"
|
|
98
99
|
require "appsignal/hooks/net_http"
|
|
99
100
|
require "appsignal/hooks/passenger"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appsignal
|
|
4
|
+
module Integrations
|
|
5
|
+
module HttpIntegration
|
|
6
|
+
def request(verb, uri, opts = {})
|
|
7
|
+
parsed_request_uri = URI.parse(uri)
|
|
8
|
+
request_uri = "#{parsed_request_uri.scheme}://#{parsed_request_uri.host}"
|
|
9
|
+
|
|
10
|
+
begin
|
|
11
|
+
Appsignal.instrument("request.http_rb", "#{verb.upcase} #{request_uri}") do
|
|
12
|
+
super
|
|
13
|
+
end
|
|
14
|
+
rescue Exception => error # rubocop:disable Lint/RescueException
|
|
15
|
+
Appsignal.set_error(error)
|
|
16
|
+
raise error
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
data/lib/appsignal/logger.rb
CHANGED
|
@@ -3,20 +3,137 @@
|
|
|
3
3
|
require "logger"
|
|
4
4
|
require "set"
|
|
5
5
|
|
|
6
|
-
# Subclass of logger with method to only log a warning once
|
|
7
|
-
# prevents the log from filling up with repeated messages.
|
|
8
6
|
module Appsignal
|
|
7
|
+
# Logger that flushes logs to the AppSignal logging service
|
|
9
8
|
class Logger < ::Logger
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
# Create a new logger instance
|
|
10
|
+
#
|
|
11
|
+
# @param group Name of the group for this logger.
|
|
12
|
+
# @param level Log level to filter with
|
|
13
|
+
# @return [void]
|
|
14
|
+
def initialize(group, level = INFO)
|
|
15
|
+
raise TypeError, "group must be a string" unless group.is_a? String
|
|
16
|
+
@group = group
|
|
17
|
+
@level = level
|
|
12
18
|
end
|
|
13
19
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
# We support the various methods in the Ruby
|
|
21
|
+
# logger class by supplying this method.
|
|
22
|
+
# @api private
|
|
23
|
+
def add(severity, message = nil, group = nil)
|
|
24
|
+
severity ||= UNKNOWN
|
|
25
|
+
return true if severity < level
|
|
26
|
+
group = @group if group.nil?
|
|
27
|
+
if message.nil?
|
|
28
|
+
if block_given?
|
|
29
|
+
message = yield
|
|
30
|
+
else
|
|
31
|
+
message = progname
|
|
32
|
+
group = @group
|
|
33
|
+
end
|
|
19
34
|
end
|
|
35
|
+
return if message.nil?
|
|
36
|
+
severity_number = case severity
|
|
37
|
+
when DEBUG
|
|
38
|
+
2
|
|
39
|
+
when INFO
|
|
40
|
+
3
|
|
41
|
+
when WARN
|
|
42
|
+
5
|
|
43
|
+
when ERROR
|
|
44
|
+
6
|
|
45
|
+
when FATAL
|
|
46
|
+
7
|
|
47
|
+
else
|
|
48
|
+
0
|
|
49
|
+
end
|
|
50
|
+
Appsignal::Extension.log(
|
|
51
|
+
group,
|
|
52
|
+
severity_number,
|
|
53
|
+
message,
|
|
54
|
+
Appsignal::Utils::Data.generate({})
|
|
55
|
+
)
|
|
56
|
+
end
|
|
57
|
+
alias log add
|
|
58
|
+
|
|
59
|
+
# Log a debug level message
|
|
60
|
+
# @param message Mesage to log
|
|
61
|
+
# @param attributes Attributes to tag the log with
|
|
62
|
+
# @return [void]
|
|
63
|
+
def debug(message = nil, attributes = {})
|
|
64
|
+
return if DEBUG < level
|
|
65
|
+
message = yield if message.nil? && block_given?
|
|
66
|
+
return if message.nil?
|
|
67
|
+
Appsignal::Extension.log(
|
|
68
|
+
@group,
|
|
69
|
+
2,
|
|
70
|
+
message,
|
|
71
|
+
Appsignal::Utils::Data.generate(attributes)
|
|
72
|
+
)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Log an info level message
|
|
76
|
+
# @param message Mesage to log
|
|
77
|
+
# @param attributes Attributes to tag the log with
|
|
78
|
+
# @return [void]
|
|
79
|
+
def info(message = nil, attributes = {})
|
|
80
|
+
return if INFO < level
|
|
81
|
+
message = yield if message.nil? && block_given?
|
|
82
|
+
return if message.nil?
|
|
83
|
+
Appsignal::Extension.log(
|
|
84
|
+
@group,
|
|
85
|
+
3,
|
|
86
|
+
message,
|
|
87
|
+
Appsignal::Utils::Data.generate(attributes)
|
|
88
|
+
)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Log a warn level message
|
|
92
|
+
# @param message Mesage to log
|
|
93
|
+
# @param attributes Attributes to tag the log with
|
|
94
|
+
# @return [void]
|
|
95
|
+
def warn(message = nil, attributes = {})
|
|
96
|
+
return if WARN < level
|
|
97
|
+
message = yield if message.nil? && block_given?
|
|
98
|
+
return if message.nil?
|
|
99
|
+
Appsignal::Extension.log(
|
|
100
|
+
@group,
|
|
101
|
+
5,
|
|
102
|
+
message,
|
|
103
|
+
Appsignal::Utils::Data.generate(attributes)
|
|
104
|
+
)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Log an error level message
|
|
108
|
+
# @param message Mesage to log
|
|
109
|
+
# @param attributes Attributes to tag the log with
|
|
110
|
+
# @return [void]
|
|
111
|
+
def error(message = nil, attributes = {})
|
|
112
|
+
return if ERROR < level
|
|
113
|
+
message = yield if message.nil? && block_given?
|
|
114
|
+
return if message.nil?
|
|
115
|
+
Appsignal::Extension.log(
|
|
116
|
+
@group,
|
|
117
|
+
6,
|
|
118
|
+
message,
|
|
119
|
+
Appsignal::Utils::Data.generate(attributes)
|
|
120
|
+
)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Log a fatal level message
|
|
124
|
+
# @param message Mesage to log
|
|
125
|
+
# @param attributes Attributes to tag the log with
|
|
126
|
+
# @return [void]
|
|
127
|
+
def fatal(message = nil, attributes = {})
|
|
128
|
+
return if FATAL < level
|
|
129
|
+
message = yield if message.nil? && block_given?
|
|
130
|
+
return if message.nil?
|
|
131
|
+
Appsignal::Extension.log(
|
|
132
|
+
@group,
|
|
133
|
+
7,
|
|
134
|
+
message,
|
|
135
|
+
Appsignal::Utils::Data.generate(attributes)
|
|
136
|
+
)
|
|
20
137
|
end
|
|
21
138
|
end
|
|
22
139
|
end
|