appsignal 3.1.5 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9c72c3c1f23e52406ea915fe3dd35cf45648c7dd712cebc8cdf908e304be60e
4
- data.tar.gz: 90ddbe20ee5243338aefdfbefbb1989bbe1df5cc57a56a4f277bcfa789086b41
3
+ metadata.gz: cd715e8a61874a51afc35e53277017a58e5a378020fbabeb741bd50d671a2e0c
4
+ data.tar.gz: ab9233cb944b2f35eaf7639a918306ceac42c4de57a337295eeb72d3249043dc
5
5
  SHA512:
6
- metadata.gz: 3f7aaf99cae0ca17beab0064e259c8a2cbe1f95b1bcaabc9a074b3033ead5fc847d714d2e84b0140874ef1efc57c098ad3c46596be87f09ead2a5f2d148d77ea
7
- data.tar.gz: bfe585b6c6ce5f8cc5e470c9a164e6690fc1834e40bb4bd27491f719cbdaf6ebd4b92d1f1ba2bc3001e157f5c35786f12143b29d9908e9ce73d9ca9712c7c5ef
6
+ metadata.gz: 66208a0db24d831de032425ea1b536b33d9b3d6739f908193a6c0366e80c13aec303a5af90b6d214eeb007e3ee3ffbaf002d23493d87cc1d77eacd7d6c7a0bc2
7
+ data.tar.gz: 64477a38482899aed37b742fa3b8d76b9c562edb46973881bb2881a2eaa3d469ea390516d3ab90f02e2675d27df492b0b516d5679feec9690f167d6b6a983c7f
@@ -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
@@ -212,6 +212,7 @@ matrix:
212
212
  - gem: "capistrano2"
213
213
  - gem: "capistrano3"
214
214
  - gem: "grape"
215
+ - gem: "http5"
215
216
  - gem: "padrino"
216
217
  - gem: "psych-3"
217
218
  only:
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: 813a59b
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: c8919a19a28950f726221829ea4d2b3312f1595a5e28ea134f8c41ed0814d7cd
13
+ checksum: 5ff2ec4f16f5089e15188670b2c43866c76ab5db2ac07d72878a9816e63171ca
14
14
  filename: appsignal-x86_64-darwin-all-static.tar.gz
15
15
  dynamic:
16
- checksum: 1c10139bc4df56048a71766b64eba76462ee38d3cc814dc230e0fdb3c7e4fba3
16
+ checksum: c7b1ddd0efbd5fb5c48e7124ab13202c7b5fa2624354db66ebc2673d7196ce31
17
17
  filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
18
18
  universal-darwin:
19
19
  static:
20
- checksum: c8919a19a28950f726221829ea4d2b3312f1595a5e28ea134f8c41ed0814d7cd
20
+ checksum: 5ff2ec4f16f5089e15188670b2c43866c76ab5db2ac07d72878a9816e63171ca
21
21
  filename: appsignal-x86_64-darwin-all-static.tar.gz
22
22
  dynamic:
23
- checksum: 1c10139bc4df56048a71766b64eba76462ee38d3cc814dc230e0fdb3c7e4fba3
23
+ checksum: c7b1ddd0efbd5fb5c48e7124ab13202c7b5fa2624354db66ebc2673d7196ce31
24
24
  filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
25
25
  aarch64-darwin:
26
26
  static:
27
- checksum: 40a38896132f418362af9fb2e9796eb4479e13cc0691b61f0f0b81b77e66ded6
27
+ checksum: 9dfdfd6697b3eeeb80a30356fdc1d03a79b8601f18cedd1b2c1442e512d2ed6a
28
28
  filename: appsignal-aarch64-darwin-all-static.tar.gz
29
29
  dynamic:
30
- checksum: 40ec0c7db246cfc9b8eeebc882b07ba625948f376a53d8e24add7148d0f8c067
30
+ checksum: 1fe7a4e2b9e424ccce17c5c7422c84e29531507f672f6cebdd42a3f74feee0b9
31
31
  filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
