appsignal 2.8.0.alpha.1 → 2.8.0
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/.travis.yml +13 -14
- data/CHANGELOG.md +27 -5
- data/ext/agent.yml +38 -35
- data/ext/extconf.rb +12 -0
- data/lib/appsignal/cli.rb +3 -0
- data/lib/appsignal/cli/diagnose.rb +191 -177
- data/lib/appsignal/cli/diagnose/paths.rb +91 -0
- data/lib/appsignal/cli/diagnose/utils.rb +36 -0
- data/lib/appsignal/cli/install.rb +2 -2
- data/lib/appsignal/config.rb +71 -23
- data/lib/appsignal/event_formatter.rb +11 -5
- data/lib/appsignal/garbage_collection_profiler.rb +11 -0
- data/lib/appsignal/system.rb +6 -4
- data/lib/appsignal/transaction.rb +2 -1
- data/lib/appsignal/utils.rb +1 -0
- data/lib/appsignal/utils/deprecation_message.rb +10 -0
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/cli/diagnose/utils_spec.rb +37 -0
- data/spec/lib/appsignal/cli/diagnose_spec.rb +498 -278
- data/spec/lib/appsignal/config_spec.rb +93 -36
- data/spec/lib/appsignal/event_formatter/elastic_search/search_formatter_spec.rb +1 -1
- data/spec/lib/appsignal/event_formatter_spec.rb +12 -7
- data/spec/lib/appsignal/extension_spec.rb +5 -2
- data/spec/lib/appsignal/garbage_collection_profiler_spec.rb +10 -0
- data/spec/lib/appsignal/system_spec.rb +1 -1
- data/spec/lib/appsignal/transaction_spec.rb +24 -7
- data/spec/support/helpers/std_streams_helper.rb +31 -8
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44c65af079aaf661799b20d076f1c5f11eb6bdb47ccdc6aa58dc85781c46d8c7
|
4
|
+
data.tar.gz: 3448422ae801b26eb40ba300016331a85e233fa33e5332971c1529b95fe934d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 610f635119df8b05bdaa3b01cd646594235dd51addde01d96d9433caac12b3c347518e70d941a3a14b594623698952501e09758c9207984aa1209af0bdd8032f
|
7
|
+
data.tar.gz: 4995bd83545cc983821c90e9f1dae888bf6199a703e98a8026b4e8771ec7cf326f8344c2cd9328482c2ca78e785a0ed11f085f63832430cb6c92247056cc6655
|
data/.travis.yml
CHANGED
@@ -12,11 +12,9 @@ cache:
|
|
12
12
|
|
13
13
|
rvm:
|
14
14
|
- "2.0.0"
|
15
|
-
- "2.
|
16
|
-
- "2.
|
17
|
-
- "2.3
|
18
|
-
- "2.4.0"
|
19
|
-
- "2.5.1"
|
15
|
+
- "2.3.8"
|
16
|
+
- "2.4.5"
|
17
|
+
- "2.5.3"
|
20
18
|
- "jruby-19mode"
|
21
19
|
|
22
20
|
gemfile:
|
@@ -41,32 +39,33 @@ gemfile:
|
|
41
39
|
matrix:
|
42
40
|
fast_finish: true
|
43
41
|
include:
|
44
|
-
- rvm: "2.
|
42
|
+
- rvm: "2.1.8"
|
43
|
+
gemfile: "gemfiles/no_dependencies.gemfile"
|
44
|
+
- rvm: "2.2.4"
|
45
|
+
gemfile: "gemfiles/no_dependencies.gemfile"
|
46
|
+
- rvm: "2.5.3"
|
45
47
|
gemfile: "gemfiles/no_dependencies.gemfile"
|
46
48
|
script: "bundle exec rubocop"
|
47
49
|
exclude:
|
48
50
|
# Rails 5 doesn't support Ruby < 2.2
|
49
51
|
- rvm: "2.0.0"
|
50
52
|
gemfile: "gemfiles/rails-5.0.gemfile"
|
51
|
-
- rvm: "2.1.8"
|
52
|
-
gemfile: "gemfiles/rails-5.0.gemfile"
|
53
53
|
- rvm: "2.0.0"
|
54
54
|
gemfile: "gemfiles/rails-5.1.gemfile"
|
55
|
-
- rvm: "2.
|
56
|
-
gemfile: "gemfiles/rails-5.1.gemfile"
|
57
|
-
- rvm: "2.5.1"
|
55
|
+
- rvm: "2.5.3"
|
58
56
|
gemfile: "gemfiles/rails-4.0.gemfile"
|
59
|
-
- rvm: "2.5.
|
57
|
+
- rvm: "2.5.3"
|
60
58
|
gemfile: "gemfiles/rails-4.1.gemfile"
|
61
59
|
|
62
60
|
allow_failures:
|
63
|
-
- rvm: "2.4.
|
61
|
+
- rvm: "2.4.5"
|
64
62
|
gemfile: "gemfiles/rails-4.0.gemfile"
|
65
|
-
- rvm: "2.4.
|
63
|
+
- rvm: "2.4.5"
|
66
64
|
gemfile: "gemfiles/rails-4.1.gemfile"
|
67
65
|
|
68
66
|
env:
|
69
67
|
global:
|
68
|
+
- "RUNNING_IN_CI=true"
|
70
69
|
- "RAILS_ENV=test"
|
71
70
|
- "JRUBY_OPTS=''" # Workaround https://github.com/travis-ci/travis-ci/issues/6471
|
72
71
|
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,31 @@
|
|
1
|
-
# 2.8.0
|
2
|
-
-
|
3
|
-
|
4
|
-
|
1
|
+
# 2.8.0
|
2
|
+
- Group extension and agent tests in diagnose output. PR #437
|
3
|
+
- Add diagnose --[no-]send-report option. PR #438
|
4
|
+
- Print deprecation warnings to STDOUT as well. PR #439
|
5
|
+
- Diagnose command starts the AppSignal logger. PR #440
|
6
|
+
- Send appsignal.log file contents with diagnose report. PR #442
|
7
|
+
- Track source of config option for diagnose report. PR #444
|
8
|
+
- Link back to AppSignal diagnose report page. Claim you reports. PR #445
|
9
|
+
- Print only last 10 lines of files in diagnose report output. PR #442 & #447
|
10
|
+
- Support container memory host metrics better. PR #448
|
11
|
+
- Build dynamic musl extension library. Supports JRuby for musl builds. PR #448
|
12
|
+
- Change `files_world_accessible` permissions to not make files executable.
|
13
|
+
PR #448
|
14
|
+
- Make agent debug logging for disk IO metrics more robust. PR #448
|
15
|
+
|
16
|
+
# 2.7.3 Beta
|
17
|
+
- Add user and group context to diagnose report. PR #436
|
18
|
+
- Add user and group context to agent logs. PR #436
|
19
|
+
- Fixes for running with multiple users
|
20
|
+
|
21
|
+
# 2.7.2
|
22
|
+
- Change the order of instructions in the install script for Rails. PR #433
|
23
|
+
- Fix linking issues on multi-stage build setups. PR #434
|
24
|
+
|
25
|
+
# 2.7.1
|
5
26
|
- Improve error log on unsupported architecture and build combination on
|
6
27
|
install. PR #426
|
28
|
+
- Improve performance when garbage collection profiling is disabled. PR #429
|
7
29
|
|
8
30
|
# 2.7.0
|
9
31
|
- Detect Kubernetes containers as containers for `running_in_container`
|
@@ -522,7 +544,7 @@ Yanked
|
|
522
544
|
* Debug log about missing name in config
|
523
545
|
|
524
546
|
# 0.10.4
|
525
|
-
* Add REQUEST_URI and PATH_INFO to env params
|
547
|
+
* Add REQUEST_URI and PATH_INFO to env params allowlist
|
526
548
|
|
527
549
|
# 0.10.3
|
528
550
|
* Shut down all operations when agent is not active
|
data/ext/agent.yml
CHANGED
@@ -1,64 +1,67 @@
|
|
1
1
|
---
|
2
|
-
version:
|
2
|
+
version: 86b6269
|
3
3
|
triples:
|
4
4
|
x86_64-darwin:
|
5
5
|
static:
|
6
|
-
checksum:
|
7
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
6
|
+
checksum: e253a63c279747c52013e7d0a9b402c879a345d5ab9c06c6f50314b6211d9e4e
|
7
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/86b6269/appsignal-x86_64-darwin-all-static.tar.gz
|
8
8
|
dynamic:
|
9
|
-
checksum:
|
10
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
9
|
+
checksum: 321b5e96fcafc3016858ae6588916613009cfe5c1ace288773c868151252dd6a
|
10
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/86b6269/appsignal-x86_64-darwin-all-dynamic.tar.gz
|
11
11
|
universal-darwin:
|
12
12
|
static:
|
13
|
-
checksum:
|
14
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
13
|
+
checksum: e253a63c279747c52013e7d0a9b402c879a345d5ab9c06c6f50314b6211d9e4e
|
14
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/86b6269/appsignal-x86_64-darwin-all-static.tar.gz
|
15
15
|
dynamic:
|
16
|
-
checksum:
|
17
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
16
|
+
checksum: 321b5e96fcafc3016858ae6588916613009cfe5c1ace288773c868151252dd6a
|
17
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/86b6269/appsignal-x86_64-darwin-all-dynamic.tar.gz
|
18
18
|
i686-linux:
|
19
19
|
static:
|
20
|
-
checksum:
|
21
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
20
|
+
checksum: 11bf57ab3f845e41d90d4cf78fc727103c3a214dcbc18aecde9aa5f9bd0a105f
|
21
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/86b6269/appsignal-i686-linux-all-static.tar.gz
|
22
22
|
dynamic:
|
23
|
-
checksum:
|
24
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
23
|
+
checksum: bca8626460eab556fac29d64e97f3a521aa82fb0e2323f9970c5e840c676d35d
|
24
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/86b6269/appsignal-i686-linux-all-dynamic.tar.gz
|
25
25
|
x86-linux:
|
26
26
|
static:
|
27
|
-
checksum:
|
28
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
27
|
+
checksum: 11bf57ab3f845e41d90d4cf78fc727103c3a214dcbc18aecde9aa5f9bd0a105f
|
28
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/86b6269/appsignal-i686-linux-all-static.tar.gz
|
29
29
|
dynamic:
|
30
|
-
checksum:
|
31
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
30
|
+
checksum: bca8626460eab556fac29d64e97f3a521aa82fb0e2323f9970c5e840c676d35d
|
31
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/86b6269/appsignal-i686-linux-all-dynamic.tar.gz
|
32
32
|
i686-linux-musl:
|
33
33
|
static:
|
34
|
-
checksum:
|
35
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
34
|
+
checksum: fed88ea2a0a0885fd98e3f52a48b925aaca3946d39150dd9897af0b2a934660a
|
35
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/86b6269/appsignal-i686-linux-musl-all-static.tar.gz
|
36
36
|
x86-linux-musl:
|
37
37
|
static:
|
38
|
-
checksum:
|
39
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
38
|
+
checksum: fed88ea2a0a0885fd98e3f52a48b925aaca3946d39150dd9897af0b2a934660a
|
39
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/86b6269/appsignal-i686-linux-musl-all-static.tar.gz
|
40
40
|
x86_64-linux:
|
41
41
|
static:
|
42
|
-
checksum:
|
43
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
42
|
+
checksum: 6d80a9d03c905926c14ba6ffd5d0d4c736a8d065c9055d8dd6d85e114f2a4d8e
|
43
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/86b6269/appsignal-x86_64-linux-all-static.tar.gz
|
44
44
|
dynamic:
|
45
|
-
checksum:
|
46
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
45
|
+
checksum: 3678f0d2b05af9173c333eb4994b316678648d12df9a4cbe685eaedd8a190f3b
|
46
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/86b6269/appsignal-x86_64-linux-all-dynamic.tar.gz
|
47
47
|
x86_64-linux-musl:
|
48
48
|
static:
|
49
|
-
checksum:
|
50
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
49
|
+
checksum: ecde0cc6349b68bf57a632f19a1e2f9fcdc42e8a9ce646fb1bd651837b06d01b
|
50
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/86b6269/appsignal-x86_64-linux-musl-all-static.tar.gz
|
51
|
+
dynamic:
|
52
|
+
checksum: 2c3c123e854bb284f0df536d796826fa5403fddc7d67f1556634fa331e0b7729
|
53
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/86b6269/appsignal-x86_64-linux-musl-all-dynamic.tar.gz
|
51
54
|
x86_64-freebsd:
|
52
55
|
static:
|
53
|
-
checksum:
|
54
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
56
|
+
checksum: 4c880e9ef3f1a6da8cd9914ee2346422e6fb927772bd1586c4afbcf990023a69
|
57
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/86b6269/appsignal-x86_64-freebsd-all-static.tar.gz
|
55
58
|
dynamic:
|
56
|
-
checksum:
|
57
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
59
|
+
checksum: 70f9b378afa50d04d14aa9e8bbc4cbee99f9755c9e09bcdfc7c70f82ca5825ea
|
60
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/86b6269/appsignal-x86_64-freebsd-all-dynamic.tar.gz
|
58
61
|
amd64-freebsd:
|
59
62
|
static:
|
60
|
-
checksum:
|
61
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
63
|
+
checksum: 4c880e9ef3f1a6da8cd9914ee2346422e6fb927772bd1586c4afbcf990023a69
|
64
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/86b6269/appsignal-x86_64-freebsd-all-static.tar.gz
|
62
65
|
dynamic:
|
63
|
-
checksum:
|
64
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
66
|
+
checksum: 70f9b378afa50d04d14aa9e8bbc4cbee99f9755c9e09bcdfc7c70f82ca5825ea
|
67
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/86b6269/appsignal-x86_64-freebsd-all-dynamic.tar.gz
|
data/ext/extconf.rb
CHANGED
@@ -23,6 +23,18 @@ def install
|
|
23
23
|
elsif !find_executable("appsignal-agent", EXT_PATH)
|
24
24
|
installation_failed "Aborting installation, appsignal-agent not found"
|
25
25
|
else
|
26
|
+
with_static_link = [
|
27
|
+
Appsignal::System::LINUX_TARGET,
|
28
|
+
Appsignal::System::MUSL_TARGET
|
29
|
+
].include?(PLATFORM)
|
30
|
+
if with_static_link
|
31
|
+
# Statically link libgcc and libgcc_s libraries.
|
32
|
+
# Dependencies of the libappsignal extension library.
|
33
|
+
# If the gem is installed on a host with build tools installed, but is
|
34
|
+
# run on one that isn't the missing libraries will cause the extension
|
35
|
+
# to fail on start.
|
36
|
+
$LDFLAGS += " -static-libgcc" # rubocop:disable Style/GlobalVars
|
37
|
+
end
|
26
38
|
create_makefile "appsignal_extension"
|
27
39
|
logger.info "Successfully created Makefile for appsignal extension"
|
28
40
|
end
|
data/lib/appsignal/cli.rb
CHANGED
@@ -82,6 +82,9 @@ module Appsignal
|
|
82
82
|
o.on "--environment=<app_env>", "The environment to diagnose" do |arg|
|
83
83
|
options[:environment] = arg
|
84
84
|
end
|
85
|
+
o.on "--[no-]send-report", "Confirm sending the report to AppSignal automatically" do |arg|
|
86
|
+
options[:send_report] = arg
|
87
|
+
end
|
85
88
|
end,
|
86
89
|
"install" => OptionParser.new,
|
87
90
|
"notify_of_deploy" => OptionParser.new do |o|
|
@@ -4,6 +4,8 @@ require "rbconfig"
|
|
4
4
|
require "bundler/cli"
|
5
5
|
require "bundler/cli/common"
|
6
6
|
require "etc"
|
7
|
+
require "appsignal/cli/diagnose/utils"
|
8
|
+
require "appsignal/cli/diagnose/paths"
|
7
9
|
|
8
10
|
module Appsignal
|
9
11
|
class CLI
|
@@ -34,8 +36,14 @@ module Appsignal
|
|
34
36
|
# @example With a specific environment
|
35
37
|
# appsignal diagnose --environment=production
|
36
38
|
#
|
37
|
-
# @
|
38
|
-
#
|
39
|
+
# @example Automatically send the diagnose report without prompting
|
40
|
+
# appsignal diagnose --send-report
|
41
|
+
#
|
42
|
+
# @example Don't prompt about sending the report and don't sent it
|
43
|
+
# appsignal diagnose --no-send-report
|
44
|
+
#
|
45
|
+
# @see https://docs.appsignal.com/support/debugging.html Debugging AppSignal
|
46
|
+
# @see https://docs.appsignal.com/ruby/command-line/diagnose.html
|
39
47
|
# AppSignal diagnose documentation
|
40
48
|
# @since 1.1.0
|
41
49
|
class Diagnose
|
@@ -73,44 +81,58 @@ module Appsignal
|
|
73
81
|
def run(options = {})
|
74
82
|
$stdout.sync = true
|
75
83
|
header
|
76
|
-
|
84
|
+
print_empty_line
|
77
85
|
|
78
86
|
library_information
|
79
|
-
|
87
|
+
print_empty_line
|
80
88
|
|
81
89
|
host_information
|
82
|
-
|
90
|
+
print_empty_line
|
83
91
|
|
84
92
|
configure_appsignal(options)
|
85
93
|
run_agent_diagnose_mode
|
86
|
-
|
94
|
+
print_empty_line
|
87
95
|
|
88
|
-
|
89
|
-
|
96
|
+
print_config_section
|
97
|
+
print_empty_line
|
90
98
|
|
91
99
|
check_api_key
|
92
|
-
|
100
|
+
print_empty_line
|
93
101
|
|
94
|
-
|
95
|
-
empty_line
|
102
|
+
data[:process] = process_user
|
96
103
|
|
97
|
-
|
104
|
+
paths_report = Paths.new
|
105
|
+
data[:paths] = paths_report.report
|
106
|
+
print_paths_section(paths_report)
|
107
|
+
print_empty_line
|
98
108
|
|
99
|
-
transmit_report_to_appsignal if send_report_to_appsignal?
|
109
|
+
transmit_report_to_appsignal if send_report_to_appsignal?(options)
|
100
110
|
end
|
101
111
|
|
102
112
|
private
|
103
113
|
|
104
|
-
def send_report_to_appsignal?
|
114
|
+
def send_report_to_appsignal?(options)
|
105
115
|
puts "\nDiagnostics report"
|
106
116
|
puts " Do you want to send this diagnostics report to AppSignal?"
|
107
|
-
puts " If you share this
|
108
|
-
"
|
109
|
-
"
|
110
|
-
|
111
|
-
|
112
|
-
:
|
113
|
-
|
117
|
+
puts " If you share this report you will be given a link to \n" \
|
118
|
+
" AppSignal.com to validate the report.\n" \
|
119
|
+
" You can also contact us at support@appsignal.com\n" \
|
120
|
+
" with your support token.\n\n"
|
121
|
+
send_diagnostics =
|
122
|
+
if options.key?(:send_report)
|
123
|
+
if options[:send_report]
|
124
|
+
puts " Confirmed sending report using --send-report option."
|
125
|
+
true
|
126
|
+
else
|
127
|
+
puts " Not sending report. (Specified with the --no-send-report option.)"
|
128
|
+
false
|
129
|
+
end
|
130
|
+
else
|
131
|
+
yes_or_no(
|
132
|
+
" Send diagnostics report to AppSignal? (Y/n): ",
|
133
|
+
:default => "y"
|
134
|
+
)
|
135
|
+
end
|
114
136
|
unless send_diagnostics
|
115
137
|
puts " Not sending diagnostics information to AppSignal."
|
116
138
|
return false
|
@@ -119,7 +141,7 @@ module Appsignal
|
|
119
141
|
end
|
120
142
|
|
121
143
|
def transmit_report_to_appsignal
|
122
|
-
puts "
|
144
|
+
puts " Transmitting diagnostics report"
|
123
145
|
transmitter = Transmitter.new(
|
124
146
|
DIAGNOSE_ENDPOINT,
|
125
147
|
Appsignal.config
|
@@ -134,11 +156,10 @@ module Appsignal
|
|
134
156
|
return
|
135
157
|
end
|
136
158
|
|
137
|
-
puts " Please email us at support@appsignal.com with the following"
|
138
|
-
puts " support token."
|
139
159
|
begin
|
140
160
|
response_data = JSON.parse(response.body)
|
141
|
-
puts " Your support token: #{response_data["token"]}"
|
161
|
+
puts "\n Your support token: #{response_data["token"]}"
|
162
|
+
puts " View this report: https://appsignal.com/diagnose/#{response_data["token"]}"
|
142
163
|
rescue JSON::ParserError
|
143
164
|
puts " Error: Couldn't decode server response."
|
144
165
|
puts " #{response.body}"
|
@@ -171,6 +192,8 @@ module Appsignal
|
|
171
192
|
initial_config
|
172
193
|
)
|
173
194
|
Appsignal.config.write_to_environment
|
195
|
+
Appsignal.start_logger
|
196
|
+
Appsignal.logger.info("Starting AppSignal diagnose")
|
174
197
|
end
|
175
198
|
|
176
199
|
def run_agent_diagnose_mode
|
@@ -205,11 +228,12 @@ module Appsignal
|
|
205
228
|
return
|
206
229
|
end
|
207
230
|
|
208
|
-
agent_diagnostic_test_definition.each do |
|
209
|
-
|
231
|
+
agent_diagnostic_test_definition.each do |component, component_definition|
|
232
|
+
puts " #{component_definition[:label]}"
|
233
|
+
component_definition[:tests].each do |category, tests|
|
210
234
|
tests.each do |test_name, test_definition|
|
211
235
|
test_report = report
|
212
|
-
.fetch(
|
236
|
+
.fetch(component, {})
|
213
237
|
.fetch(category, {})
|
214
238
|
.fetch(test_name, {})
|
215
239
|
|
@@ -224,47 +248,63 @@ module Appsignal
|
|
224
248
|
error = test["error"]
|
225
249
|
output = test["output"]
|
226
250
|
|
227
|
-
print "
|
228
|
-
display_value =
|
251
|
+
print " #{definition[:label]}: "
|
252
|
+
display_value =
|
253
|
+
definition[:values] ? definition[:values][value] : value
|
229
254
|
print display_value.nil? ? "-" : display_value
|
230
|
-
print "\n
|
231
|
-
print "\n
|
255
|
+
print "\n Error: #{error}" if error
|
256
|
+
print "\n Output: #{output}" if output
|
232
257
|
print "\n"
|
233
258
|
end
|
234
259
|
|
235
260
|
def agent_diagnostic_test_definition
|
236
261
|
{
|
237
262
|
"extension" => {
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
263
|
+
:label => "Extension tests",
|
264
|
+
:tests => {
|
265
|
+
"config" => {
|
266
|
+
"valid" => {
|
267
|
+
:label => "Configuration",
|
268
|
+
:values => { true => "valid", false => "invalid" }
|
269
|
+
}
|
242
270
|
}
|
243
271
|
}
|
244
272
|
},
|
245
273
|
"agent" => {
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
274
|
+
:label => "Agent tests",
|
275
|
+
:tests => {
|
276
|
+
"boot" => {
|
277
|
+
"started" => {
|
278
|
+
:label => "Started",
|
279
|
+
:values => { true => "started", false => "not started" }
|
280
|
+
}
|
281
|
+
},
|
282
|
+
"host" => {
|
283
|
+
"uid" => { :label => "Process user id" },
|
284
|
+
"gid" => { :label => "Process user group id" }
|
285
|
+
},
|
286
|
+
"config" => {
|
287
|
+
"valid" => {
|
288
|
+
:label => "Configuration",
|
289
|
+
:values => { true => "valid", false => "invalid" }
|
290
|
+
}
|
291
|
+
},
|
292
|
+
"logger" => {
|
293
|
+
"started" => {
|
294
|
+
:label => "Logger",
|
295
|
+
:values => { true => "started", false => "not started" }
|
296
|
+
}
|
297
|
+
},
|
298
|
+
"working_directory_stat" => {
|
299
|
+
"uid" => { :label => "Working directory user id" },
|
300
|
+
"gid" => { :label => "Working directory user group id" },
|
301
|
+
"mode" => { :label => "Working directory permissions" }
|
302
|
+
},
|
303
|
+
"lock_path" => {
|
304
|
+
"created" => {
|
305
|
+
:label => "Lock path",
|
306
|
+
:values => { true => "writable", false => "not writable" }
|
307
|
+
}
|
268
308
|
}
|
269
309
|
}
|
270
310
|
}
|
@@ -276,7 +316,7 @@ module Appsignal
|
|
276
316
|
puts "=" * 80
|
277
317
|
puts "Use this information to debug your configuration."
|
278
318
|
puts "More information is available on the documentation site."
|
279
|
-
puts "
|
319
|
+
puts "https://docs.appsignal.com/"
|
280
320
|
puts "Send this output to support@appsignal.com if you need help."
|
281
321
|
puts "=" * 80
|
282
322
|
end
|
@@ -289,7 +329,6 @@ module Appsignal
|
|
289
329
|
puts_and_save :agent_version, "Agent version", Appsignal::Extension.agent_version
|
290
330
|
puts_and_save :agent_architecture, "Agent architecture",
|
291
331
|
Appsignal::System.installed_agent_architecture
|
292
|
-
puts_and_save :package_install_path, "Gem install path", gem_path
|
293
332
|
puts_and_save :extension_loaded, "Extension loaded", Appsignal.extension_loaded
|
294
333
|
end
|
295
334
|
end
|
@@ -319,75 +358,87 @@ module Appsignal
|
|
319
358
|
end
|
320
359
|
end
|
321
360
|
|
322
|
-
def
|
361
|
+
def print_config_section
|
323
362
|
puts "Configuration"
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
363
|
+
config = Appsignal.config
|
364
|
+
data[:config] = {
|
365
|
+
:options => config.config_hash.merge(:env => config.env),
|
366
|
+
:sources => {
|
367
|
+
:default => Appsignal::Config::DEFAULT_CONFIG,
|
368
|
+
:system => config.system_config,
|
369
|
+
:initial => config.initial_config,
|
370
|
+
:file => config.file_config,
|
371
|
+
:env => config.env_config
|
372
|
+
}
|
373
|
+
}
|
374
|
+
print_environment(config)
|
375
|
+
print_config_options(config)
|
376
|
+
end
|
377
|
+
|
378
|
+
def print_environment(config)
|
379
|
+
env = config.env
|
380
|
+
option = :env
|
381
|
+
option_sources = sources_for_option(option)
|
382
|
+
sources_label = config_sources_label(option, option_sources)
|
383
|
+
print " Environment: #{format_config_option(env)}"
|
384
|
+
|
385
|
+
if env == ""
|
386
|
+
puts "\n Warning: No environment set, no config loaded!"
|
387
|
+
puts " Please make sure appsignal diagnose is run within your "
|
388
|
+
puts " project directory with an environment."
|
389
|
+
puts " appsignal diagnose --environment=production"
|
390
|
+
else
|
391
|
+
puts sources_label
|
330
392
|
end
|
331
393
|
end
|
332
394
|
|
333
|
-
def
|
334
|
-
|
335
|
-
|
395
|
+
def print_config_options(config)
|
396
|
+
config.config_hash.each do |key, value|
|
397
|
+
option_sources = sources_for_option(key)
|
398
|
+
sources_label = config_sources_label(key, option_sources)
|
399
|
+
puts " #{key}: #{format_config_option(value)}#{sources_label}"
|
400
|
+
end
|
336
401
|
|
337
|
-
|
338
|
-
|
339
|
-
puts " Please make sure appsignal diagnose is run within your "
|
340
|
-
puts " project directory with an environment."
|
341
|
-
puts " appsignal diagnose --environment=production"
|
402
|
+
puts "\nRead more about how the diagnose config output is rendered\n"\
|
403
|
+
"https://docs.appsignal.com/ruby/command-line/diagnose.html"
|
342
404
|
end
|
343
405
|
|
344
|
-
def
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
:exists => false,
|
353
|
-
:writable => false
|
354
|
-
}
|
355
|
-
save name, path_info
|
356
|
-
|
357
|
-
puts_value name, path.to_s.inspect
|
406
|
+
def sources_for_option(option)
|
407
|
+
config_sources = data[:config][:sources]
|
408
|
+
[].tap do |option_sources|
|
409
|
+
config_sources.each do |source, c|
|
410
|
+
option_sources << source if c.key?(option)
|
411
|
+
end
|
412
|
+
end
|
413
|
+
end
|
358
414
|
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
415
|
+
def config_sources_label(option, sources)
|
416
|
+
return if sources == [:default]
|
417
|
+
if sources.length == 1
|
418
|
+
" (Loaded from: #{sources.join(", ")})"
|
419
|
+
elsif sources.any?
|
420
|
+
["\n Sources:"].tap do |a|
|
421
|
+
max_source_length = sources.map(&:length).max + 1 # 1 is for ":"
|
422
|
+
sources.each do |source|
|
423
|
+
source_label = "#{source}:".ljust(max_source_length)
|
424
|
+
value = data[:config][:sources][source][option]
|
425
|
+
a << " #{source_label} #{format_config_option(value)}"
|
366
426
|
end
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
puts_value "Writable?", path_info[:writable], :level => 2
|
371
|
-
|
372
|
-
file_owner = path_ownership(path)
|
373
|
-
path_info[:ownership] = file_owner
|
374
|
-
save name, path_info
|
375
|
-
|
376
|
-
owned = process_user[:uid] == file_owner[:uid]
|
377
|
-
owner = "#{owned} " \
|
378
|
-
"(file: #{file_owner[:user]}:#{file_owner[:uid]}, " \
|
379
|
-
"process: #{process_user[:user]}:#{process_user[:uid]})"
|
380
|
-
puts_value "Ownership?", owner, :level => 2
|
381
|
-
end
|
427
|
+
end.join("\n")
|
428
|
+
else
|
429
|
+
" (Not configured)"
|
382
430
|
end
|
383
431
|
end
|
384
432
|
|
385
|
-
def
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
433
|
+
def format_config_option(value)
|
434
|
+
case value
|
435
|
+
when NilClass
|
436
|
+
"nil"
|
437
|
+
when String
|
438
|
+
value.inspect
|
439
|
+
else
|
440
|
+
value
|
441
|
+
end
|
391
442
|
end
|
392
443
|
|
393
444
|
def process_user
|
@@ -396,18 +447,7 @@ module Appsignal
|
|
396
447
|
process_uid = Process.uid
|
397
448
|
@process_user = {
|
398
449
|
:uid => process_uid,
|
399
|
-
:user => username_for_uid(process_uid)
|
400
|
-
}
|
401
|
-
end
|
402
|
-
|
403
|
-
def appsignal_paths
|
404
|
-
config = Appsignal.config
|
405
|
-
log_file_path = config.log_file_path
|
406
|
-
{
|
407
|
-
:working_dir => Dir.pwd,
|
408
|
-
:root_path => config.root_path,
|
409
|
-
:log_dir_path => log_file_path ? File.dirname(log_file_path) : "",
|
410
|
-
:log_file_path => log_file_path
|
450
|
+
:user => Utils.username_for_uid(process_uid)
|
411
451
|
}
|
412
452
|
end
|
413
453
|
|
@@ -429,58 +469,37 @@ module Appsignal
|
|
429
469
|
end
|
430
470
|
end
|
431
471
|
|
432
|
-
def
|
433
|
-
puts "
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
mkmf_log
|
472
|
+
def print_paths_section(report)
|
473
|
+
puts "Paths"
|
474
|
+
report_paths = report.paths
|
475
|
+
data[:paths].each do |name, file|
|
476
|
+
print_path_details report_paths[name][:label], file
|
438
477
|
end
|
439
478
|
end
|
440
479
|
|
441
|
-
def
|
442
|
-
puts "
|
443
|
-
|
444
|
-
log_info = log_file_info(File.join(gem_path, filename))
|
445
|
-
save filename, log_info
|
446
|
-
puts_log_file log_info
|
447
|
-
end
|
448
|
-
|
449
|
-
def mkmf_log
|
450
|
-
puts " Makefile install log"
|
451
|
-
filename = File.join("ext", "mkmf.log")
|
452
|
-
log_info = log_file_info(File.join(gem_path, filename))
|
453
|
-
save filename, log_info
|
454
|
-
puts_log_file log_info
|
455
|
-
end
|
480
|
+
def print_path_details(name, path)
|
481
|
+
puts " #{name}"
|
482
|
+
puts_value "Path", path[:path].to_s.inspect, :level => 2
|
456
483
|
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
:exists => File.exist?(log_file)
|
461
|
-
}.tap do |info|
|
462
|
-
next unless info[:exists]
|
463
|
-
info[:content] = File.read(log_file).split("\n")
|
484
|
+
unless path[:exists]
|
485
|
+
puts_value "Exists?", path[:exists], :level => 2
|
486
|
+
return
|
464
487
|
end
|
465
|
-
end
|
466
488
|
|
467
|
-
|
468
|
-
puts_value "Path", log_info[:path].to_s.inspect, :level => 2
|
469
|
-
if log_info[:exists]
|
470
|
-
puts " Contents:"
|
471
|
-
puts log_info[:content].join("\n")
|
472
|
-
else
|
473
|
-
puts " File not found."
|
474
|
-
end
|
475
|
-
end
|
489
|
+
puts_value "Writable?", path[:writable], :level => 2
|
476
490
|
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
491
|
+
ownership = path[:ownership]
|
492
|
+
owned = process_user[:uid] == ownership[:uid]
|
493
|
+
owner = "#{owned} " \
|
494
|
+
"(file: #{ownership[:user]}:#{ownership[:uid]}, " \
|
495
|
+
"process: #{process_user[:user]}:#{process_user[:uid]})"
|
496
|
+
puts_value "Ownership?", owner, :level => 2
|
497
|
+
return unless path.key?(:content)
|
498
|
+
puts " Contents (last 10 lines):"
|
499
|
+
puts path[:content].last(10)
|
481
500
|
end
|
482
501
|
|
483
|
-
def
|
502
|
+
def print_empty_line
|
484
503
|
puts "\n"
|
485
504
|
end
|
486
505
|
|
@@ -491,11 +510,6 @@ module Appsignal
|
|
491
510
|
rescue LoadError
|
492
511
|
false
|
493
512
|
end
|
494
|
-
|
495
|
-
def gem_path
|
496
|
-
@gem_path ||= \
|
497
|
-
Bundler::CLI::Common.select_spec("appsignal").full_gem_path.strip
|
498
|
-
end
|
499
513
|
end
|
500
514
|
end
|
501
515
|
end
|