appsignal 3.4.4 → 3.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -1
- data/.semaphore/semaphore.yml +683 -52
- data/CHANGELOG.md +353 -4
- data/README.md +3 -0
- data/Rakefile +4 -2
- data/appsignal.gemspec +1 -1
- data/build_matrix.yml +27 -13
- data/ext/Rakefile +8 -1
- data/ext/agent.rb +27 -27
- data/ext/appsignal_extension.c +0 -24
- data/ext/base.rb +5 -2
- data/gemfiles/dry-monitor.gemfile +5 -0
- data/gemfiles/rails-7.1.gemfile +7 -0
- data/gemfiles/redis-4.gemfile +5 -0
- data/gemfiles/redis-5.gemfile +6 -0
- data/lib/appsignal/auth_check.rb +1 -1
- data/lib/appsignal/cli/diagnose/paths.rb +33 -10
- data/lib/appsignal/cli/diagnose.rb +15 -1
- data/lib/appsignal/config.rb +72 -7
- data/lib/appsignal/demo.rb +1 -1
- data/lib/appsignal/environment.rb +24 -13
- data/lib/appsignal/event_formatter/action_view/render_formatter.rb +1 -1
- data/lib/appsignal/event_formatter/rom/sql_formatter.rb +18 -0
- data/lib/appsignal/event_formatter/sequel/sql_formatter.rb +1 -1
- data/lib/appsignal/event_formatter.rb +2 -2
- data/lib/appsignal/extension/jruby.rb +4 -17
- data/lib/appsignal/extension.rb +1 -1
- data/lib/appsignal/heartbeat.rb +71 -0
- data/lib/appsignal/helpers/instrumentation.rb +10 -10
- data/lib/appsignal/helpers/metrics.rb +15 -13
- data/lib/appsignal/hooks/active_job.rb +9 -1
- data/lib/appsignal/hooks/active_support_notifications.rb +18 -9
- data/lib/appsignal/hooks/dry_monitor.rb +20 -0
- data/lib/appsignal/hooks/redis.rb +1 -0
- data/lib/appsignal/hooks/redis_client.rb +28 -0
- data/lib/appsignal/hooks.rb +4 -2
- data/lib/appsignal/integrations/active_support_notifications.rb +26 -0
- data/lib/appsignal/integrations/dry_monitor.rb +22 -0
- data/lib/appsignal/integrations/hanami.rb +1 -1
- data/lib/appsignal/integrations/padrino.rb +1 -1
- data/lib/appsignal/integrations/railtie.rb +28 -6
- data/lib/appsignal/integrations/redis_client.rb +20 -0
- data/lib/appsignal/integrations/sidekiq.rb +2 -2
- data/lib/appsignal/integrations/sinatra.rb +1 -1
- data/lib/appsignal/logger.rb +7 -5
- data/lib/appsignal/minutely.rb +4 -4
- data/lib/appsignal/probes/gvl.rb +1 -1
- data/lib/appsignal/probes/helpers.rb +1 -1
- data/lib/appsignal/probes/mri.rb +1 -1
- data/lib/appsignal/probes/sidekiq.rb +10 -8
- data/lib/appsignal/rack/generic_instrumentation.rb +1 -1
- data/lib/appsignal/rack/rails_instrumentation.rb +2 -2
- data/lib/appsignal/rack/sinatra_instrumentation.rb +5 -4
- data/lib/appsignal/rack/streaming_listener.rb +1 -1
- data/lib/appsignal/span.rb +2 -2
- data/lib/appsignal/transaction.rb +69 -14
- data/lib/appsignal/utils/deprecation_message.rb +2 -2
- data/lib/appsignal/utils/hash_sanitizer.rb +21 -9
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +38 -31
- data/lib/puma/plugin/appsignal.rb +1 -1
- data/resources/cacert.pem +321 -159
- data/spec/lib/appsignal/capistrano2_spec.rb +2 -2
- data/spec/lib/appsignal/capistrano3_spec.rb +2 -2
- data/spec/lib/appsignal/cli/diagnose/utils_spec.rb +11 -0
- data/spec/lib/appsignal/cli/diagnose_spec.rb +70 -13
- data/spec/lib/appsignal/config_spec.rb +75 -18
- data/spec/lib/appsignal/environment_spec.rb +3 -3
- data/spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb +1 -1
- data/spec/lib/appsignal/event_formatter/rom/sql_formatter_spec.rb +22 -0
- data/spec/lib/appsignal/heartbeat_spec.rb +89 -0
- data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +6 -0
- data/spec/lib/appsignal/hooks/activejob_spec.rb +26 -1
- data/spec/lib/appsignal/hooks/dry_monitor_spec.rb +104 -0
- data/spec/lib/appsignal/hooks/redis_client_spec.rb +238 -0
- data/spec/lib/appsignal/hooks/redis_spec.rb +98 -76
- data/spec/lib/appsignal/hooks/resque_spec.rb +1 -1
- data/spec/lib/appsignal/hooks_spec.rb +5 -5
- data/spec/lib/appsignal/integrations/railtie_spec.rb +128 -59
- data/spec/lib/appsignal/integrations/sidekiq_spec.rb +20 -15
- data/spec/lib/appsignal/integrations/sinatra_spec.rb +2 -2
- data/spec/lib/appsignal/minutely_spec.rb +2 -2
- data/spec/lib/appsignal/probes/sidekiq_spec.rb +29 -6
- data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +1 -1
- data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +163 -71
- data/spec/lib/appsignal/rack/streaming_listener_spec.rb +1 -0
- data/spec/lib/appsignal/transaction_spec.rb +139 -10
- data/spec/lib/appsignal/utils/hash_sanitizer_spec.rb +42 -4
- data/spec/lib/appsignal_spec.rb +63 -61
- data/spec/lib/puma/appsignal_spec.rb +1 -1
- data/spec/spec_helper.rb +7 -7
- data/spec/support/fixtures/projects/valid/config/appsignal.yml +3 -3
- data/spec/support/helpers/config_helpers.rb +6 -2
- data/spec/support/helpers/dependency_helper.rb +13 -1
- data/spec/support/helpers/log_helpers.rb +2 -2
- data/spec/support/helpers/rails_helper.rb +28 -0
- data/spec/support/matchers/have_colorized_text.rb +1 -1
- metadata +19 -5
- data/ext/._appsignal-agent +0 -0
data/ext/agent.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# Modifications to this file will be overwritten with the next agent release.
|
7
7
|
|
8
8
|
APPSIGNAL_AGENT_CONFIG = {
|
9
|
-
"version" => "
|
9
|
+
"version" => "0.35.2",
|
10
10
|
"mirrors" => [
|
11
11
|
"https://appsignal-agent-releases.global.ssl.fastly.net",
|
12
12
|
"https://d135dj0rjqvssy.cloudfront.net"
|
@@ -14,131 +14,131 @@ APPSIGNAL_AGENT_CONFIG = {
|
|
14
14
|
"triples" => {
|
15
15
|
"x86_64-darwin" => {
|
16
16
|
"static" => {
|
17
|
-
"checksum" => "
|
17
|
+
"checksum" => "4a01803fae744971e2da08a325acb88a5f79bf44cbde03456652affb91fa0817",
|
18
18
|
"filename" => "appsignal-x86_64-darwin-all-static.tar.gz"
|
19
19
|
},
|
20
20
|
"dynamic" => {
|
21
|
-
"checksum" => "
|
21
|
+
"checksum" => "843f6bfd798b7ae829c4a169f249a5576f01eb102755e1851f2901d4ddfff1b0",
|
22
22
|
"filename" => "appsignal-x86_64-darwin-all-dynamic.tar.gz"
|
23
23
|
}
|
24
24
|
},
|
25
25
|
"universal-darwin" => {
|
26
26
|
"static" => {
|
27
|
-
"checksum" => "
|
27
|
+
"checksum" => "4a01803fae744971e2da08a325acb88a5f79bf44cbde03456652affb91fa0817",
|
28
28
|
"filename" => "appsignal-x86_64-darwin-all-static.tar.gz"
|
29
29
|
},
|
30
30
|
"dynamic" => {
|
31
|
-
"checksum" => "
|
31
|
+
"checksum" => "843f6bfd798b7ae829c4a169f249a5576f01eb102755e1851f2901d4ddfff1b0",
|
32
32
|
"filename" => "appsignal-x86_64-darwin-all-dynamic.tar.gz"
|
33
33
|
}
|
34
34
|
},
|
35
35
|
"aarch64-darwin" => {
|
36
36
|
"static" => {
|
37
|
-
"checksum" => "
|
37
|
+
"checksum" => "c80fa534a0f34d0056102ed5ec21cb558b714b17dc2a91f62fabdb992acc8a54",
|
38
38
|
"filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
|
39
39
|
},
|
40
40
|
"dynamic" => {
|
41
|
-
"checksum" => "
|
41
|
+
"checksum" => "53139766b4a6459f6db2ef0e9175ab7828652594f32a885fe0d650bdd1748719",
|
42
42
|
"filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
|
43
43
|
}
|
44
44
|
},
|
45
45
|
"arm64-darwin" => {
|
46
46
|
"static" => {
|
47
|
-
"checksum" => "
|
47
|
+
"checksum" => "c80fa534a0f34d0056102ed5ec21cb558b714b17dc2a91f62fabdb992acc8a54",
|
48
48
|
"filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
|
49
49
|
},
|
50
50
|
"dynamic" => {
|
51
|
-
"checksum" => "
|
51
|
+
"checksum" => "53139766b4a6459f6db2ef0e9175ab7828652594f32a885fe0d650bdd1748719",
|
52
52
|
"filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
|
53
53
|
}
|
54
54
|
},
|
55
55
|
"arm-darwin" => {
|
56
56
|
"static" => {
|
57
|
-
"checksum" => "
|
57
|
+
"checksum" => "c80fa534a0f34d0056102ed5ec21cb558b714b17dc2a91f62fabdb992acc8a54",
|
58
58
|
"filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
|
59
59
|
},
|
60
60
|
"dynamic" => {
|
61
|
-
"checksum" => "
|
61
|
+
"checksum" => "53139766b4a6459f6db2ef0e9175ab7828652594f32a885fe0d650bdd1748719",
|
62
62
|
"filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
|
63
63
|
}
|
64
64
|
},
|
65
65
|
"aarch64-linux" => {
|
66
66
|
"static" => {
|
67
|
-
"checksum" => "
|
67
|
+
"checksum" => "71236975f40316d67c2b0e797814d52a49df8c5941375c0aed81c6870d82f299",
|
68
68
|
"filename" => "appsignal-aarch64-linux-all-static.tar.gz"
|
69
69
|
},
|
70
70
|
"dynamic" => {
|
71
|
-
"checksum" => "
|
71
|
+
"checksum" => "b9dffb56bbf0f1fe5538e914c9a0124c10390ce88077351b1e47cb93efbce1e5",
|
72
72
|
"filename" => "appsignal-aarch64-linux-all-dynamic.tar.gz"
|
73
73
|
}
|
74
74
|
},
|
75
75
|
"i686-linux" => {
|
76
76
|
"static" => {
|
77
|
-
"checksum" => "
|
77
|
+
"checksum" => "00ab0d029ede31225b2d134cdfab1e2c75e15e96229ef9e89ac14f51b8329988",
|
78
78
|
"filename" => "appsignal-i686-linux-all-static.tar.gz"
|
79
79
|
},
|
80
80
|
"dynamic" => {
|
81
|
-
"checksum" => "
|
81
|
+
"checksum" => "8a6aba576fc1c9ba419758e49d6d5fc9ffd636f983e160a7595871f09f382e9b",
|
82
82
|
"filename" => "appsignal-i686-linux-all-dynamic.tar.gz"
|
83
83
|
}
|
84
84
|
},
|
85
85
|
"x86-linux" => {
|
86
86
|
"static" => {
|
87
|
-
"checksum" => "
|
87
|
+
"checksum" => "00ab0d029ede31225b2d134cdfab1e2c75e15e96229ef9e89ac14f51b8329988",
|
88
88
|
"filename" => "appsignal-i686-linux-all-static.tar.gz"
|
89
89
|
},
|
90
90
|
"dynamic" => {
|
91
|
-
"checksum" => "
|
91
|
+
"checksum" => "8a6aba576fc1c9ba419758e49d6d5fc9ffd636f983e160a7595871f09f382e9b",
|
92
92
|
"filename" => "appsignal-i686-linux-all-dynamic.tar.gz"
|
93
93
|
}
|
94
94
|
},
|
95
95
|
"x86_64-linux" => {
|
96
96
|
"static" => {
|
97
|
-
"checksum" => "
|
97
|
+
"checksum" => "2e96245f692f47ee8fd12cca92b620baf79845ec920fb19b38612dd1cb051961",
|
98
98
|
"filename" => "appsignal-x86_64-linux-all-static.tar.gz"
|
99
99
|
},
|
100
100
|
"dynamic" => {
|
101
|
-
"checksum" => "
|
101
|
+
"checksum" => "c64e9903bddf0478ab9bbc316ce8ab46c0998173c922312fee527045e91554ad",
|
102
102
|
"filename" => "appsignal-x86_64-linux-all-dynamic.tar.gz"
|
103
103
|
}
|
104
104
|
},
|
105
105
|
"x86_64-linux-musl" => {
|
106
106
|
"static" => {
|
107
|
-
"checksum" => "
|
107
|
+
"checksum" => "a99ebcdf993cd740dc556de9fba6e7ce1c802704c290c4d8b842cb4dc971473a",
|
108
108
|
"filename" => "appsignal-x86_64-linux-musl-all-static.tar.gz"
|
109
109
|
},
|
110
110
|
"dynamic" => {
|
111
|
-
"checksum" => "
|
111
|
+
"checksum" => "bfb583eebc82c2ae22f904a423df5af3cbf899225ffd8a3f96d0158985aa6e7c",
|
112
112
|
"filename" => "appsignal-x86_64-linux-musl-all-dynamic.tar.gz"
|
113
113
|
}
|
114
114
|
},
|
115
115
|
"aarch64-linux-musl" => {
|
116
116
|
"static" => {
|
117
|
-
"checksum" => "
|
117
|
+
"checksum" => "874542de2899dc7ef6d286f1cb719614877651c6cafc9f5ae73d37d1aa0e61da",
|
118
118
|
"filename" => "appsignal-aarch64-linux-musl-all-static.tar.gz"
|
119
119
|
},
|
120
120
|
"dynamic" => {
|
121
|
-
"checksum" => "
|
121
|
+
"checksum" => "02f895487486732bce4cbbed251275a3fc4830a4e890c592f2e95559a5ca11d5",
|
122
122
|
"filename" => "appsignal-aarch64-linux-musl-all-dynamic.tar.gz"
|
123
123
|
}
|
124
124
|
},
|
125
125
|
"x86_64-freebsd" => {
|
126
126
|
"static" => {
|
127
|
-
"checksum" => "
|
127
|
+
"checksum" => "f30c529ed4fffe4f0668bcb59881061b22050813d9d10acf5a4bf03f4547a51b",
|
128
128
|
"filename" => "appsignal-x86_64-freebsd-all-static.tar.gz"
|
129
129
|
},
|
130
130
|
"dynamic" => {
|
131
|
-
"checksum" => "
|
131
|
+
"checksum" => "da6f4e31097ab2315b5bbffa8752284e40b535f4900057dc273a7bc7a23ac1ac",
|
132
132
|
"filename" => "appsignal-x86_64-freebsd-all-dynamic.tar.gz"
|
133
133
|
}
|
134
134
|
},
|
135
135
|
"amd64-freebsd" => {
|
136
136
|
"static" => {
|
137
|
-
"checksum" => "
|
137
|
+
"checksum" => "f30c529ed4fffe4f0668bcb59881061b22050813d9d10acf5a4bf03f4547a51b",
|
138
138
|
"filename" => "appsignal-x86_64-freebsd-all-static.tar.gz"
|
139
139
|
},
|
140
140
|
"dynamic" => {
|
141
|
-
"checksum" => "
|
141
|
+
"checksum" => "da6f4e31097ab2315b5bbffa8752284e40b535f4900057dc273a7bc7a23ac1ac",
|
142
142
|
"filename" => "appsignal-x86_64-freebsd-all-dynamic.tar.gz"
|
143
143
|
}
|
144
144
|
}
|
data/ext/appsignal_extension.c
CHANGED
@@ -759,28 +759,6 @@ static VALUE set_gauge(VALUE self, VALUE key, VALUE value, VALUE tags) {
|
|
759
759
|
return Qnil;
|
760
760
|
}
|
761
761
|
|
762
|
-
static VALUE set_host_gauge(VALUE self, VALUE key, VALUE value) {
|
763
|
-
Check_Type(key, T_STRING);
|
764
|
-
Check_Type(value, T_FLOAT);
|
765
|
-
|
766
|
-
appsignal_set_host_gauge(
|
767
|
-
make_appsignal_string(key),
|
768
|
-
NUM2DBL(value)
|
769
|
-
);
|
770
|
-
return Qnil;
|
771
|
-
}
|
772
|
-
|
773
|
-
static VALUE set_process_gauge(VALUE self, VALUE key, VALUE value) {
|
774
|
-
Check_Type(key, T_STRING);
|
775
|
-
Check_Type(value, T_FLOAT);
|
776
|
-
|
777
|
-
appsignal_set_process_gauge(
|
778
|
-
make_appsignal_string(key),
|
779
|
-
NUM2DBL(value)
|
780
|
-
);
|
781
|
-
return Qnil;
|
782
|
-
}
|
783
|
-
|
784
762
|
static VALUE increment_counter(VALUE self, VALUE key, VALUE count, VALUE tags) {
|
785
763
|
appsignal_data_t* tags_data;
|
786
764
|
|
@@ -941,8 +919,6 @@ void Init_appsignal_extension(void) {
|
|
941
919
|
|
942
920
|
// Metrics
|
943
921
|
rb_define_singleton_method(Extension, "set_gauge", set_gauge, 3);
|
944
|
-
rb_define_singleton_method(Extension, "set_host_gauge", set_host_gauge, 2);
|
945
|
-
rb_define_singleton_method(Extension, "set_process_gauge", set_process_gauge, 2);
|
946
922
|
rb_define_singleton_method(Extension, "increment_counter", increment_counter, 3);
|
947
923
|
rb_define_singleton_method(Extension, "add_distribution_value", add_distribution_value, 3);
|
948
924
|
}
|
data/ext/base.rb
CHANGED
@@ -14,7 +14,7 @@ EXT_PATH = File.expand_path(__dir__).freeze
|
|
14
14
|
|
15
15
|
AGENT_PLATFORM = Appsignal::System.agent_platform
|
16
16
|
AGENT_ARCHITECTURE = Appsignal::System.agent_architecture
|
17
|
-
TARGET_TRIPLE = "#{AGENT_ARCHITECTURE}-#{AGENT_PLATFORM}"
|
17
|
+
TARGET_TRIPLE = "#{AGENT_ARCHITECTURE}-#{AGENT_PLATFORM}"
|
18
18
|
ARCH_CONFIG = APPSIGNAL_AGENT_CONFIG["triples"][TARGET_TRIPLE].freeze
|
19
19
|
CA_CERT_PATH = File.join(EXT_PATH, "../resources/cacert.pem").freeze
|
20
20
|
|
@@ -26,13 +26,16 @@ def report
|
|
26
26
|
@report ||=
|
27
27
|
begin
|
28
28
|
rbconfig = RbConfig::CONFIG
|
29
|
+
patchlevel = rbconfig["PATCHLEVEL"]
|
30
|
+
patchlevel_label = "-p#{patchlevel}" if patchlevel
|
31
|
+
ruby_version = "#{RUBY_VERSION}#{patchlevel_label}"
|
29
32
|
{
|
30
33
|
"result" => {
|
31
34
|
"status" => "incomplete"
|
32
35
|
},
|
33
36
|
"language" => {
|
34
37
|
"name" => "ruby",
|
35
|
-
"version" =>
|
38
|
+
"version" => ruby_version
|
36
39
|
},
|
37
40
|
"download" => {
|
38
41
|
"checksum" => "unverified"
|
data/lib/appsignal/auth_check.rb
CHANGED
@@ -40,7 +40,7 @@ module Appsignal
|
|
40
40
|
# @return [Array<String/nil, String>] response tuple.
|
41
41
|
# - First value is the response status code.
|
42
42
|
# - Second value is a description of the response and the exception error
|
43
|
-
# message if an exception
|
43
|
+
# message if an exception occurred.
|
44
44
|
def perform_with_result
|
45
45
|
status = perform
|
46
46
|
result =
|
@@ -19,7 +19,6 @@ module Appsignal
|
|
19
19
|
begin
|
20
20
|
config = Appsignal.config
|
21
21
|
log_file_path = config.log_file_path
|
22
|
-
makefile_log_path = File.join("ext", "mkmf.log")
|
23
22
|
{
|
24
23
|
:package_install_path => {
|
25
24
|
:label => "AppSignal gem path",
|
@@ -37,9 +36,9 @@ module Appsignal
|
|
37
36
|
:label => "Log directory",
|
38
37
|
:path => log_file_path ? File.dirname(log_file_path) : ""
|
39
38
|
},
|
40
|
-
|
39
|
+
"ext/mkmf.log" => {
|
41
40
|
:label => "Makefile install log",
|
42
|
-
:path =>
|
41
|
+
:path => makefile_install_log_path
|
43
42
|
},
|
44
43
|
"appsignal.log" => {
|
45
44
|
:label => "AppSignal log",
|
@@ -54,8 +53,11 @@ module Appsignal
|
|
54
53
|
def path_stat(path)
|
55
54
|
{
|
56
55
|
:path => path,
|
57
|
-
:exists =>
|
56
|
+
:exists => false
|
58
57
|
}.tap do |info|
|
58
|
+
next unless info[:path]
|
59
|
+
|
60
|
+
info[:exists] = File.exist?(path)
|
59
61
|
next unless info[:exists]
|
60
62
|
|
61
63
|
stat = File.stat(path)
|
@@ -71,18 +73,39 @@ module Appsignal
|
|
71
73
|
:group => Utils.group_for_gid(path_gid)
|
72
74
|
}
|
73
75
|
if info[:type] == "file"
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
76
|
+
begin
|
77
|
+
info[:content] = Utils.read_file_content(
|
78
|
+
path,
|
79
|
+
BYTES_TO_READ_FOR_FILES
|
80
|
+
).split("\n")
|
81
|
+
rescue => error
|
82
|
+
info[:read_error] = "#{error.class}: #{error.message}"
|
83
|
+
end
|
78
84
|
end
|
79
85
|
end
|
80
86
|
end
|
81
87
|
|
82
88
|
# Returns the AppSignal gem installation path. The root directory of
|
83
|
-
# this gem.
|
89
|
+
# this gem when installed.
|
84
90
|
def gem_path
|
85
|
-
|
91
|
+
gemspec.full_gem_path
|
92
|
+
end
|
93
|
+
|
94
|
+
# Returns the AppSignal gem's Makefile log path, if it exists.
|
95
|
+
def makefile_install_log_path
|
96
|
+
possible_locations = [
|
97
|
+
# Installed gem location
|
98
|
+
File.join(gemspec.extension_dir, "mkmf.log"),
|
99
|
+
# Local development location
|
100
|
+
File.join(gem_path, "ext", "mkmf.log")
|
101
|
+
]
|
102
|
+
possible_locations.find do |location|
|
103
|
+
File.exist?(location)
|
104
|
+
end || possible_locations.first
|
105
|
+
end
|
106
|
+
|
107
|
+
def gemspec
|
108
|
+
Gem.loaded_specs["appsignal"]
|
86
109
|
end
|
87
110
|
end
|
88
111
|
end
|
@@ -201,7 +201,7 @@ module Appsignal
|
|
201
201
|
)
|
202
202
|
Appsignal.config.write_to_environment
|
203
203
|
Appsignal.start_logger
|
204
|
-
Appsignal.
|
204
|
+
Appsignal.internal_logger.info("Starting AppSignal diagnose")
|
205
205
|
end
|
206
206
|
|
207
207
|
def run_agent_diagnose_mode
|
@@ -477,6 +477,10 @@ module Appsignal
|
|
477
477
|
:file => config.file_config,
|
478
478
|
:env => config.env_config,
|
479
479
|
:override => config.override_config
|
480
|
+
},
|
481
|
+
:modifiers => {
|
482
|
+
"APPSIGNAL_INACTIVE_ON_CONFIG_FILE_ERROR" =>
|
483
|
+
ENV.fetch("APPSIGNAL_INACTIVE_ON_CONFIG_FILE_ERROR", "")
|
480
484
|
}
|
481
485
|
}
|
482
486
|
print_config_options(config)
|
@@ -519,6 +523,11 @@ module Appsignal
|
|
519
523
|
end
|
520
524
|
end
|
521
525
|
|
526
|
+
puts
|
527
|
+
puts "Configuration modifiers"
|
528
|
+
puts " APPSIGNAL_INACTIVE_ON_CONFIG_FILE_ERROR: " \
|
529
|
+
"#{data[:config][:modifiers]["APPSIGNAL_INACTIVE_ON_CONFIG_FILE_ERROR"].inspect}"
|
530
|
+
|
522
531
|
puts "\nRead more about how the diagnose config output is rendered\n" \
|
523
532
|
"https://docs.appsignal.com/ruby/command-line/diagnose.html"
|
524
533
|
end
|
@@ -622,6 +631,11 @@ module Appsignal
|
|
622
631
|
else
|
623
632
|
print_empty_line
|
624
633
|
end
|
634
|
+
|
635
|
+
return unless path.key?(:read_error)
|
636
|
+
|
637
|
+
puts " Read error: #{path[:read_error]}"
|
638
|
+
print_empty_line
|
625
639
|
end
|
626
640
|
|
627
641
|
def print_empty_line
|
data/lib/appsignal/config.rb
CHANGED
@@ -11,6 +11,7 @@ module Appsignal
|
|
11
11
|
include Appsignal::Utils::DeprecationMessage
|
12
12
|
|
13
13
|
DEFAULT_CONFIG = {
|
14
|
+
:activejob_report_errors => "all",
|
14
15
|
:ca_file_path => File.expand_path(File.join("../../../resources/cacert.pem"), __FILE__),
|
15
16
|
:debug => false,
|
16
17
|
:dns_servers => [],
|
@@ -24,10 +25,12 @@ module Appsignal
|
|
24
25
|
:enable_rails_error_reporter => true,
|
25
26
|
:endpoint => "https://push.appsignal.com",
|
26
27
|
:files_world_accessible => true,
|
28
|
+
:filter_metadata => [],
|
27
29
|
:filter_parameters => [],
|
28
30
|
:filter_session_data => [],
|
29
31
|
:ignore_actions => [],
|
30
32
|
:ignore_errors => [],
|
33
|
+
:ignore_logs => [],
|
31
34
|
:ignore_namespaces => [],
|
32
35
|
:instrument_http_rb => true,
|
33
36
|
:instrument_net_http => true,
|
@@ -39,7 +42,7 @@ module Appsignal
|
|
39
42
|
HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING
|
40
43
|
HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_CONNECTION
|
41
44
|
CONTENT_LENGTH PATH_INFO HTTP_RANGE
|
42
|
-
REQUEST_METHOD
|
45
|
+
REQUEST_METHOD REQUEST_PATH SERVER_NAME SERVER_PORT
|
43
46
|
SERVER_PROTOCOL
|
44
47
|
],
|
45
48
|
:send_environment_metadata => true,
|
@@ -64,8 +67,11 @@ module Appsignal
|
|
64
67
|
|
65
68
|
ENV_TO_KEY_MAPPING = {
|
66
69
|
"APPSIGNAL_ACTIVE" => :active,
|
70
|
+
"APPSIGNAL_ACTIVE_JOB_REPORT_ERRORS" => :activejob_report_errors,
|
67
71
|
"APPSIGNAL_APP_NAME" => :name,
|
72
|
+
"APPSIGNAL_BIND_ADDRESS" => :bind_address,
|
68
73
|
"APPSIGNAL_CA_FILE_PATH" => :ca_file_path,
|
74
|
+
"APPSIGNAL_CPU_COUNT" => :cpu_count,
|
69
75
|
"APPSIGNAL_DEBUG" => :debug,
|
70
76
|
"APPSIGNAL_DNS_SERVERS" => :dns_servers,
|
71
77
|
"APPSIGNAL_ENABLE_ALLOCATION_TRACKING" => :enable_allocation_tracking,
|
@@ -77,12 +83,15 @@ module Appsignal
|
|
77
83
|
"APPSIGNAL_ENABLE_GVL_WAITING_THREADS" => :enable_gvl_waiting_threads,
|
78
84
|
"APPSIGNAL_ENABLE_RAILS_ERROR_REPORTER" => :enable_rails_error_reporter,
|
79
85
|
"APPSIGNAL_FILES_WORLD_ACCESSIBLE" => :files_world_accessible,
|
86
|
+
"APPSIGNAL_FILTER_METADATA" => :filter_metadata,
|
80
87
|
"APPSIGNAL_FILTER_PARAMETERS" => :filter_parameters,
|
81
88
|
"APPSIGNAL_FILTER_SESSION_DATA" => :filter_session_data,
|
82
89
|
"APPSIGNAL_HOSTNAME" => :hostname,
|
90
|
+
"APPSIGNAL_HOST_ROLE" => :host_role,
|
83
91
|
"APPSIGNAL_HTTP_PROXY" => :http_proxy,
|
84
92
|
"APPSIGNAL_IGNORE_ACTIONS" => :ignore_actions,
|
85
93
|
"APPSIGNAL_IGNORE_ERRORS" => :ignore_errors,
|
94
|
+
"APPSIGNAL_IGNORE_LOGS" => :ignore_logs,
|
86
95
|
"APPSIGNAL_IGNORE_NAMESPACES" => :ignore_namespaces,
|
87
96
|
"APPSIGNAL_INSTRUMENT_HTTP_RB" => :instrument_http_rb,
|
88
97
|
"APPSIGNAL_INSTRUMENT_NET_HTTP" => :instrument_net_http,
|
@@ -108,9 +117,12 @@ module Appsignal
|
|
108
117
|
}.freeze
|
109
118
|
# @api private
|
110
119
|
ENV_STRING_KEYS = %w[
|
120
|
+
APPSIGNAL_ACTIVE_JOB_REPORT_ERRORS
|
111
121
|
APPSIGNAL_APP_NAME
|
122
|
+
APPSIGNAL_BIND_ADDRESS
|
112
123
|
APPSIGNAL_CA_FILE_PATH
|
113
124
|
APPSIGNAL_HOSTNAME
|
125
|
+
APPSIGNAL_HOST_ROLE
|
114
126
|
APPSIGNAL_HTTP_PROXY
|
115
127
|
APPSIGNAL_LOG
|
116
128
|
APPSIGNAL_LOG_LEVEL
|
@@ -150,13 +162,18 @@ module Appsignal
|
|
150
162
|
# @api private
|
151
163
|
ENV_ARRAY_KEYS = %w[
|
152
164
|
APPSIGNAL_DNS_SERVERS
|
165
|
+
APPSIGNAL_FILTER_METADATA
|
153
166
|
APPSIGNAL_FILTER_PARAMETERS
|
154
167
|
APPSIGNAL_FILTER_SESSION_DATA
|
155
168
|
APPSIGNAL_IGNORE_ACTIONS
|
156
169
|
APPSIGNAL_IGNORE_ERRORS
|
170
|
+
APPSIGNAL_IGNORE_LOGS
|
157
171
|
APPSIGNAL_IGNORE_NAMESPACES
|
158
172
|
APPSIGNAL_REQUEST_HEADERS
|
159
173
|
].freeze
|
174
|
+
ENV_FLOAT_KEYS = %w[
|
175
|
+
APPSIGNAL_CPU_COUNT
|
176
|
+
].freeze
|
160
177
|
|
161
178
|
# @attribute [r] system_config
|
162
179
|
# Config detected on the system level.
|
@@ -212,8 +229,8 @@ module Appsignal
|
|
212
229
|
# use. This will be overwritten by the file config and environment
|
213
230
|
# variables config.
|
214
231
|
# @param logger [Logger] The logger to use for the AppSignal gem. This is
|
215
|
-
# used by the configuration class only. Default:
|
216
|
-
# also {Appsignal.start_logger}.
|
232
|
+
# used by the configuration class only. Default:
|
233
|
+
# {Appsignal.internal_logger}. See also {Appsignal.start_logger}.
|
217
234
|
# @param config_file [String] Custom config file location. Default
|
218
235
|
# `config/appsignal.yml`.
|
219
236
|
#
|
@@ -223,8 +240,14 @@ module Appsignal
|
|
223
240
|
# Configuration load order
|
224
241
|
# @see https://docs.appsignal.com/ruby/instrumentation/integrating-appsignal.html
|
225
242
|
# How to integrate AppSignal manually
|
226
|
-
def initialize(
|
227
|
-
|
243
|
+
def initialize(
|
244
|
+
root_path,
|
245
|
+
env,
|
246
|
+
initial_config = {},
|
247
|
+
logger = Appsignal.internal_logger,
|
248
|
+
config_file = nil
|
249
|
+
)
|
250
|
+
@config_file_error = false
|
228
251
|
@root_path = root_path
|
229
252
|
@config_file = config_file
|
230
253
|
@logger = logger
|
@@ -276,6 +299,12 @@ module Appsignal
|
|
276
299
|
config_hash[key]
|
277
300
|
end
|
278
301
|
|
302
|
+
# Update the internal config hash.
|
303
|
+
#
|
304
|
+
# This method does not update the config in the extension and agent. It
|
305
|
+
# should not be used to update the config after AppSignal has started.
|
306
|
+
#
|
307
|
+
# @api private
|
279
308
|
def []=(key, value)
|
280
309
|
config_hash[key] = value
|
281
310
|
end
|
@@ -320,7 +349,9 @@ module Appsignal
|
|
320
349
|
ENV["_APPSIGNAL_AGENT_PATH"] = File.expand_path("../../ext", __dir__).to_s
|
321
350
|
ENV["_APPSIGNAL_APP_NAME"] = config_hash[:name]
|
322
351
|
ENV["_APPSIGNAL_APP_PATH"] = root_path.to_s
|
352
|
+
ENV["_APPSIGNAL_BIND_ADDRESS"] = config_hash[:bind_address].to_s
|
323
353
|
ENV["_APPSIGNAL_CA_FILE_PATH"] = config_hash[:ca_file_path].to_s
|
354
|
+
ENV["_APPSIGNAL_CPU_COUNT"] = config_hash[:cpu_count].to_s
|
324
355
|
ENV["_APPSIGNAL_DEBUG_LOGGING"] = config_hash[:debug].to_s
|
325
356
|
ENV["_APPSIGNAL_DNS_SERVERS"] = config_hash[:dns_servers].join(",")
|
326
357
|
ENV["_APPSIGNAL_ENABLE_HOST_METRICS"] = config_hash[:enable_host_metrics].to_s
|
@@ -331,9 +362,11 @@ module Appsignal
|
|
331
362
|
ENV["_APPSIGNAL_FILTER_PARAMETERS"] = config_hash[:filter_parameters].join(",")
|
332
363
|
ENV["_APPSIGNAL_FILTER_SESSION_DATA"] = config_hash[:filter_session_data].join(",")
|
333
364
|
ENV["_APPSIGNAL_HOSTNAME"] = config_hash[:hostname].to_s
|
365
|
+
ENV["_APPSIGNAL_HOST_ROLE"] = config_hash[:host_role].to_s
|
334
366
|
ENV["_APPSIGNAL_HTTP_PROXY"] = config_hash[:http_proxy]
|
335
367
|
ENV["_APPSIGNAL_IGNORE_ACTIONS"] = config_hash[:ignore_actions].join(",")
|
336
368
|
ENV["_APPSIGNAL_IGNORE_ERRORS"] = config_hash[:ignore_errors].join(",")
|
369
|
+
ENV["_APPSIGNAL_IGNORE_LOGS"] = config_hash[:ignore_logs].join(",")
|
337
370
|
ENV["_APPSIGNAL_IGNORE_NAMESPACES"] = config_hash[:ignore_namespaces].join(",")
|
338
371
|
ENV["_APPSIGNAL_LANGUAGE_INTEGRATION_VERSION"] = "ruby-#{Appsignal::VERSION}"
|
339
372
|
ENV["_APPSIGNAL_LOG"] = config_hash[:log]
|
@@ -408,8 +441,20 @@ module Appsignal
|
|
408
441
|
nil
|
409
442
|
end
|
410
443
|
rescue => e
|
411
|
-
|
412
|
-
|
444
|
+
# TODO: Remove in the next major version
|
445
|
+
@config_file_error = true
|
446
|
+
extra_message =
|
447
|
+
if inactive_on_config_file_error?
|
448
|
+
"Not starting AppSignal because " \
|
449
|
+
"APPSIGNAL_INACTIVE_ON_CONFIG_FILE_ERROR is set."
|
450
|
+
else
|
451
|
+
"Skipping file config. In future versions AppSignal will not start " \
|
452
|
+
"on a config file error. To opt-in to this new behavior set " \
|
453
|
+
"'APPSIGNAL_INACTIVE_ON_CONFIG_FILE_ERROR=1' in your system " \
|
454
|
+
"environment."
|
455
|
+
end
|
456
|
+
message = "An error occurred while loading the AppSignal config file. " \
|
457
|
+
"#{extra_message}\n" \
|
413
458
|
"File: #{config_file.inspect}\n" \
|
414
459
|
"#{e.class.name}: #{e}"
|
415
460
|
Kernel.warn "appsignal: #{message}"
|
@@ -465,6 +510,14 @@ module Appsignal
|
|
465
510
|
config[ENV_TO_KEY_MAPPING[var]] = env_var.split(",")
|
466
511
|
end
|
467
512
|
|
513
|
+
# Configuration with float type
|
514
|
+
ENV_FLOAT_KEYS.each do |var|
|
515
|
+
env_var = ENV.fetch(var, nil)
|
516
|
+
next unless env_var
|
517
|
+
|
518
|
+
config[ENV_TO_KEY_MAPPING[var]] = env_var.to_f
|
519
|
+
end
|
520
|
+
|
468
521
|
config
|
469
522
|
end
|
470
523
|
|
@@ -476,6 +529,12 @@ module Appsignal
|
|
476
529
|
# stick around as a structure for future deprecations.
|
477
530
|
def determine_overrides
|
478
531
|
config = {}
|
532
|
+
# If an error was detected during config file reading/parsing and the new
|
533
|
+
# behavior is enabled to not start AppSignal on incomplete config, do not
|
534
|
+
# start AppSignal.
|
535
|
+
# TODO: Make default behavior in next major version. Remove
|
536
|
+
# `inactive_on_config_file_error?` call.
|
537
|
+
config[:active] = false if @config_file_error && inactive_on_config_file_error?
|
479
538
|
skip_session_data = config_hash[:skip_session_data]
|
480
539
|
send_session_data = config_hash[:send_session_data]
|
481
540
|
if skip_session_data.nil? # Deprecated option is not set
|
@@ -499,5 +558,11 @@ module Appsignal
|
|
499
558
|
config_hash[key] = value
|
500
559
|
end
|
501
560
|
end
|
561
|
+
|
562
|
+
# Does it use the new behavior?
|
563
|
+
def inactive_on_config_file_error?
|
564
|
+
value = ENV.fetch("APPSIGNAL_INACTIVE_ON_CONFIG_FILE_ERROR", false)
|
565
|
+
["1", "true"].include?(value)
|
566
|
+
end
|
502
567
|
end
|
503
568
|
end
|
data/lib/appsignal/demo.rb
CHANGED
@@ -93,7 +93,7 @@ module Appsignal
|
|
93
93
|
"SERVER_NAME" => "localhost",
|
94
94
|
"SERVER_PORT" => "80",
|
95
95
|
"SERVER_PROTOCOL" => "HTTP/1.1",
|
96
|
-
"
|
96
|
+
"REQUEST_PATH" => "/hello",
|
97
97
|
"PATH_INFO" => "/hello",
|
98
98
|
"HTTP_ACCEPT" => "text/html,application/xhtml+xml",
|
99
99
|
"HTTP_ACCEPT_ENCODING" => "gzip, deflate, sdch",
|