appsignal 2.10.12 → 2.11.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5be928ff6008a98a5927b4af5b1aff886fa614c977bd0c15949d5058812271f
4
- data.tar.gz: 281d028e86f29716f4686ed4bb24ee6ee980796501f7884d812244ba3b5bc26b
3
+ metadata.gz: 250f9ca7d702af9daaafbbced86a9122fea07296841c65c41d64a2a9a594fded
4
+ data.tar.gz: 1753bb37eaeadc98397573098a3b9cf1d718c072074ff3a2d45d3251e75db5f2
5
5
  SHA512:
6
- metadata.gz: fd2e0585cdb1b54d8b517fcacb3580d17bee2836c0c387ee13b9c345d17ea8f75a3a1c5b4279e58938ec2f53d9ccf309a84047de3088a0e239663b6e07b1c968
7
- data.tar.gz: cebe9bd028f453e4febcb4db07eef315b1b4e13353a412d9134e040f3cda8912247f566a275436e6798e5f49eea0f0424e5d1dfeb0a811cd37c213ab55d69f24
6
+ metadata.gz: 2bd72bf03e824a48fff4be825ce0ecab592f10f77a0163505a7c3f71bde0f8fbafd12642fc232f0528036416ac890ca3d29a44e84efce12a086959a6dcf1178a
7
+ data.tar.gz: e82a5e2dee87442a90ab2a67b0627f4d4d787243bde54d0ee78420f8286c97f53ca97c97e0283f6991ad123180ab6303564a610159d862e2a1ffbd5921d534f8
@@ -11,7 +11,7 @@ agent:
11
11
  os_image: ubuntu1804
12
12
  auto_cancel:
13
13
  running:
14
- when: branch != 'main' AND branch != 'develop'
14
+ when: branch != 'master' AND branch != 'develop'
15
15
  global_job_config:
16
16
  env_vars:
17
17
  - name: _BUNDLER_CACHE
@@ -1,17 +1,8 @@
1
1
  # Changelog
2
2
 
3
- # 2.10.12
4
- - Fix `working_directory_path` config option loaded from environment variables.
5
- PR #653
6
-
7
- # 2.10.11
8
- - Fix extension install report status output in `appsignal diagnose`. PR #636
9
- - Support setting a specific configuration file to load with the
10
- `Appsignal::Config` initializer. PR #638
11
-
12
- # 2.10.10
13
- - Bump agent to v-4548c88. PR #634
14
- - Fix issue with host metrics values being reported as "Infinity".
3
+ # 2.11.0
4
+ - Track queue time regardless of namespace. Support custom namespaces. PR #602
5
+ - Report Ruby environment metadata. PR #621
15
6
 
16
7
  # 2.10.9
17
8
  - Use http proxy if configured when downloading agent. PR #606
data/README.md CHANGED
@@ -9,7 +9,7 @@ issues.
9
9
  - [Ruby code documentation][ruby-doc]
10
10
  - [Support][contact]
11
11
 
