appsignal 2.5.3-java → 2.6.0.beta.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +10 -1
  3. data/.rubocop_todo.yml +1 -1
  4. data/.travis.yml +8 -1
  5. data/CHANGELOG.md +12 -0
  6. data/appsignal.gemspec +2 -2
  7. data/benchmark.rake +6 -0
  8. data/ext/agent.yml +35 -35
  9. data/ext/appsignal_extension.c +27 -9
  10. data/lib/appsignal.rb +15 -19
  11. data/lib/appsignal/auth_check.rb +2 -0
  12. data/lib/appsignal/capistrano.rb +2 -0
  13. data/lib/appsignal/cli.rb +2 -0
  14. data/lib/appsignal/cli/demo.rb +2 -0
  15. data/lib/appsignal/cli/diagnose.rb +2 -0
  16. data/lib/appsignal/cli/helpers.rb +2 -0
  17. data/lib/appsignal/cli/install.rb +15 -1
  18. data/lib/appsignal/cli/notify_of_deploy.rb +8 -0
  19. data/lib/appsignal/config.rb +44 -5
  20. data/lib/appsignal/demo.rb +2 -0
  21. data/lib/appsignal/event_formatter.rb +2 -0
  22. data/lib/appsignal/event_formatter/action_view/render_formatter.rb +2 -0
  23. data/lib/appsignal/event_formatter/active_record/instantiation_formatter.rb +2 -0
  24. data/lib/appsignal/event_formatter/active_record/sql_formatter.rb +2 -0
  25. data/lib/appsignal/event_formatter/elastic_search/search_formatter.rb +2 -0
  26. data/lib/appsignal/event_formatter/faraday/request_formatter.rb +2 -0
  27. data/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter.rb +2 -0
  28. data/lib/appsignal/event_formatter/moped/query_formatter.rb +2 -0
  29. data/lib/appsignal/extension.rb +2 -0
  30. data/lib/appsignal/extension/jruby.rb +15 -13
  31. data/lib/appsignal/garbage_collection_profiler.rb +2 -0
  32. data/lib/appsignal/hooks.rb +2 -0
  33. data/lib/appsignal/hooks/action_cable.rb +2 -0
  34. data/lib/appsignal/hooks/active_support_notifications.rb +2 -0
  35. data/lib/appsignal/hooks/celluloid.rb +2 -0
  36. data/lib/appsignal/hooks/data_mapper.rb +2 -0
  37. data/lib/appsignal/hooks/delayed_job.rb +2 -0
  38. data/lib/appsignal/hooks/mongo_ruby_driver.rb +2 -0
  39. data/lib/appsignal/hooks/net_http.rb +2 -0
  40. data/lib/appsignal/hooks/passenger.rb +2 -0
  41. data/lib/appsignal/hooks/puma.rb +2 -0
  42. data/lib/appsignal/hooks/que.rb +2 -0
  43. data/lib/appsignal/hooks/rake.rb +2 -0
  44. data/lib/appsignal/hooks/redis.rb +2 -0
  45. data/lib/appsignal/hooks/sequel.rb +2 -0
  46. data/lib/appsignal/hooks/shoryuken.rb +6 -2
  47. data/lib/appsignal/hooks/sidekiq.rb +4 -2
  48. data/lib/appsignal/hooks/unicorn.rb +2 -0
  49. data/lib/appsignal/hooks/webmachine.rb +2 -0
  50. data/lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb +2 -0
  51. data/lib/appsignal/integrations/data_mapper.rb +2 -0
  52. data/lib/appsignal/integrations/delayed_job_plugin.rb +6 -2
  53. data/lib/appsignal/integrations/grape.rb +2 -0
  54. data/lib/appsignal/integrations/mongo_ruby_driver.rb +2 -0
  55. data/lib/appsignal/integrations/object.rb +2 -0
  56. data/lib/appsignal/integrations/padrino.rb +3 -4
  57. data/lib/appsignal/integrations/que.rb +2 -0
  58. data/lib/appsignal/integrations/railtie.rb +2 -0
  59. data/lib/appsignal/integrations/rake.rb +2 -0
  60. data/lib/appsignal/integrations/resque.rb +2 -0
  61. data/lib/appsignal/integrations/resque_active_job.rb +6 -2
  62. data/lib/appsignal/integrations/sinatra.rb +2 -0
  63. data/lib/appsignal/integrations/webmachine.rb +2 -0
  64. data/lib/appsignal/js_exception_transaction.rb +2 -0
  65. data/lib/appsignal/marker.rb +2 -0
  66. data/lib/appsignal/minutely.rb +2 -0
  67. data/lib/appsignal/rack/generic_instrumentation.rb +2 -0
  68. data/lib/appsignal/rack/js_exception_catcher.rb +2 -0
  69. data/lib/appsignal/rack/rails_instrumentation.rb +2 -0
  70. data/lib/appsignal/rack/sinatra_instrumentation.rb +2 -0
  71. data/lib/appsignal/rack/streaming_listener.rb +2 -0
  72. data/lib/appsignal/system.rb +2 -0
  73. data/lib/appsignal/transaction.rb +13 -10
  74. data/lib/appsignal/transmitter.rb +2 -0
  75. data/lib/appsignal/utils.rb +3 -1
  76. data/lib/appsignal/utils/{params_sanitizer.rb → hash_sanitizer.rb} +12 -11
  77. data/lib/appsignal/utils/query_params_sanitizer.rb +2 -0
  78. data/lib/appsignal/version.rb +3 -1
  79. data/lib/sequel/extensions/appsignal_integration.rb +2 -0
  80. data/resources/appsignal.yml.erb +5 -0
  81. data/spec/lib/appsignal/auth_check_spec.rb +11 -2
  82. data/spec/lib/appsignal/cli/install_spec.rb +33 -0
  83. data/spec/lib/appsignal/config_spec.rb +76 -18
  84. data/spec/lib/appsignal/extension_spec.rb +3 -3
  85. data/spec/lib/appsignal/integrations/padrino_spec.rb +8 -28
  86. data/spec/lib/appsignal/transaction_spec.rb +63 -30
  87. data/spec/lib/appsignal/utils/{params_sanitizer_spec.rb → hash_sanitizer_spec.rb} +6 -6
  88. data/spec/lib/appsignal_spec.rb +180 -158
  89. data/spec/support/helpers/std_streams_helper.rb +19 -12
  90. data/spec/support/project_fixture/config/appsignal.yml +21 -0
  91. metadata +11 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d31100de7c49ad66f8312f7bb2f40c165ad28c9