32
32
  arm64-darwin:
33
33
  static:
34
- checksum: 40a38896132f418362af9fb2e9796eb4479e13cc0691b61f0f0b81b77e66ded6
34
+ checksum: 9dfdfd6697b3eeeb80a30356fdc1d03a79b8601f18cedd1b2c1442e512d2ed6a
35
35
  filename: appsignal-aarch64-darwin-all-static.tar.gz
36
36
  dynamic:
37
- checksum: 40ec0c7db246cfc9b8eeebc882b07ba625948f376a53d8e24add7148d0f8c067
37
+ checksum: 1fe7a4e2b9e424ccce17c5c7422c84e29531507f672f6cebdd42a3f74feee0b9
38
38
  filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
39
39
  arm-darwin:
40
40
  static:
41
- checksum: 40a38896132f418362af9fb2e9796eb4479e13cc0691b61f0f0b81b77e66ded6
41
+ checksum: 9dfdfd6697b3eeeb80a30356fdc1d03a79b8601f18cedd1b2c1442e512d2ed6a
42
42
  filename: appsignal-aarch64-darwin-all-static.tar.gz
43
43
  dynamic:
44
- checksum: 40ec0c7db246cfc9b8eeebc882b07ba625948f376a53d8e24add7148d0f8c067
44
+ checksum: 1fe7a4e2b9e424ccce17c5c7422c84e29531507f672f6cebdd42a3f74feee0b9
45
45
  filename: appsignal-aarch64-darwin-all-dynamic.tar.gz
46
46
  aarch64-linux:
47
47
  static:
48
- checksum: c73b6e9de849a40290a0d90eaad43ea41a9a0293ba4b8bf99f69965c45c85514
48
+ checksum: 0e5d89aeda1e883c912ff069bb76029a1e3cad69f493865d877ffaffa2b45142
49
49
  filename: appsignal-aarch64-linux-all-static.tar.gz
50
50
  dynamic:
51
- checksum: 90226eefe2e2f66833ca3e31c69ce70763ed57916bd0b5c1809bd99d61ff3429
51
+ checksum: 58b09bf6ca7761a4d68cd9de87a0bb45b3465ace90b62a88d9fe77f629c26d7d
52
52
  filename: appsignal-aarch64-linux-all-dynamic.tar.gz
53
53
  i686-linux:
54
54
  static:
55
- checksum: 6741b9a068dc405b3d6d07953fab7fc876c21b4add1cbb2b4c4c4dfdeca5d387
55
+ checksum: ff3cffb1204afd846ba0bb33c50b03f8ada8305527a5908ccfebed6fdcce0e61
56
56
  filename: appsignal-i686-linux-all-static.tar.gz
57
57
  dynamic:
58
- checksum: 1af902b37af378a06251365fb637f86298380d3627c54f2945a85c1b7f075fda
58
+ checksum: '0895a85c3df276864807f7b2572c96ea8c8cd3cc770b7cf02656c6bd01981b59'
59
59
  filename: appsignal-i686-linux-all-dynamic.tar.gz
60
60
  x86-linux:
61
61
  static:
62
- checksum: 6741b9a068dc405b3d6d07953fab7fc876c21b4add1cbb2b4c4c4dfdeca5d387
62
+ checksum: ff3cffb1204afd846ba0bb33c50b03f8ada8305527a5908ccfebed6fdcce0e61
63
63
  filename: appsignal-i686-linux-all-static.tar.gz
64
64
  dynamic:
65
- checksum: 1af902b37af378a06251365fb637f86298380d3627c54f2945a85c1b7f075fda
65
+ checksum: '0895a85c3df276864807f7b2572c96ea8c8cd3cc770b7cf02656c6bd01981b59'
66
66
  filename: appsignal-i686-linux-all-dynamic.tar.gz
67
67
  x86_64-linux:
68
68
  static:
69
- checksum: 8355b017093db606014023cc617d84d6375d503d7ffa54f62c7b3dc56fb64ead
69
+ checksum: 0b6fe4b343461a1a906fc73edb44bc5b12c75214d21fc81ed26d3eb88588003e
70
70
  filename: appsignal-x86_64-linux-all-static.tar.gz
71
71
  dynamic:
72
- checksum: 7c239a7ffe18cb173120bd67fb96563f4a81f0744bbbb47082f077a38ccbe5f1
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: e9d98ed23b872dbf1e67a081473918cf88c4af775b1caadbfd93deda2635d9f8
76
+ checksum: b3f52d7a7a1f4ae8095dd5b1207270dc1797766820d925aca0d09133983c9163
77
77
  filename: appsignal-x86_64-linux-musl-all-static.tar.gz
78
78
  dynamic:
79
- checksum: 5538172a95dfca1a4cf8e111ba61eab5e9c16314fa902259711cb9e8e0d2f85e
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: 0fb3eacfb8c8bc01c4acc8916327626720de376bcdd95104be71bb11a4ff9215
83
+ checksum: d306c50cc9f1bc8ea3339b4185b2a60a1c27f17d9067a529b1889d74c6c0a8d6
84
84
  filename: appsignal-aarch64-linux-musl-all-static.tar.gz
85
85
  dynamic:
86
- checksum: b87bcedaa2aa886acf3a93ce6e32762a843f3bee1ca7a8f9e0d17ca32f7a7d39
86
+ checksum: e3015e05a807ef5027ea8929a917873bcdaf714138ab5d6d028e3c855b3a61d3
87
87
  filename: appsignal-aarch64-linux-musl-all-dynamic.tar.gz
88
88
  x86_64-freebsd:
89
89
  static:
90
- checksum: b7d3c244b7068213840f5970df2e318d98f7909eb3b2b4ab42441d064ffb19ee
90
+ checksum: 135d2ff898f30b15721eca36569d1a0a5deaaee7b4787937d0888ed49f25019b
91
91
  filename: appsignal-x86_64-freebsd-all-static.tar.gz
92
92
  dynamic:
93
- checksum: 0a739134f11d50318d14f247df1f8cc0f8aec1fbcb70a8bc48d5e1f22dc4aaba
93
+ checksum: 873aea3c808b7de431881f2f4b4dae686b20b309e76e3eefbb71e399ebea5284
94
94
  filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
95
95
  amd64-freebsd:
96
96
  static:
97
- checksum: b7d3c244b7068213840f5970df2e318d98f7909eb3b2b4ab42441d064ffb19ee
97
+ checksum: 135d2ff898f30b15721eca36569d1a0a5deaaee7b4787937d0888ed49f25019b
98
98
  filename: appsignal-x86_64-freebsd-all-static.tar.gz
99
99
  dynamic:
100
- checksum: 0a739134f11d50318d14f247df1f8cc0f8aec1fbcb70a8bc48d5e1f22dc4aaba
100
+ checksum: 873aea3c808b7de431881f2f4b4dae686b20b309e76e3eefbb71e399ebea5284
101
101
  filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
@@ -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);
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'http', '~> 5.0'
4
+
5
+ gemspec :path => '../'
@@ -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
@@ -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"
@@ -19,7 +19,7 @@ module Appsignal
19
19
  ENV["PWD"],
20
20
  env,
21
21
  {},
22
- Logger.new(StringIO.new)
22
+ Appsignal::Utils::IntegrationLogger.new(StringIO.new)
23
23
  ).tap do |c|
24
24
  fetch(:appsignal_config, {}).each do |key, value|
25
25
  c[key] = value
@@ -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
@@ -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
- def seen_keys
11
- @seen_keys ||= Set.new
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
- def warn_once_then_debug(key, message)
15
- if !seen_keys.add?(key).nil?
16
- warn message
17
- else
18
- debug message
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