12
- [![Build status](https://appsignal.semaphoreci.com/badges/appsignal-ruby/branches/main.svg)](https://appsignal.semaphoreci.com/projects/appsignal-ruby)
12
+ [![Build status](https://appsignal.semaphoreci.com/badges/appsignal-ruby/branches/master.svg)](https://appsignal.semaphoreci.com/projects/appsignal-ruby)
13
13
  [![Gem Version](https://badge.fury.io/rb/appsignal.svg)](http://badge.fury.io/rb/appsignal)
14
14
  [![Code Climate](https://codeclimate.com/github/appsignal/appsignal.png)](https://codeclimate.com/github/appsignal/appsignal)
15
15
 
@@ -183,7 +183,7 @@ installing the AppSignal C-extension.
183
183
  # Gemfile
184
184
  gem "appsignal",
185
185
  :git => "https://github.com/appsignal/appsignal-ruby.git",
186
- :branch => "main"
186
+ :branch => "master"
187
187
  ```
188
188
 
189
189
  When you need to use a git source of the gem in your JRuby install, you'll need
@@ -242,12 +242,12 @@ a number of different Ruby versions.
242
242
 
243
243
  This gem uses [Semantic Versioning][semver].
244
244
 
245
- The `main` branch corresponds to the current stable release of the gem.
245
+ The `master` branch corresponds to the current stable release of the gem.
246
246
 
247
247
  The `develop` branch is used for development of features that will end up in
248
248
  the next minor release.
249
249
 
250
- Open a Pull Request on the `main` branch if you're fixing a bug. For new new
250
+ Open a Pull Request on the `master` branch if you're fixing a bug. For new new
251
251
  features, open a Pull Request on the `develop` branch.
252
252
 
253
253
  Every stable and unstable release is tagged in git with a version tag.
@@ -29,7 +29,7 @@ Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
29
29
  gem.metadata = {
30
30
  "bug_tracker_uri" => "https://github.com/appsignal/appsignal-ruby/issues",
31
31
  "changelog_uri" =>
32
- "https://github.com/appsignal/appsignal-ruby/blob/main/CHANGELOG.md",
32
+ "https://github.com/appsignal/appsignal-ruby/blob/master/CHANGELOG.md",
33
33
  "documentation_uri" => "https://docs.appsignal.com/ruby/",
34
34
  "homepage_uri" => "https://docs.appsignal.com/ruby/",
35
35
  "source_code_uri" => "https://github.com/appsignal/appsignal-ruby"
@@ -10,8 +10,8 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
10
10
  # Cancel all running and queued workflows before this one
11
11
  auto_cancel:
12
12
  running:
13
- # Ignore main AND develop branch as we want it to build all workflows
14
- when: "branch != 'main' AND branch != 'develop'"
13
+ # Ignore master AND develop branch as we want it to build all workflows
14
+ when: "branch != 'master' AND branch != 'develop'"
15
15
 
16
16
  global_job_config:
17
17
  env_vars:
@@ -1,70 +1,70 @@
1
1
  ---
2
- version: 4548c88
2
+ version: 38a8a6f
3
3
  mirrors:
4
4
  - https://appsignal-agent-releases.global.ssl.fastly.net
5
5
  - https://d135dj0rjqvssy.cloudfront.net
6
6
  triples:
7
7
  x86_64-darwin:
8
8
  static:
9
- checksum: 322340b402d7750c107bc2c83be46598b3ec0baab27ab7083c6b49dde236cd45
9
+ checksum: 47f24cd09ab00fe3419a313c52d97170c9555d3ea85c8bd98cbb295df29456dd
10
10
  filename: appsignal-x86_64-darwin-all-static.tar.gz
11
11
  dynamic:
12
- checksum: e92cfc0eda7101a1f08b080233ee6f4385fe32a555b31fd62ab13e904686fbc8
12
+ checksum: a26437fbd4c97ff0b69bf42e83d968647532648313227224df1bbbd0ed105104
13
13
  filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
14
14
  universal-darwin:
15
15
  static:
16
- checksum: 322340b402d7750c107bc2c83be46598b3ec0baab27ab7083c6b49dde236cd45
16
+ checksum: 47f24cd09ab00fe3419a313c52d97170c9555d3ea85c8bd98cbb295df29456dd
17
17
  filename: appsignal-x86_64-darwin-all-static.tar.gz
18
18
  dynamic:
19
- checksum: e92cfc0eda7101a1f08b080233ee6f4385fe32a555b31fd62ab13e904686fbc8
19
+ checksum: a26437fbd4c97ff0b69bf42e83d968647532648313227224df1bbbd0ed105104
20
20
  filename: appsignal-x86_64-darwin-all-dynamic.tar.gz
21
21
  i686-linux:
22
22
  static:
23
- checksum: '08addb14f53856cc1befcc4428bef7541e04ea733deb4bf600904cc780de95f5'
23
+ checksum: ae37b329907cead537cf2a87a562ee92120add6c8874bc2e9235e5c537bca692
24
24
  filename: appsignal-i686-linux-all-static.tar.gz
25
25
  dynamic:
26
- checksum: c0c2b3a8ea9e32e686e089101c2f2b4533686eb183f4f30b9ab90cc452222bf0
26
+ checksum: ee5da14c7b5d2cc2dc2ae345d19c33a08c7e4861975e34878c1c295e57b2d8bc
27
27
  filename: appsignal-i686-linux-all-dynamic.tar.gz
28
28
  x86-linux:
29
29
  static:
30
- checksum: '08addb14f53856cc1befcc4428bef7541e04ea733deb4bf600904cc780de95f5'
30
+ checksum: ae37b329907cead537cf2a87a562ee92120add6c8874bc2e9235e5c537bca692
31
31
  filename: appsignal-i686-linux-all-static.tar.gz
32
32
  dynamic:
33
- checksum: c0c2b3a8ea9e32e686e089101c2f2b4533686eb183f4f30b9ab90cc452222bf0
33
+ checksum: ee5da14c7b5d2cc2dc2ae345d19c33a08c7e4861975e34878c1c295e57b2d8bc
34
34
  filename: appsignal-i686-linux-all-dynamic.tar.gz
35
35
  i686-linux-musl:
36
36
  static:
37
- checksum: b9d3419bcca5a2fe07179af29b8e0fd26df73be46b18e9edaf1049d162eefed4
37
+ checksum: d2d6dfd5d86b229449c73c74ac6b922eeff981f451dd599cbc8b9f2b7a715931
38
38
  filename: appsignal-i686-linux-musl-all-static.tar.gz
39
39
  x86-linux-musl:
40
40
  static:
41
- checksum: b9d3419bcca5a2fe07179af29b8e0fd26df73be46b18e9edaf1049d162eefed4
41
+ checksum: d2d6dfd5d86b229449c73c74ac6b922eeff981f451dd599cbc8b9f2b7a715931
42
42
  filename: appsignal-i686-linux-musl-all-static.tar.gz
43
43
  x86_64-linux:
44
44
  static:
45
- checksum: 4befb33b621cb1d273b5dec9f3395271d4ecfe1d637d5f311c80bac105a06b4b
45
+ checksum: 6b05c04df7de65be742942926c79e4d322a02dd3b18552b4eb42b420b67df214
46
46
  filename: appsignal-x86_64-linux-all-static.tar.gz
47
47
  dynamic:
48
- checksum: c3696467fcb00aee14041b30f827524634babe3fd2f16bd20320d3f28fb11582
48
+ checksum: de2f7325d2d7d01632abe9eb135f51376ed3769167e0675b7e7c6de9702c057c
49
49
  filename: appsignal-x86_64-linux-all-dynamic.tar.gz
50
50
  x86_64-linux-musl:
51
51
  static:
52
- checksum: 49b95f4c3d025b633e22632ca7b401b56d8acd448a545be3976466676d5aed54
52
+ checksum: 2a852991c740f93d83dbd3b34daaef45f2ebb02a921200734a6f715790d44968
53
53
  filename: appsignal-x86_64-linux-musl-all-static.tar.gz
54
54
  dynamic:
55
- checksum: db789b22a4ed788db73cbfca5c82cdee29d4d40bedd85a22176b95987ce2c07d
55
+ checksum: 03fc01d09698b95a5686fc08e4cd1f35913a53413e0ae8ced877c0e7f8ca260e
56
56
  filename: appsignal-x86_64-linux-musl-all-dynamic.tar.gz
57
57
  x86_64-freebsd:
58
58
  static:
59
- checksum: b8734f66d077e9acd9fc990c812877b92e4fc783ee30f430d829da058d3a709f
59
+ checksum: 3a26b9a4a1c7e412f6602f4bbae8dd95ad248b41e033b967163bae2f6fac0e96
60
60
  filename: appsignal-x86_64-freebsd-all-static.tar.gz
61
61
  dynamic:
62
- checksum: e8bce24495933d8fad137c1075abbf4173161d0ee3e830f83eb6bfecf309ada5
62
+ checksum: 4eda2bdb88670854abb07ad716e2d46de298dd8549835468c4a778f74c6a7b0e
63
63
  filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
64
64
  amd64-freebsd:
65
65
  static:
66
- checksum: b8734f66d077e9acd9fc990c812877b92e4fc783ee30f430d829da058d3a709f
66
+ checksum: 3a26b9a4a1c7e412f6602f4bbae8dd95ad248b41e033b967163bae2f6fac0e96
67
67
  filename: appsignal-x86_64-freebsd-all-static.tar.gz
68
68
  dynamic:
69
- checksum: e8bce24495933d8fad137c1075abbf4173161d0ee3e830f83eb6bfecf309ada5
69
+ checksum: 4eda2bdb88670854abb07ad716e2d46de298dd8549835468c4a778f74c6a7b0e
70
70
  filename: appsignal-x86_64-freebsd-all-dynamic.tar.gz
@@ -639,6 +639,14 @@ static VALUE running_in_container() {
639
639
  return appsignal_running_in_container() == 1 ? Qtrue : Qfalse;
640
640
  }
641
641
 
642
+ static VALUE set_environment_metadata(VALUE self, VALUE key, VALUE value) {
643
+ appsignal_set_environment_metadata(
644
+ make_appsignal_string(key),
645
+ make_appsignal_string(value)
646
+ );
647
+ return Qnil;
648
+ }
649
+
642
650
  void Init_appsignal_extension(void) {
643
651
  Appsignal = rb_define_module("Appsignal");
644
652
  Extension = rb_define_class_under(Appsignal, "Extension", rb_cObject);
@@ -697,9 +705,10 @@ void Init_appsignal_extension(void) {
697
705
  // Get JSON content of a data
698
706
  rb_define_method(Data, "to_s", data_to_s, 0);
699
707
 
700
- // Event hook installation
708
+ // Other helper methods
701
709
  rb_define_singleton_method(Extension, "install_allocation_event_hook", install_allocation_event_hook, 0);
702
710
  rb_define_singleton_method(Extension, "running_in_container?", running_in_container, 0);
711
+ rb_define_singleton_method(Extension, "set_environment_metadata", set_environment_metadata, 2);
703
712
 
704
713
  // Metrics
705
714
  rb_define_singleton_method(Extension, "set_gauge", set_gauge, 3);
@@ -134,11 +134,17 @@ module Appsignal
134
134
 
135
135
  if config[:enable_allocation_tracking] && !Appsignal::System.jruby?
136
136
  Appsignal::Extension.install_allocation_event_hook
137
+ Appsignal::Environment.report_enabled("allocation_tracking")
137
138
  end
138
139
 
139
- GC::Profiler.enable if config[:enable_gc_instrumentation]
140
+ if config[:enable_gc_instrumentation]
141
+ GC::Profiler.enable
142
+ Appsignal::Environment.report_enabled("gc_instrumentation")
143
+ end
140
144
 
141
145
  Appsignal::Minutely.start if config[:enable_minutely_probes]
146
+
147
+ collect_environment_metadata
142
148
  else
143
149
  logger.info("Not starting, not active for #{config.env}")
144
150
  end
@@ -309,9 +315,23 @@ module Appsignal
309
315
  logger.warn "Unable to start logger with log path '#{path}'."
310
316
  logger.warn error
311
317
  end
318
+
319
+ def collect_environment_metadata
320
+ Appsignal::Environment.report("ruby_version") do
321
+ "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
322
+ end
323
+ Appsignal::Environment.report("ruby_engine") { RUBY_ENGINE }
324
+ if defined?(RUBY_ENGINE_VERSION)
325
+ Appsignal::Environment.report("ruby_engine_version") do
326
+ RUBY_ENGINE_VERSION
327
+ end
328
+ end
329
+ Appsignal::Environment.report_supported_gems
330
+ end
312
331
  end
313
332
  end
314
333
 
334
+ require "appsignal/environment"
315
335
  require "appsignal/system"
316
336
  require "appsignal/utils"
317
337
  require "appsignal/extension"
@@ -3,6 +3,8 @@
3
3
  require "appsignal"
4
4
  require "capistrano/version"
5
5
 
6
+ Appsignal::Environment.report_enabled("capistrano")
7
+
6
8
  if defined?(Capistrano::VERSION) && Gem::Version.new(Capistrano::VERSION) >= Gem::Version.new(3)
7
9
  # Capistrano 3+
8
10
  load File.expand_path("../integrations/capistrano/appsignal.cap", __FILE__)
@@ -371,7 +371,7 @@ module Appsignal
371
371
  end
372
372
 
373
373
  def print_installation_result_report(report)
374
- report = report.fetch("result", {})
374
+ report = report.fetch("download", {})
375
375
  puts " Installation result"
376
376
  puts " Status: #{report["status"]}"
377
377
  puts " Message: #{report["message"]}" if report["message"]
@@ -18,6 +18,7 @@ module Appsignal
18
18
  :ignore_namespaces => [],
19
19
  :filter_parameters => [],
20
20
  :filter_session_data => [],
21
+ :send_environment_metadata => true,
21
22
  :send_params => true,
22
23
  :request_headers => %w[
23
24
  HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING
@@ -62,6 +63,7 @@ module Appsignal
62
63
  "APPSIGNAL_IGNORE_NAMESPACES" => :ignore_namespaces,
63
64
  "APPSIGNAL_FILTER_PARAMETERS" => :filter_parameters,
64
65
  "APPSIGNAL_FILTER_SESSION_DATA" => :filter_session_data,
66
+ "APPSIGNAL_SEND_ENVIRONMENT_METADATA" => :send_environment_metadata,
65
67
  "APPSIGNAL_SEND_PARAMS" => :send_params,
66
68
  "APPSIGNAL_HTTP_PROXY" => :http_proxy,
67
69
  "APPSIGNAL_ENABLE_ALLOCATION_TRACKING" => :enable_allocation_tracking,
@@ -119,41 +121,8 @@ module Appsignal
119
121
  :initial_config, :file_config, :env_config
120
122
  attr_accessor :logger
121
123
 
122
- # Initialize a new configuration object for AppSignal.
123
- #
124
- # If this is manually initialized, and not by {Appsignal.start}, it needs
125
- # to be assigned to the {Appsignal.config} attribute.
126
- #
127
- # @example
128
- # require "appsignal"
129
- # Appsignal.config = Appsignal::Config.new(
130
- # app_path,
131
- # "production"
132
- # )
133
- # Appsignal.start
134
- #
135
- # @param root_path [String] Root path of the app.
136
- # @param env [String] The environment to load when AppSignal is started. It
137
- # will look for an environment with this name in the `config/appsignal.yml`
138
- # config file.
139
- # @param initial_config [Hash<String, Object>] The initial configuration to
140
- # use. This will be overwritten by the file config and environment
141
- # variables config.
142
- # @param logger [Logger] The logger to use for the AppSignal gem. This is
143
- # used by the configuration class only. Default: {Appsignal.logger}. See
144
- # also {Appsignal.start_logger}.
145
- # @param config_file [String] Custom config file location. Default
146
- # `config/appsignal.yml`.
147
- #
148
- # @see https://docs.appsignal.com/ruby/configuration/
149
- # Configuration documentation
150
- # @see https://docs.appsignal.com/ruby/configuration/load-order.html
151
- # Configuration load order
152
- # @see https://docs.appsignal.com/ruby/instrumentation/integrating-appsignal.html
153
- # How to integrate AppSignal manually
154
- def initialize(root_path, env, initial_config = {}, logger = Appsignal.logger, config_file = nil)
124
+ def initialize(root_path, env, initial_config = {}, logger = Appsignal.logger)
155
125
  @root_path = root_path
156
- @config_file = config_file
157
126
  @logger = logger
158
127
  @valid = false
159
128
  @config_hash = Hash[DEFAULT_CONFIG]
@@ -255,6 +224,7 @@ module Appsignal
255
224
  ENV["_APPSIGNAL_DNS_SERVERS"] = config_hash[:dns_servers].join(",")
256
225
  ENV["_APPSIGNAL_FILES_WORLD_ACCESSIBLE"] = config_hash[:files_world_accessible].to_s
257
226
  ENV["_APPSIGNAL_TRANSACTION_DEBUG_MODE"] = config_hash[:transaction_debug_mode].to_s
227
+ ENV["_APPSIGNAL_SEND_ENVIRONMENT_METADATA"] = config_hash[:send_environment_metadata].to_s
258
228
  ENV["_APP_REVISION"] = config_hash[:revision].to_s
259
229
  end
260
230
 
@@ -358,8 +328,7 @@ module Appsignal
358
328
  %w[APPSIGNAL_PUSH_API_KEY APPSIGNAL_APP_NAME APPSIGNAL_PUSH_API_ENDPOINT
359
329
  APPSIGNAL_FRONTEND_ERROR_CATCHING_PATH APPSIGNAL_HTTP_PROXY
360
330
  APPSIGNAL_LOG APPSIGNAL_LOG_PATH APPSIGNAL_WORKING_DIR_PATH
361
- APPSIGNAL_WORKING_DIRECTORY_PATH APPSIGNAL_HOSTNAME
362
- APPSIGNAL_CA_FILE_PATH APP_REVISION].each do |var|
331
+ APPSIGNAL_HOSTNAME APPSIGNAL_CA_FILE_PATH APP_REVISION].each do |var|
363
332
  env_var = ENV[var]
364
333
  next unless env_var
365
334
  config[ENV_TO_KEY_MAPPING[var]] = env_var
@@ -371,8 +340,9 @@ module Appsignal
371
340
  APPSIGNAL_SKIP_SESSION_DATA APPSIGNAL_ENABLE_FRONTEND_ERROR_CATCHING
372
341
  APPSIGNAL_ENABLE_ALLOCATION_TRACKING APPSIGNAL_ENABLE_GC_INSTRUMENTATION
373
342
  APPSIGNAL_RUNNING_IN_CONTAINER APPSIGNAL_ENABLE_HOST_METRICS
374
- APPSIGNAL_SEND_PARAMS APPSIGNAL_ENABLE_MINUTELY_PROBES
375
- APPSIGNAL_FILES_WORLD_ACCESSIBLE APPSIGNAL_TRANSACTION_DEBUG_MODE].each do |var|
343
+ APPSIGNAL_SEND_ENVIRONMENT_METADATA APPSIGNAL_SEND_PARAMS
344
+ APPSIGNAL_ENABLE_MINUTELY_PROBES APPSIGNAL_FILES_WORLD_ACCESSIBLE
345
+ APPSIGNAL_TRANSACTION_DEBUG_MODE].each do |var|
376
346
  env_var = ENV[var]
377
347
  next unless env_var
378
348
  config[ENV_TO_KEY_MAPPING[var]] = env_var.casecmp("true").zero?
@@ -0,0 +1,126 @@
1
+ module Appsignal
2
+ # @api private
3
+ class Environment
4
+ # Add environment metadata.
5
+ #
6
+ # The key and value of the environment metadata must be a String, even if
7
+ # it's actually of another type.
8
+ #
9
+ # The value of the environment metadata is given as a block that captures
10
+ # errors that might be raised while fetching the value. It will not
11
+ # re-raise errors, but instead log them using the {Appsignal.logger}. This
12
+ # ensures AppSignal will not cause an error in the application when
13
+ # collecting this metadata.
14
+ #
15
+ # @example Reporting a key and value
16
+ # Appsignal::Environment.report("ruby_version") { RUBY_VERSION }
17
+ #
18
+ # @example When a value is nil
19
+ # Appsignal::Environment.report("ruby_version") { nil }
20
+ # # Key and value do not get reported. A warning gets logged instead.
21
+ #
22
+ # @example When an error occurs
23
+ # Appsignal::Environment.report("ruby_version") { raise "uh oh" }
24
+ # # Error does not get reraised. A warning gets logged instead.
25
+ #
26
+ # @param key [String] The name of the key of the environment metadata value.
27
+ # @yieldreturn [String] The value of the key of the environment metadata.
28
+ # @return [void]
29
+ def self.report(key)
30
+ key =
31
+ case key
32
+ when String
33
+ key
34
+ else
35
+ Appsignal.logger.error "Unable to report on environment metadata: " \
36
+ "Unsupported value type for #{key.inspect}"
37
+ return
38
+ end
39
+
40
+ yielded_value =
41
+ begin
42
+ yield
43
+ rescue => e
44
+ Appsignal.logger.error \
45
+ "Unable to report on environment metadata #{key.inspect}:\n" \
46
+ "#{e.class}: #{e}"
47
+ return
48
+ end
49
+
50
+ value =
51
+ case yielded_value
52
+ when TrueClass, FalseClass
53
+ yielded_value.to_s
54
+ when String
55
+ yielded_value
56
+ else
57
+ Appsignal.logger.error "Unable to report on environment metadata " \
58
+ "#{key.inspect}: Unsupported value type for " \
59
+ "#{yielded_value.inspect}"
60
+ return
61
+ end
62
+
63
+ Appsignal::Extension.set_environment_metadata(key, value)
64
+ rescue => e
65
+ Appsignal.logger.error "Unable to report on environment metadata:\n" \
66
+ "#{e.class}: #{e}"
67
+ end
68
+
69
+ # @see report_supported_gems
70
+ SUPPORTED_GEMS = %w[
71
+ actioncable
72
+ activejob
73
+ capistrano
74
+ celluloid
75
+ data_mapper
76
+ delayed_job
77
+ mongo_ruby_driver
78
+ padrino
79
+ passenger
80
+ puma
81
+ que
82
+ rack
83
+ rails
84
+ rake
85
+ redis
86
+ resque
87
+ sequel
88
+ shoryuken
89
+ sidekiq
90
+ sinatra
91
+ unicorn
92
+ webmachine
93
+ ].freeze
94
+
95
+ # Report on the list of AppSignal supported gems
96
+ #
97
+ # This list is used to report if which AppSignal supported gems are present
98
+ # in this app and what version. This data will help AppSignal improve its
99
+ # support by knowing what gems and versions of gems it still needs to
100
+ # support or can drop support for.
101
+ #
102
+ # It will ask Bundler to report name and version information from the gems
103
+ # that are present in the app bundle.
104
+ def self.report_supported_gems
105
+ return unless defined?(Bundler) # Do nothing if Bundler is not present
106
+
107
+ bundle_gem_specs = ::Bundler.rubygems.all_specs
108
+ SUPPORTED_GEMS.each do |gem_name|
109
+ gem_spec = bundle_gem_specs.find { |spec| spec.name == gem_name }
110
+ next unless gem_spec
111
+
112
+ report("ruby_#{gem_name}_version") { gem_spec.version.to_s }
113
+ end
114
+ rescue => e
115
+ Appsignal.logger.error "Unable to report supported gems:\n" \
116
+ "#{e.class}: #{e}"
117
+ end
118
+
119
+ def self.report_enabled(feature)
120
+ Appsignal::Environment.report("ruby_#{feature}_enabled") { true }
121
+ rescue => e
122
+ Appsignal.logger.error "Unable to report integration enabled:\n" \
123
+ "#{e.class}: #{e}"
124
+ end
125
+ end
126
+ end