4
- data.tar.gz: 7ee8ee529193bda1996bcf6d87c16a28ff43a0e7
3
+ metadata.gz: 13f0763175584c1ea6a6f60a639f28caf2093482
4
+ data.tar.gz: b27844ae8ce1b4352035f0f746c916b237a16e8d
5
5
  SHA512:
6
- metadata.gz: 160da4799c4412705c6103718cb7aca6f1f3824b21e7885dfa85327b223ffeaede5dfc72af702bd6452816c05a1104179d95d3f58bcf3e79bfa30ccbda9d281e
7
- data.tar.gz: ae2da31dbadad8bb6c10c9e1e93e16028c9a0fff19fc074147fb12f4d2132c9225584e241d2e270ce93ea34baf140b23b8d414c235d3019c7676ccaa9efe094d
6
+ metadata.gz: '0867acb5db92b67b331420a9adfcdc5aba479a55915c8a9ab55d1e4b5655b269e1190b8570cfaac7151246b29973300428651e08aa5a7abe09772fa97bcb04c4'
7
+ data.tar.gz: 05f24d4aa2e077f9d6ccb817a0221e9649d529cedf7ae986eb76b436b8092812313f8fcaa26c3ab201e38b9c7fe1d35c40f7f0a37de3313d632ac1660e33ab49
@@ -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/FileName:
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
@@ -55,7 +55,7 @@ Metrics/PerceivedComplexity:
55
55
  Max: 14
56
56
 
57
57
  # Offense count: 10
58
- Style/AccessorMethodName:
58
+ Naming/AccessorMethodName:
59
59
  Exclude:
60
60
  - 'lib/appsignal.rb'
61
61
  - 'lib/appsignal/transaction.rb'
@@ -6,7 +6,9 @@ branches:
6
6
  - "develop"
7
7
 
8
8
  language: ruby
9
- cache: bundler
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"
@@ -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
 
@@ -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.6"
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.49.0"
32
+ gem.add_development_dependency "rubocop", "0.50.0"
33
33
  gem.add_development_dependency "yard"
34
34
  end
@@ -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
@@ -1,64 +1,64 @@
1
1
  ---
2
- version: ea78a58
2
+ version: 6ce11c8
3
3
  triples:
4
4
  x86_64-darwin:
5
5
  static:
6
- checksum: f3546e3e99823d5079dd2424f776be9aa51a736b7a36573902076f5c01e85d11
7
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/ea78a58/appsignal-x86_64-darwin-all-static.tar.gz
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: e5c04a5de130374bf226966a30ce18c4d01ab478d3665618fc982ce0980116d4
10
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/ea78a58/appsignal-x86_64-darwin-all-dynamic.tar.gz
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: f3546e3e99823d5079dd2424f776be9aa51a736b7a36573902076f5c01e85d11
14
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/ea78a58/appsignal-x86_64-darwin-all-static.tar.gz
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: e5c04a5de130374bf226966a30ce18c4d01ab478d3665618fc982ce0980116d4
17
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/ea78a58/appsignal-x86_64-darwin-all-dynamic.tar.gz
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: 82708a13163fa6e03860a8d3c06e0617a4c15cca08fab29e6f2761752374d927
21
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/ea78a58/appsignal-i686-linux-all-static.tar.gz
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: ef43a7865a71d88a6929b0983a97c17462ba613990d0463e93cf0ed16364e390
24
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/ea78a58/appsignal-i686-linux-all-dynamic.tar.gz
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: 82708a13163fa6e03860a8d3c06e0617a4c15cca08fab29e6f2761752374d927
28
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/ea78a58/appsignal-i686-linux-all-static.tar.gz
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: ef43a7865a71d88a6929b0983a97c17462ba613990d0463e93cf0ed16364e390
31
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/ea78a58/appsignal-i686-linux-all-dynamic.tar.gz
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: 01dcbeea6e39976d0da4ec36b16ecf6af4bf1f6821e0452671999129a541e6e4
35
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/ea78a58/appsignal-i686-linux-musl-all-static.tar.gz
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: 01dcbeea6e39976d0da4ec36b16ecf6af4bf1f6821e0452671999129a541e6e4
39
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/ea78a58/appsignal-i686-linux-musl-all-static.tar.gz
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: c40ac2149c30bbc66b448685941c30965f9ab19f62cb4af37d437d0da3fb6760
43
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/ea78a58/appsignal-x86_64-linux-all-static.tar.gz
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: fe86db778c37639f8ea6a5269ffb4aa842a8cc334faae7b496e30ca387275867
46
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/ea78a58/appsignal-x86_64-linux-all-dynamic.tar.gz
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: 694618273ef00e3cce1b156770eee51dfb3c31be5ee16d8e61e1c3970a943705
50
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/ea78a58/appsignal-x86_64-linux-musl-all-static.tar.gz
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: 666b3ec59f03fa8ae3c87348065866f30d9f868a4402809b9e5036214da943d5
54
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/ea78a58/appsignal-x86_64-freebsd-all-static.tar.gz
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: afaff145ed01ec0fc661c9ecc2aa72089fbddec8e64591aa5868da0d764996e0
57
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/ea78a58/appsignal-x86_64-freebsd-all-dynamic.tar.gz
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: 666b3ec59f03fa8ae3c87348065866f30d9f868a4402809b9e5036214da943d5
61
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/ea78a58/appsignal-x86_64-freebsd-all-static.tar.gz
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: afaff145ed01ec0fc661c9ecc2aa72089fbddec8e64591aa5868da0d764996e0
64
- download_url: https://appsignal-agent-releases.global.ssl.fastly.net/ea78a58/appsignal-x86_64-freebsd-all-dynamic.tar.gz
63
+ checksum: 05d18c8571bb4baa5bafcfca10c8919f94713067cfe4b1ae3fc9e66ca561bb07
64
+ download_url: https://appsignal-agent-releases.global.ssl.fastly.net/6ce11c8/appsignal-x86_64-freebsd-all-dynamic.tar.gz
@@ -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, 2);
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, 2);
691
- rb_define_singleton_method(Extension, "add_distribution_value", add_distribution_value, 2);
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
  }
@@ -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 # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
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
- unless @config
105
- @config = Config.new(
106
- Dir.pwd,
107
- ENV["APPSIGNAL_APP_ENV"] || ENV["RAILS_ENV"] || ENV["RACK_ENV"]
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 Style/PredicateName
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 Style/PredicateName
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Appsignal
2
4
  # Class used to perform a Push API validation / authentication check against
3
5
  # the AppSignal Push API.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "appsignal"
2
4
  require "capistrano/version"
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "optparse"
2
4
  require "logger"
3
5
  require "appsignal"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "appsignal/demo"
2
4
 
3
5
  module Appsignal
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rbconfig"
2
4
  require "bundler/cli"
3
5
  require "bundler/cli/common"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Appsignal
2
4
  class CLI
3
5
  module Helpers
@@ -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