appsignal 2.5.3 → 2.6.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -1
- data/.rubocop_todo.yml +1 -1
- data/.travis.yml +8 -1
- data/CHANGELOG.md +12 -0
- data/appsignal.gemspec +2 -2
- data/benchmark.rake +6 -0
- data/ext/agent.yml +35 -35
- data/ext/appsignal_extension.c +27 -9
- data/lib/appsignal.rb +15 -19
- data/lib/appsignal/auth_check.rb +2 -0
- data/lib/appsignal/capistrano.rb +2 -0
- data/lib/appsignal/cli.rb +2 -0
- data/lib/appsignal/cli/demo.rb +2 -0
- data/lib/appsignal/cli/diagnose.rb +2 -0
- data/lib/appsignal/cli/helpers.rb +2 -0
- data/lib/appsignal/cli/install.rb +15 -1
- data/lib/appsignal/cli/notify_of_deploy.rb +8 -0
- data/lib/appsignal/config.rb +44 -5
- data/lib/appsignal/demo.rb +2 -0
- data/lib/appsignal/event_formatter.rb +2 -0
- data/lib/appsignal/event_formatter/action_view/render_formatter.rb +2 -0
- data/lib/appsignal/event_formatter/active_record/instantiation_formatter.rb +2 -0
- data/lib/appsignal/event_formatter/active_record/sql_formatter.rb +2 -0
- data/lib/appsignal/event_formatter/elastic_search/search_formatter.rb +2 -0
- data/lib/appsignal/event_formatter/faraday/request_formatter.rb +2 -0
- data/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter.rb +2 -0
- data/lib/appsignal/event_formatter/moped/query_formatter.rb +2 -0
- data/lib/appsignal/extension.rb +2 -0
- data/lib/appsignal/extension/jruby.rb +15 -13
- data/lib/appsignal/garbage_collection_profiler.rb +2 -0
- data/lib/appsignal/hooks.rb +2 -0
- data/lib/appsignal/hooks/action_cable.rb +2 -0
- data/lib/appsignal/hooks/active_support_notifications.rb +2 -0
- data/lib/appsignal/hooks/celluloid.rb +2 -0
- data/lib/appsignal/hooks/data_mapper.rb +2 -0
- data/lib/appsignal/hooks/delayed_job.rb +2 -0
- data/lib/appsignal/hooks/mongo_ruby_driver.rb +2 -0
- data/lib/appsignal/hooks/net_http.rb +2 -0
- data/lib/appsignal/hooks/passenger.rb +2 -0
- data/lib/appsignal/hooks/puma.rb +2 -0
- data/lib/appsignal/hooks/que.rb +2 -0
- data/lib/appsignal/hooks/rake.rb +2 -0
- data/lib/appsignal/hooks/redis.rb +2 -0
- data/lib/appsignal/hooks/sequel.rb +2 -0
- data/lib/appsignal/hooks/shoryuken.rb +6 -2
- data/lib/appsignal/hooks/sidekiq.rb +4 -2
- data/lib/appsignal/hooks/unicorn.rb +2 -0
- data/lib/appsignal/hooks/webmachine.rb +2 -0
- data/lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb +2 -0
- data/lib/appsignal/integrations/data_mapper.rb +2 -0
- data/lib/appsignal/integrations/delayed_job_plugin.rb +6 -2
- data/lib/appsignal/integrations/grape.rb +2 -0
- data/lib/appsignal/integrations/mongo_ruby_driver.rb +2 -0
- data/lib/appsignal/integrations/object.rb +2 -0
- data/lib/appsignal/integrations/padrino.rb +3 -4
- data/lib/appsignal/integrations/que.rb +2 -0
- data/lib/appsignal/integrations/railtie.rb +2 -0
- data/lib/appsignal/integrations/rake.rb +2 -0
- data/lib/appsignal/integrations/resque.rb +2 -0
- data/lib/appsignal/integrations/resque_active_job.rb +6 -2
- data/lib/appsignal/integrations/sinatra.rb +2 -0
- data/lib/appsignal/integrations/webmachine.rb +2 -0
- data/lib/appsignal/js_exception_transaction.rb +2 -0
- data/lib/appsignal/marker.rb +2 -0
- data/lib/appsignal/minutely.rb +2 -0
- data/lib/appsignal/rack/generic_instrumentation.rb +2 -0
- data/lib/appsignal/rack/js_exception_catcher.rb +2 -0
- data/lib/appsignal/rack/rails_instrumentation.rb +2 -0
- data/lib/appsignal/rack/sinatra_instrumentation.rb +2 -0
- data/lib/appsignal/rack/streaming_listener.rb +2 -0
- data/lib/appsignal/system.rb +2 -0
- data/lib/appsignal/transaction.rb +13 -10
- data/lib/appsignal/transmitter.rb +2 -0
- data/lib/appsignal/utils.rb +3 -1
- data/lib/appsignal/utils/{params_sanitizer.rb → hash_sanitizer.rb} +12 -11
- data/lib/appsignal/utils/query_params_sanitizer.rb +2 -0
- data/lib/appsignal/version.rb +3 -1
- data/lib/sequel/extensions/appsignal_integration.rb +2 -0
- data/resources/appsignal.yml.erb +5 -0
- data/spec/lib/appsignal/auth_check_spec.rb +11 -2
- data/spec/lib/appsignal/cli/install_spec.rb +33 -0
- data/spec/lib/appsignal/config_spec.rb +76 -18
- data/spec/lib/appsignal/extension_spec.rb +3 -3
- data/spec/lib/appsignal/integrations/padrino_spec.rb +8 -28
- data/spec/lib/appsignal/transaction_spec.rb +63 -30
- data/spec/lib/appsignal/utils/{params_sanitizer_spec.rb → hash_sanitizer_spec.rb} +6 -6
- data/spec/lib/appsignal_spec.rb +180 -158
- data/spec/support/helpers/std_streams_helper.rb +19 -12
- data/spec/support/project_fixture/config/appsignal.yml +21 -0
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f6e2eaa16fe3379daa8cc8082a6b96486c066f6
|
4
|
+
data.tar.gz: 67d609d9cd2d8b8ba2a0492b40bca3cb90ef029d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c338ad09369de8ba41909e800d62d05fef5ffc9f3265b21ff41a781fc5160aef5972380b1661cecd1d2fd9a1cf009e5b97dd6d012b121d74831b1b7f82d187e1
|
7
|
+
data.tar.gz: 5463f2f232071da5fe070b4e5b8b3d360eb211c570396ae79bb1310a34a3a3eac05a89e75a2513aa58d1b7afec919a0623c078d8f733c7c7190fa51507985ad8
|
data/.rubocop.yml
CHANGED
@@ -17,6 +17,9 @@ AllCops:
|
|
17
17
|
UseCache: true
|
18
18
|
CacheRootDirectory: ./tmp
|
19
19
|
|
20
|
+
Lint/RescueWithoutErrorClass:
|
21
|
+
Enabled: false
|
22
|
+
|
20
23
|
Style/Documentation:
|
21
24
|
Enabled: false
|
22
25
|
|
@@ -55,7 +58,10 @@ Style/MethodMissing:
|
|
55
58
|
Style/TrailingUnderscoreVariable:
|
56
59
|
Enabled: false
|
57
60
|
|
58
|
-
Style/
|
61
|
+
Style/Encoding: # For Ruby 1.9 as it doesn't default to UTF-8
|
62
|
+
Enabled: false
|
63
|
+
|
64
|
+
Naming/FileName:
|
59
65
|
Exclude:
|
60
66
|
- "ext/Rakefile"
|
61
67
|
|
@@ -63,5 +69,8 @@ Metrics/BlockLength:
|
|
63
69
|
Exclude:
|
64
70
|
- "Rakefile"
|
65
71
|
|
72
|
+
Style/FrozenStringLiteralComment:
|
73
|
+
Enabled: true
|
74
|
+
|
66
75
|
# Metrics/LineLength:
|
67
76
|
# Max: 80
|
data/.rubocop_todo.yml
CHANGED
data/.travis.yml
CHANGED
@@ -6,7 +6,9 @@ branches:
|
|
6
6
|
- "develop"
|
7
7
|
|
8
8
|
language: ruby
|
9
|
-
cache:
|
9
|
+
cache:
|
10
|
+
directories:
|
11
|
+
- vendor/bundle
|
10
12
|
|
11
13
|
rvm:
|
12
14
|
- "2.0.0"
|
@@ -14,6 +16,7 @@ rvm:
|
|
14
16
|
- "2.2.4"
|
15
17
|
- "2.3.0"
|
16
18
|
- "2.4.0"
|
19
|
+
- "2.5.1"
|
17
20
|
- "jruby-19mode"
|
18
21
|
|
19
22
|
gemfile:
|
@@ -51,6 +54,10 @@ matrix:
|
|
51
54
|
gemfile: "gemfiles/rails-5.1.gemfile"
|
52
55
|
- rvm: "2.1.8"
|
53
56
|
gemfile: "gemfiles/rails-5.1.gemfile"
|
57
|
+
- rvm: "2.5.1"
|
58
|
+
gemfile: "gemfiles/rails-4.0.gemfile"
|
59
|
+
- rvm: "2.5.1"
|
60
|
+
gemfile: "gemfiles/rails-4.1.gemfile"
|
54
61
|
|
55
62
|
allow_failures:
|
56
63
|
- rvm: "2.4.0"
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
# 2.6.0
|
2
|
+
- Enable frozen strings by default. PR #384
|
3
|
+
- Add `revision` config option. PR #388
|
4
|
+
- Avoid generating unique action names for Padrino. PR #393
|
5
|
+
- Add `request_headers` filter configuration. PR #395
|
6
|
+
- Support tags for custom metrics. PR #398
|
7
|
+
- Add filter_session_data config option. PR #402 & #409
|
8
|
+
- Move default hostname behavior to extension. PR #404
|
9
|
+
- Add `request_headers` config to installation step. PR #406
|
10
|
+
- Rename ParamsSanitizer to HashSanitizer. PR #408
|
11
|
+
- Fix empty action name issue. Commit b292c2c93c8935ab54fc4d16598fa534c9cc9c90
|
12
|
+
|
1
13
|
# 2.5.3
|
2
14
|
- Fix Sidekiq action names containing arguments. PR #401
|
3
15
|
|
data/appsignal.gemspec
CHANGED
@@ -25,10 +25,10 @@ Gem::Specification.new do |gem|
|
|
25
25
|
gem.add_dependency "rack"
|
26
26
|
|
27
27
|
gem.add_development_dependency "rake", "~> 11"
|
28
|
-
gem.add_development_dependency "rspec", "~> 3.
|
28
|
+
gem.add_development_dependency "rspec", "~> 3.7"
|
29
29
|
gem.add_development_dependency "pry"
|
30
30
|
gem.add_development_dependency "timecop"
|
31
31
|
gem.add_development_dependency "webmock"
|
32
|
-
gem.add_development_dependency "rubocop", "0.
|
32
|
+
gem.add_development_dependency "rubocop", "0.50.0"
|
33
33
|
gem.add_development_dependency "yard"
|
34
34
|
end
|
data/benchmark.rake
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'appsignal'
|
2
2
|
require 'benchmark'
|
3
3
|
|
4
|
+
def process_rss
|
5
|
+
`ps -o rss= -p #{Process.pid}`.to_i
|
6
|
+
end
|
7
|
+
|
4
8
|
GC.disable
|
5
9
|
|
6
10
|
task :default => :'benchmark:all'
|
@@ -27,6 +31,7 @@ def run_benchmark
|
|
27
31
|
|
28
32
|
total_objects = ObjectSpace.count_objects[:TOTAL]
|
29
33
|
puts "Initializing, currently #{total_objects} objects"
|
34
|
+
puts "RSS: #{process_rss}"
|
30
35
|
|
31
36
|
Appsignal.config = Appsignal::Config.new(Dir.pwd, 'production', :endpoint => 'http://localhost:8080')
|
32
37
|
Appsignal.start
|
@@ -74,4 +79,5 @@ def run_benchmark
|
|
74
79
|
end)
|
75
80
|
|
76
81
|
puts "Done, currently #{ObjectSpace.count_objects[:TOTAL] - total_objects} objects created"
|
82
|
+
puts "RSS: #{process_rss}"
|
77
83
|
end
|
data/ext/agent.yml
CHANGED
@@ -1,64 +1,64 @@
|
|
1
1
|
---
|
2
|
-
version:
|
2
|
+
version: 6ce11c8
|
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: 270f44902bcd278277b4e5de598fd081145a35f09ccdad1bc2511cd83d37c2f7
|
7
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/6ce11c8/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: 502b5ac7f83c70c27f768181dc4e2a4e6d27a794c0221a0d0c9977709ba2e98b
|
10
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/6ce11c8/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: 270f44902bcd278277b4e5de598fd081145a35f09ccdad1bc2511cd83d37c2f7
|
14
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/6ce11c8/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: 502b5ac7f83c70c27f768181dc4e2a4e6d27a794c0221a0d0c9977709ba2e98b
|
17
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/6ce11c8/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: 3b7d7b01650d419a5a4cf08cbf149e60a9fedef2a21f06f48672c86fc6087bcc
|
21
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/6ce11c8/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: 2ff19f08d8f3d8aa3d78745d58cde3e8fe640ef28556bb885cbab1a9419f8cde
|
24
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/6ce11c8/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: 3b7d7b01650d419a5a4cf08cbf149e60a9fedef2a21f06f48672c86fc6087bcc
|
28
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/6ce11c8/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: 2ff19f08d8f3d8aa3d78745d58cde3e8fe640ef28556bb885cbab1a9419f8cde
|
31
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/6ce11c8/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: c5a0b5f156e94ab9ab763ebd031d002d53b2905d8d5d44eecaecea4f3b757cb5
|
35
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/6ce11c8/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: c5a0b5f156e94ab9ab763ebd031d002d53b2905d8d5d44eecaecea4f3b757cb5
|
39
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/6ce11c8/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: 2c3f49329e6549a0f168238ed771d89f128ce3ac56a3d7f950ba58151fc2e03d
|
43
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/6ce11c8/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: 2a6d28da207f52ff73b9fb9e9337621b95a7b2329eeb4f9da7a83156af519e20
|
46
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/6ce11c8/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: 7a148a871f61f697eb921828ef93232574c71e8d0ea79d30cd4e27b4f5609bc2
|
50
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/6ce11c8/appsignal-x86_64-linux-musl-all-static.tar.gz
|
51
51
|
x86_64-freebsd:
|
52
52
|
static:
|
53
|
-
checksum:
|
54
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
53
|
+
checksum: 5cc8e1702275930e4e1d213ad57b64d892d175b9e84242d757bd23b98ae35d85
|
54
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/6ce11c8/appsignal-x86_64-freebsd-all-static.tar.gz
|
55
55
|
dynamic:
|
56
|
-
checksum:
|
57
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
56
|
+
checksum: 05d18c8571bb4baa5bafcfca10c8919f94713067cfe4b1ae3fc9e66ca561bb07
|
57
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/6ce11c8/appsignal-x86_64-freebsd-all-dynamic.tar.gz
|
58
58
|
amd64-freebsd:
|
59
59
|
static:
|
60
|
-
checksum:
|
61
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
60
|
+
checksum: 5cc8e1702275930e4e1d213ad57b64d892d175b9e84242d757bd23b98ae35d85
|
61
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/6ce11c8/appsignal-x86_64-freebsd-all-static.tar.gz
|
62
62
|
dynamic:
|
63
|
-
checksum:
|
64
|
-
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/
|
63
|
+
checksum: 05d18c8571bb4baa5bafcfca10c8919f94713067cfe4b1ae3fc9e66ca561bb07
|
64
|
+
download_url: https://appsignal-agent-releases.global.ssl.fastly.net/6ce11c8/appsignal-x86_64-freebsd-all-dynamic.tar.gz
|
data/ext/appsignal_extension.c
CHANGED
@@ -545,13 +545,19 @@ static VALUE data_to_s(VALUE self) {
|
|
545
545
|
}
|
546
546
|
}
|
547
547
|
|
548
|
-
static VALUE set_gauge(VALUE self, VALUE key, VALUE value) {
|
548
|
+
static VALUE set_gauge(VALUE self, VALUE key, VALUE value, VALUE tags) {
|
549
|
+
appsignal_data_t* tags_data;
|
550
|
+
|
549
551
|
Check_Type(key, T_STRING);
|
550
552
|
Check_Type(value, T_FLOAT);
|
553
|
+
Check_Type(tags, RUBY_T_DATA);
|
554
|
+
|
555
|
+
Data_Get_Struct(tags, appsignal_data_t, tags_data);
|
551
556
|
|
552
557
|
appsignal_set_gauge(
|
553
558
|
make_appsignal_string(key),
|
554
|
-
NUM2DBL(value)
|
559
|
+
NUM2DBL(value),
|
560
|
+
tags_data
|
555
561
|
);
|
556
562
|
return Qnil;
|
557
563
|
}
|
@@ -578,24 +584,36 @@ static VALUE set_process_gauge(VALUE self, VALUE key, VALUE value) {
|
|
578
584
|
return Qnil;
|
579
585
|
}
|
580
586
|
|
581
|
-
static VALUE increment_counter(VALUE self, VALUE key, VALUE count) {
|
587
|
+
static VALUE increment_counter(VALUE self, VALUE key, VALUE count, VALUE tags) {
|
588
|
+
appsignal_data_t* tags_data;
|
589
|
+
|
582
590
|
Check_Type(key, T_STRING);
|
583
591
|
Check_Type(count, T_FIXNUM);
|
592
|
+
Check_Type(tags, RUBY_T_DATA);
|
593
|
+
|
594
|
+
Data_Get_Struct(tags, appsignal_data_t, tags_data);
|
584
595
|
|
585
596
|
appsignal_increment_counter(
|
586
597
|
make_appsignal_string(key),
|
587
|
-
FIX2INT(count)
|
598
|
+
FIX2INT(count),
|
599
|
+
tags_data
|
588
600
|
);
|
589
601
|
return Qnil;
|
590
602
|
}
|
591
603
|
|
592
|
-
static VALUE add_distribution_value(VALUE self, VALUE key, VALUE value) {
|
604
|
+
static VALUE add_distribution_value(VALUE self, VALUE key, VALUE value, VALUE tags) {
|
605
|
+
appsignal_data_t* tags_data;
|
606
|
+
|
593
607
|
Check_Type(key, T_STRING);
|
594
608
|
Check_Type(value, T_FLOAT);
|
609
|
+
Check_Type(tags, RUBY_T_DATA);
|
610
|
+
|
611
|
+
Data_Get_Struct(tags, appsignal_data_t, tags_data);
|
595
612
|
|
596
613
|
appsignal_add_distribution_value(
|
597
614
|
make_appsignal_string(key),
|
598
|
-
NUM2DBL(value)
|
615
|
+
NUM2DBL(value),
|
616
|
+
tags_data
|
599
617
|
);
|
600
618
|
return Qnil;
|
601
619
|
}
|
@@ -684,9 +702,9 @@ void Init_appsignal_extension(void) {
|
|
684
702
|
rb_define_singleton_method(Extension, "running_in_container?", running_in_container, 0);
|
685
703
|
|
686
704
|
// Metrics
|
687
|
-
rb_define_singleton_method(Extension, "set_gauge", set_gauge,
|
705
|
+
rb_define_singleton_method(Extension, "set_gauge", set_gauge, 3);
|
688
706
|
rb_define_singleton_method(Extension, "set_host_gauge", set_host_gauge, 2);
|
689
707
|
rb_define_singleton_method(Extension, "set_process_gauge", set_process_gauge, 2);
|
690
|
-
rb_define_singleton_method(Extension, "increment_counter", increment_counter,
|
691
|
-
rb_define_singleton_method(Extension, "add_distribution_value", add_distribution_value,
|
708
|
+
rb_define_singleton_method(Extension, "increment_counter", increment_counter, 3);
|
709
|
+
rb_define_singleton_method(Extension, "add_distribution_value", add_distribution_value, 3);
|
692
710
|
}
|
data/lib/appsignal.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "json"
|
2
4
|
require "logger"
|
3
5
|
require "securerandom"
|
@@ -93,7 +95,7 @@ module Appsignal
|
|
93
95
|
#
|
94
96
|
# @return [void]
|
95
97
|
# @since 0.7.0
|
96
|
-
def start
|
98
|
+
def start
|
97
99
|
unless extension_loaded?
|
98
100
|
logger.info("Not starting appsignal, extension is not loaded")
|
99
101
|
return
|
@@ -101,12 +103,10 @@ module Appsignal
|
|
101
103
|
|
102
104
|
logger.debug("Starting appsignal")
|
103
105
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
)
|
109
|
-
end
|
106
|
+
@config ||= Config.new(
|
107
|
+
Dir.pwd,
|
108
|
+
ENV["APPSIGNAL_APP_ENV"] || ENV["RAILS_ENV"] || ENV["RACK_ENV"]
|
109
|
+
)
|
110
110
|
|
111
111
|
if config.valid?
|
112
112
|
logger.level =
|
@@ -189,10 +189,6 @@ module Appsignal
|
|
189
189
|
# This helper method also captures any exception that occurs in the given
|
190
190
|
# block.
|
191
191
|
#
|
192
|
-
# The other (request) `env` argument hash keys, not listed here, can be
|
193
|
-
# found on the {Appsignal::Transaction::ENV_METHODS} array.
|
194
|
-
# Each of these keys are available as keys in the `env` hash argument.
|
195
|
-
#
|
196
192
|
# @example
|
197
193
|
# Appsignal.monitor_transaction("perform_job.nightly_update") do
|
198
194
|
# # your code
|
@@ -605,8 +601,8 @@ module Appsignal
|
|
605
601
|
instrument(name, title, body, Appsignal::EventFormatter::SQL_BODY_FORMAT, &block)
|
606
602
|
end
|
607
603
|
|
608
|
-
def set_gauge(key, value)
|
609
|
-
Appsignal::Extension.set_gauge(key.to_s, value.to_f)
|
604
|
+
def set_gauge(key, value, tags = {})
|
605
|
+
Appsignal::Extension.set_gauge(key.to_s, value.to_f, Appsignal::Utils.data_generate(tags))
|
610
606
|
rescue RangeError
|
611
607
|
Appsignal.logger.warn("Gauge value #{value} for key '#{key}' is too big")
|
612
608
|
end
|
@@ -623,14 +619,14 @@ module Appsignal
|
|
623
619
|
Appsignal.logger.warn("Process gauge value #{value} for key '#{key}' is too big")
|
624
620
|
end
|
625
621
|
|
626
|
-
def increment_counter(key, value = 1)
|
627
|
-
Appsignal::Extension.increment_counter(key.to_s, value)
|
622
|
+
def increment_counter(key, value = 1, tags = {})
|
623
|
+
Appsignal::Extension.increment_counter(key.to_s, value, Appsignal::Utils.data_generate(tags))
|
628
624
|
rescue RangeError
|
629
625
|
Appsignal.logger.warn("Counter value #{value} for key '#{key}' is too big")
|
630
626
|
end
|
631
627
|
|
632
|
-
def add_distribution_value(key, value)
|
633
|
-
Appsignal::Extension.add_distribution_value(key.to_s, value.to_f)
|
628
|
+
def add_distribution_value(key, value, tags = {})
|
629
|
+
Appsignal::Extension.add_distribution_value(key.to_s, value.to_f, Appsignal::Utils.data_generate(tags))
|
634
630
|
rescue RangeError
|
635
631
|
Appsignal.logger.warn("Distribution value #{value} for key '#{key}' is too big")
|
636
632
|
end
|
@@ -736,14 +732,14 @@ module Appsignal
|
|
736
732
|
end
|
737
733
|
|
738
734
|
# @deprecated No replacement
|
739
|
-
def is_ignored_error?(error) # rubocop:disable
|
735
|
+
def is_ignored_error?(error) # rubocop:disable Naming/PredicateName
|
740
736
|
Appsignal.config[:ignore_errors].include?(error.class.name)
|
741
737
|
end
|
742
738
|
alias :is_ignored_exception? :is_ignored_error?
|
743
739
|
deprecate :is_ignored_error?, :none, 2017, 3
|
744
740
|
|
745
741
|
# @deprecated No replacement
|
746
|
-
def is_ignored_action?(action) # rubocop:disable
|
742
|
+
def is_ignored_action?(action) # rubocop:disable Naming/PredicateName
|
747
743
|
Appsignal.config[:ignore_actions].include?(action)
|
748
744
|
end
|
749
745
|
deprecate :is_ignored_action?, :none, 2017, 3
|
data/lib/appsignal/auth_check.rb
CHANGED
data/lib/appsignal/capistrano.rb
CHANGED
data/lib/appsignal/cli.rb
CHANGED
data/lib/appsignal/cli/demo.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "erb"
|
2
4
|
require "ostruct"
|
3
5
|
require "io/console"
|
@@ -162,7 +164,7 @@ module Appsignal
|
|
162
164
|
puts "How do you want to configure AppSignal?"
|
163
165
|
puts " (1) a config file"
|
164
166
|
puts " (2) environment variables"
|
165
|
-
loop do
|
167
|
+
loop do # rubocop:disable Metrics/BlockLength
|
166
168
|
print " Choose (1/2): "
|
167
169
|
case ask_for_input
|
168
170
|
when "1"
|
@@ -174,6 +176,7 @@ module Appsignal
|
|
174
176
|
write_config_file(
|
175
177
|
:push_api_key => config[:push_api_key],
|
176
178
|
:app_name => config[:name],
|
179
|
+
:request_headers => multiline_request_headers,
|
177
180
|
:environments => environments
|
178
181
|
)
|
179
182
|
puts
|
@@ -189,6 +192,7 @@ module Appsignal
|
|
189
192
|
if name_overwritten
|
190
193
|
puts " export APPSIGNAL_APP_NAME=#{config[:name]}"
|
191
194
|
end
|
195
|
+
puts " export APPSIGNAL_REQUEST_HEADERS=#{single_line_request_headers}"
|
192
196
|
puts
|
193
197
|
puts " See the documentation for more configuration options:"
|
194
198
|
puts " http://docs.appsignal.com/gem-settings/configuration.html"
|
@@ -271,6 +275,16 @@ module Appsignal
|
|
271
275
|
def new_config
|
272
276
|
Appsignal::Config.new(Dir.pwd, "")
|
273
277
|
end
|
278
|
+
|
279
|
+
def multiline_request_headers
|
280
|
+
Appsignal::Config::SUGGESTED_REQUEST_HEADERS.map do |row|
|
281
|
+
row.map(&:inspect).join(", ")
|
282
|
+
end.join(",\n ")
|
283
|
+
end
|
284
|
+
|
285
|
+
def single_line_request_headers
|
286
|
+
Appsignal::Config::SUGGESTED_REQUEST_HEADERS.flatten.join(",")
|
287
|
+
end
|
274
288
|
end
|
275
289
|
end
|
276
290
|
end
|