appsignal 4.5.17 → 4.6.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.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -0
  3. data/CLAUDE.md +177 -0
  4. data/README.md +17 -0
  5. data/appsignal.gemspec +1 -0
  6. data/build_matrix.yml +29 -0
  7. data/lib/appsignal/auth_check.rb +3 -3
  8. data/lib/appsignal/check_in/cron.rb +1 -1
  9. data/lib/appsignal/check_in/event.rb +1 -1
  10. data/lib/appsignal/check_in/scheduler.rb +3 -1
  11. data/lib/appsignal/check_in.rb +9 -6
  12. data/lib/appsignal/cli/diagnose.rb +1 -1
  13. data/lib/appsignal/cli.rb +1 -1
  14. data/lib/appsignal/config.rb +231 -30
  15. data/lib/appsignal/custom_marker.rb +3 -3
  16. data/lib/appsignal/environment.rb +7 -1
  17. data/lib/appsignal/event_formatter/action_view/render_formatter.rb +1 -1
  18. data/lib/appsignal/event_formatter/active_record/instantiation_formatter.rb +1 -1
  19. data/lib/appsignal/event_formatter/active_record/sql_formatter.rb +1 -1
  20. data/lib/appsignal/event_formatter/elastic_search/search_formatter.rb +1 -1
  21. data/lib/appsignal/event_formatter/faraday/request_formatter.rb +1 -1
  22. data/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter.rb +1 -1
  23. data/lib/appsignal/event_formatter/rom/sql_formatter.rb +1 -1
  24. data/lib/appsignal/event_formatter/sequel/sql_formatter.rb +1 -1
  25. data/lib/appsignal/event_formatter/view_component/render_formatter.rb +1 -1
  26. data/lib/appsignal/event_formatter.rb +41 -3
  27. data/lib/appsignal/extension.rb +1 -1
  28. data/lib/appsignal/garbage_collection.rb +1 -1
  29. data/lib/appsignal/helpers/instrumentation.rb +82 -35
  30. data/lib/appsignal/helpers/metrics.rb +12 -9
  31. data/lib/appsignal/hooks/action_cable.rb +1 -1
  32. data/lib/appsignal/hooks/action_mailer.rb +1 -0
  33. data/lib/appsignal/hooks/active_job.rb +1 -1
  34. data/lib/appsignal/hooks/active_support_notifications.rb +1 -1
  35. data/lib/appsignal/hooks/at_exit.rb +1 -1
  36. data/lib/appsignal/hooks/celluloid.rb +1 -1
  37. data/lib/appsignal/hooks/data_mapper.rb +1 -1
  38. data/lib/appsignal/hooks/delayed_job.rb +1 -1
  39. data/lib/appsignal/hooks/dry_monitor.rb +1 -1
  40. data/lib/appsignal/hooks/excon.rb +1 -1
  41. data/lib/appsignal/hooks/gvl.rb +1 -1
  42. data/lib/appsignal/hooks/http.rb +1 -1
  43. data/lib/appsignal/hooks/mongo_ruby_driver.rb +1 -1
  44. data/lib/appsignal/hooks/mri.rb +1 -1
  45. data/lib/appsignal/hooks/net_http.rb +1 -1
  46. data/lib/appsignal/hooks/ownership.rb +1 -1
  47. data/lib/appsignal/hooks/passenger.rb +1 -1
  48. data/lib/appsignal/hooks/puma.rb +1 -1
  49. data/lib/appsignal/hooks/que.rb +1 -1
  50. data/lib/appsignal/hooks/rake.rb +1 -1
  51. data/lib/appsignal/hooks/redis.rb +1 -1
  52. data/lib/appsignal/hooks/redis_client.rb +1 -1
  53. data/lib/appsignal/hooks/resque.rb +1 -1
  54. data/lib/appsignal/hooks/sequel.rb +2 -1
  55. data/lib/appsignal/hooks/shoryuken.rb +1 -1
  56. data/lib/appsignal/hooks/sidekiq.rb +1 -0
  57. data/lib/appsignal/hooks/unicorn.rb +1 -1
  58. data/lib/appsignal/hooks/webmachine.rb +1 -1
  59. data/lib/appsignal/hooks.rb +5 -3
  60. data/lib/appsignal/integrations/action_cable.rb +1 -1
  61. data/lib/appsignal/integrations/active_support_notifications.rb +1 -1
  62. data/lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb +1 -1
  63. data/lib/appsignal/integrations/data_mapper.rb +1 -1
  64. data/lib/appsignal/integrations/delayed_job_plugin.rb +1 -1
  65. data/lib/appsignal/integrations/dry_monitor.rb +1 -1
  66. data/lib/appsignal/integrations/excon.rb +1 -1
  67. data/lib/appsignal/integrations/http.rb +1 -1
  68. data/lib/appsignal/integrations/mongo_ruby_driver.rb +1 -1
  69. data/lib/appsignal/integrations/net_http.rb +1 -1
  70. data/lib/appsignal/integrations/object.rb +18 -2
  71. data/lib/appsignal/integrations/ownership.rb +1 -1
  72. data/lib/appsignal/integrations/puma.rb +1 -1
  73. data/lib/appsignal/integrations/que.rb +1 -1
  74. data/lib/appsignal/integrations/railtie.rb +2 -2
  75. data/lib/appsignal/integrations/rake.rb +2 -2
  76. data/lib/appsignal/integrations/redis.rb +1 -1
  77. data/lib/appsignal/integrations/redis_client.rb +1 -1
  78. data/lib/appsignal/integrations/resque.rb +2 -2
  79. data/lib/appsignal/integrations/shoryuken.rb +1 -1
  80. data/lib/appsignal/integrations/sidekiq.rb +3 -3
  81. data/lib/appsignal/integrations/unicorn.rb +1 -1
  82. data/lib/appsignal/integrations/webmachine.rb +1 -1
  83. data/lib/appsignal/internal_errors.rb +2 -2
  84. data/lib/appsignal/loaders.rb +1 -1
  85. data/lib/appsignal/logger.rb +36 -19
  86. data/lib/appsignal/marker.rb +1 -1
  87. data/lib/appsignal/probes/gvl.rb +4 -3
  88. data/lib/appsignal/probes/helpers.rb +1 -1
  89. data/lib/appsignal/probes/mri.rb +3 -3
  90. data/lib/appsignal/probes/sidekiq.rb +4 -3
  91. data/lib/appsignal/probes.rb +20 -15
  92. data/lib/appsignal/rack.rb +1 -1
  93. data/lib/appsignal/sample_data.rb +31 -12
  94. data/lib/appsignal/span.rb +1 -1
  95. data/lib/appsignal/system.rb +9 -8
  96. data/lib/appsignal/transaction.rb +72 -52
  97. data/lib/appsignal/transmitter.rb +1 -1
  98. data/lib/appsignal/utils.rb +1 -1
  99. data/lib/appsignal/version.rb +2 -1
  100. data/lib/appsignal.rb +22 -14
  101. data/lib/puma/plugin/appsignal.rb +1 -1
  102. data/sig/appsignal.rbi +2599 -0
  103. data/sig/appsignal.rbs +2420 -0
  104. metadata +20 -6
@@ -12,16 +12,33 @@ module Appsignal
12
12
  # argument if you need to use helper methods.
13
13
  class EventFormatter
14
14
  class << self
15
- # @api private
15
+ # @!visibility private
16
16
  def formatters
17
17
  @formatters ||= {}
18
18
  end
19
19
 
20
- # @api private
20
+ # @!visibility private
21
21
  def formatter_classes
22
22
  @formatter_classes ||= {}
23
23
  end
24
24
 
25
+ # Registers an event formatter for a specific event name.
26
+ #
27
+ # @param name [String, Symbol] The name of the event to register the formatter for.
28
+ # @param formatter [Class] The formatter class that implements the `format(payload)` method.
29
+ # @return [void]
30
+ #
31
+ # @example Register a custom formatter
32
+ # class CustomFormatter < Appsignal::EventFormatter
33
+ # def format(payload)
34
+ # ["Custom event", payload[:body]]
35
+ # end
36
+ # end
37
+ #
38
+ # Appsignal::EventFormatter.register("my.event", CustomFormatter)
39
+ #
40
+ # @see #unregister
41
+ # @see #registered?
25
42
  def register(name, formatter = nil)
26
43
  if registered?(name, formatter)
27
44
  logger.warn(
@@ -34,6 +51,17 @@ module Appsignal
34
51
  initialize_formatter name, formatter
35
52
  end
36
53
 
54
+ # Unregisters an event formatter for a specific event name.
55
+ #
56
+ # @param name [String, Symbol] The name of the event to unregister the formatter for.
57
+ # @param formatter [Class] The formatter class to unregister. Defaults to `self`.
58
+ # @return [void]
59
+ #
60
+ # @example Unregister a custom formatter
61
+ # Appsignal::EventFormatter.unregister("my.event", CustomFormatter)
62
+ #
63
+ # @see #register
64
+ # @see #registered?
37
65
  def unregister(name, formatter = self)
38
66
  return unless formatter_classes[name] == formatter
39
67
 
@@ -41,6 +69,14 @@ module Appsignal
41
69
  formatters.delete(name)
42
70
  end
43
71
 
72
+ # Checks if an event formatter is registered for a specific event name.
73
+ #
74
+ # @param name [String, Symbol] The name of the event to check.
75
+ # @param klass [Class, nil] The specific formatter class to check for. Optional.
76
+ # @return [Boolean] true if a formatter is registered, false otherwise.
77
+ #
78
+ # @see #register
79
+ # @see #unregister
44
80
  def registered?(name, klass = nil)
45
81
  if klass
46
82
  formatter_classes[name] == klass
@@ -49,7 +85,7 @@ module Appsignal
49
85
  end
50
86
  end
51
87
 
52
- # @api private
88
+ # @!visibility private
53
89
  def format(name, payload)
54
90
  formatter = formatters[name]
55
91
  formatter&.format(payload)
@@ -76,8 +112,10 @@ module Appsignal
76
112
  end
77
113
  end
78
114
 
115
+ # @return [Integer]
79
116
  # @api public
80
117
  DEFAULT = 0
118
+ # @return [Integer]
81
119
  # @api public
82
120
  SQL_BODY_FORMAT = 1
83
121
  end
@@ -18,7 +18,7 @@ rescue LoadError => error
18
18
  end
19
19
 
20
20
  module Appsignal
21
- # @api private
21
+ # @!visibility private
22
22
  class Extension
23
23
  class << self
24
24
  def agent_config
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- # @api private
4
+ # @!visibility private
5
5
  module GarbageCollection
6
6
  # Return the GC profiler wrapper.
7
7
  #
@@ -89,7 +89,7 @@ module Appsignal
89
89
  # end
90
90
  #
91
91
  # @since 3.11.0
92
- # @param namespace [String/Symbol] The namespace to set on the new
92
+ # @param namespace [String, Symbol] The namespace to set on the new
93
93
  # transaction.
94
94
  # Defaults to the 'web' namespace.
95
95
  # This will not update the active transaction's namespace if
@@ -102,15 +102,18 @@ module Appsignal
102
102
  # within the block with {#set_action}.
103
103
  # This will not update the active transaction's action if
104
104
  # {.monitor} is called when another transaction is already active.
105
- # @yield The block to monitor.
105
+ # @yield [] The block to monitor.
106
+ # @yieldreturn [Object] The return value of the block
106
107
  # @raise [Exception] Any exception that occurs within the given block is
107
108
  # re-raised by this method.
108
- # @return [Object] The value of the given block is returned.
109
+ # @return [Object, nil] The value of the given block is returned.
110
+ # Returns `nil` if there already is a transaction active and no block
111
+ # was given.
109
112
  #
110
113
  # @see https://docs.appsignal.com/ruby/instrumentation/background-jobs.html
111
114
  # Monitor guide
112
115
  def monitor(action:, namespace: nil)
113
- return yield unless active?
116
+ return yield unless Appsignal.active?
114
117
 
115
118
  has_parent_transaction = Appsignal::Transaction.current?
116
119
  if has_parent_transaction
@@ -152,6 +155,25 @@ module Appsignal
152
155
  # Acts the same way as {.monitor}. See that method for more
153
156
  # documentation.
154
157
  #
158
+ # @param namespace [String, Symbol] The namespace to set on the new
159
+ # transaction.
160
+ # Defaults to the 'web' namespace.
161
+ # This will not update the active transaction's namespace if
162
+ # {.monitor} is called when another transaction is already active.
163
+ # @param action [String, Symbol, NilClass]
164
+ # The action name for the transaction.
165
+ # The action name is required to be set for the transaction to be
166
+ # reported.
167
+ # The argument can be set to `nil` or `:set_later` if the action is set
168
+ # within the block with {#set_action}.
169
+ # This will not update the active transaction's action if
170
+ # {.monitor} is called when another transaction is already active.
171
+ # @yield [] The block to monitor.
172
+ # @yieldreturn [Object] The return value of the block
173
+ # @raise [Exception] Any exception that occurs within the given block is
174
+ # re-raised by this method.
175
+ # @return [Object, nil] The value of the given block is returned.
176
+ #
155
177
  # @see monitor
156
178
  def monitor_and_stop(action:, namespace: nil, &block)
157
179
  Appsignal::Utils::StdoutAndLoggerMessage.warning \
@@ -205,10 +227,11 @@ module Appsignal
205
227
  # @see https://docs.appsignal.com/ruby/instrumentation/exception-handling.html
206
228
  # Exception handling guide
207
229
  def send_error(error, &block)
208
- return unless active?
230
+ return unless Appsignal.active?
209
231
 
210
232
  unless error.is_a?(Exception)
211
- internal_logger.error "Appsignal.send_error: Cannot send error. " \
233
+ Appsignal.internal_logger.error "Appsignal.send_error: " \
234
+ "Cannot send error. " \
212
235
  "The given value is not an exception: #{error.inspect}"
213
236
  return
214
237
  end
@@ -271,11 +294,12 @@ module Appsignal
271
294
  # Exception handling guide
272
295
  def set_error(exception)
273
296
  unless exception.is_a?(Exception)
274
- internal_logger.error "Appsignal.set_error: Cannot set error. " \
297
+ Appsignal.internal_logger.error "Appsignal.set_error: " \
298
+ "Cannot set error. " \
275
299
  "The given value is not an exception: #{exception.inspect}"
276
300
  return
277
301
  end
278
- return if !active? || !Appsignal::Transaction.current?
302
+ return if !Appsignal.active? || !Appsignal::Transaction.current?
279
303
 
280
304
  transaction = Appsignal::Transaction.current
281
305
  transaction.set_error(exception)
@@ -334,11 +358,12 @@ module Appsignal
334
358
  # Exception handling guide
335
359
  def report_error(exception, &block)
336
360
  unless exception.is_a?(Exception)
337
- internal_logger.error "Appsignal.report_error: Cannot add error. " \
361
+ Appsignal.internal_logger.error "Appsignal.report_error: " \
362
+ "Cannot add error. " \
338
363
  "The given value is not an exception: #{exception.inspect}"
339
364
  return
340
365
  end
341
- return unless active?
366
+ return unless Appsignal.active?
342
367
 
343
368
  has_parent_transaction = Appsignal::Transaction.current?
344
369
  transaction =
@@ -376,7 +401,7 @@ module Appsignal
376
401
  # @param action [String]
377
402
  # @return [void]
378
403
  def set_action(action)
379
- return if !active? ||
404
+ return if !Appsignal.active? ||
380
405
  !Appsignal::Transaction.current? ||
381
406
  action.nil?
382
407
 
@@ -418,7 +443,7 @@ module Appsignal
418
443
  # @see https://docs.appsignal.com/guides/namespaces.html
419
444
  # Grouping with namespaces guide
420
445
  def set_namespace(namespace)
421
- return if !active? ||
446
+ return if !Appsignal.active? ||
422
447
  !Appsignal::Transaction.current? ||
423
448
  namespace.nil?
424
449
 
@@ -459,13 +484,14 @@ module Appsignal
459
484
  # # The custom data is: [1, 2, 3]
460
485
  #
461
486
  # @since 4.0.0
462
- # @param data [Hash/Array] Custom data to add to the transaction.
487
+ # @param data [Hash<Object, Object>, Array<Object>] Custom data to add to
488
+ # the transaction.
463
489
  # @return [void]
464
490
  #
465
491
  # @see https://docs.appsignal.com/guides/custom-data/sample-data.html
466
492
  # Sample data guide
467
493
  def add_custom_data(data)
468
- return unless active?
494
+ return unless Appsignal.active?
469
495
  return unless Appsignal::Transaction.current?
470
496
 
471
497
  transaction = Appsignal::Transaction.current
@@ -499,7 +525,8 @@ module Appsignal
499
525
  # end
500
526
  #
501
527
  # @since 4.0.0
502
- # @param tags [Hash] Collection of tags to add to the transaction.
528
+ # @param tags [Hash<Object, Object>] Collection of tags to add to the
529
+ # transaction.
503
530
  # @option tags [String, Symbol, Integer] :any
504
531
  # The name of the tag as a Symbol.
505
532
  # @option tags [String, Symbol, Integer] "any"
@@ -509,7 +536,7 @@ module Appsignal
509
536
  # @see https://docs.appsignal.com/ruby/instrumentation/tagging.html
510
537
  # Tagging guide
511
538
  def add_tags(tags = {})
512
- return unless active?
539
+ return unless Appsignal.active?
513
540
  return unless Appsignal::Transaction.current?
514
541
 
515
542
  transaction = Appsignal::Transaction.current
@@ -525,25 +552,41 @@ module Appsignal
525
552
  # should not be necessary to call this method unless you want to report
526
553
  # different parameters.
527
554
  #
555
+ # This method accepts both Hash and Array parameter types:
556
+ # - Hash parameters will be merged when called multiple times
557
+ # - Array parameters will be concatenated when called multiple times
558
+ # - Mixing Hash and Array types will use the latest type (and log a warning)
559
+ #
528
560
  # To filter parameters, see our parameter filtering guide.
529
561
  #
530
562
  # When both the `params` argument and a block is given to this method,
531
563
  # the block is leading and the argument will _not_ be used.
532
564
  #
533
- # @example Add parameters
565
+ # @example Add Hash parameters
534
566
  # Appsignal.add_params("param1" => "value1")
535
567
  # # The parameters include: { "param1" => "value1" }
536
568
  #
537
- # @example Calling `add_params` multiple times will merge the values
569
+ # @example Add Array parameters
570
+ # Appsignal.add_params(["item1", "item2"])
571
+ # # The parameters include: ["item1", "item2"]
572
+ #
573
+ # @example Calling `add_params` multiple times with Hashes merges values
538
574
  # Appsignal.add_params("param1" => "value1")
539
575
  # Appsignal.add_params("param2" => "value2")
540
576
  # # The parameters include:
541
577
  # # { "param1" => "value1", "param2" => "value2" }
542
578
  #
579
+ # @example Calling `add_params` multiple times with Arrays concatenates values
580
+ # Appsignal.add_params(["item1"])
581
+ # Appsignal.add_params(["item2"])
582
+ # # The parameters include: ["item1", "item2"]
583
+ #
543
584
  # @since 4.0.0
544
- # @param params [Hash] The parameters to add to the transaction.
585
+ # @param params [Hash<String, Object>, Array<Object>] The parameters to add to the
586
+ # transaction.
545
587
  # @yield This block is called when the transaction is sampled. The block's
546
588
  # return value will become the new parameters.
589
+ # @yieldreturn [Hash<String, Object>, Array<Object>]
547
590
  # @return [void]
548
591
  #
549
592
  # @see https://docs.appsignal.com/guides/custom-data/sample-data.html
@@ -551,7 +594,7 @@ module Appsignal
551
594
  # @see https://docs.appsignal.com/guides/filter-data/filter-parameters.html
552
595
  # Parameter filtering guide
553
596
  def add_params(params = nil, &block)
554
- return unless active?
597
+ return unless Appsignal.active?
555
598
  return unless Appsignal::Transaction.current?
556
599
 
557
600
  transaction = Appsignal::Transaction.current
@@ -576,7 +619,7 @@ module Appsignal
576
619
  # @see Transaction#set_empty_params!
577
620
  # @see Transaction#set_params_if_nil
578
621
  def set_empty_params!
579
- return unless active?
622
+ return unless Appsignal.active?
580
623
  return unless Appsignal::Transaction.current?
581
624
 
582
625
  transaction = Appsignal::Transaction.current
@@ -606,9 +649,10 @@ module Appsignal
606
649
  # # { "session" => "data", "other" => "value" }
607
650
  #
608
651
  # @since 4.0.0
609
- # @param session_data [Hash] The session data to add to the transaction.
652
+ # @param session_data [Hash<String, Object>] The session data to add to the transaction.
610
653
  # @yield This block is called when the transaction is sampled. The block's
611
654
  # return value will become the new session data.
655
+ # @yieldreturn [Hash<String, Object>]
612
656
  # @return [void]
613
657
  #
614
658
  # @see https://docs.appsignal.com/guides/custom-data/sample-data.html
@@ -616,7 +660,7 @@ module Appsignal
616
660
  # @see https://docs.appsignal.com/guides/filter-data/filter-session-data.html
617
661
  # Session data filtering guide
618
662
  def add_session_data(session_data = nil, &block)
619
- return unless active?
663
+ return unless Appsignal.active?
620
664
  return unless Appsignal::Transaction.current?
621
665
 
622
666
  transaction = Appsignal::Transaction.current
@@ -647,9 +691,10 @@ module Appsignal
647
691
  # # { "PATH_INFO" => "/some-path", "HTTP_USER_AGENT" => "Firefox" }
648
692
  #
649
693
  # @since 4.0.0
650
- # @param headers [Hash] The request headers to add to the transaction.
694
+ # @param headers [Hash<String, Object>] The request headers to add to the transaction.
651
695
  # @yield This block is called when the transaction is sampled. The block's
652
696
  # return value will become the new request headers.
697
+ # @yieldreturn [Hash<String, Object>]
653
698
  # @return [void]
654
699
  #
655
700
  # @see https://docs.appsignal.com/guides/custom-data/sample-data.html
@@ -657,7 +702,7 @@ module Appsignal
657
702
  # @see https://docs.appsignal.com/guides/filter-data/filter-headers.html
658
703
  # Request headers filtering guide
659
704
  def add_headers(headers = nil, &block)
660
- return unless active?
705
+ return unless Appsignal.active?
661
706
  return unless Appsignal::Transaction.current?
662
707
 
663
708
  transaction = Appsignal::Transaction.current
@@ -668,7 +713,7 @@ module Appsignal
668
713
  # Add breadcrumbs to the transaction.
669
714
  #
670
715
  # Breadcrumbs can be used to trace what path a user has taken
671
- # before encounterin an error.
716
+ # before encountering an error.
672
717
  #
673
718
  # Only the last 20 added breadcrumbs will be saved.
674
719
  #
@@ -697,15 +742,15 @@ module Appsignal
697
742
  # e.g. "UI", "Network", "Navigation", "Console".
698
743
  # @param action [String] name of breadcrumb
699
744
  # e.g "The user clicked a button", "HTTP 500 from http://blablabla.com"
700
- # @option message [String] optional message in string format
701
- # @option metadata [Hash<String,String>] key/value metadata in <string, string> format
702
- # @option time [Time] time of breadcrumb, should respond to `.to_i` defaults to `Time.now.utc`
745
+ # @param message [String] optional message in string format
746
+ # @param metadata [Hash<String, String>] key/value metadata in <string, string> format
747
+ # @param time [Time] time of breadcrumb, should respond to `.to_i` defaults to `Time.now.utc`
703
748
  # @return [void]
704
749
  #
705
750
  # @see https://docs.appsignal.com/ruby/instrumentation/breadcrumbs.html
706
751
  # Breadcrumb reference
707
752
  def add_breadcrumb(category, action, message = "", metadata = {}, time = Time.now.utc)
708
- return unless active?
753
+ return unless Appsignal.active?
709
754
  return unless Appsignal::Transaction.current?
710
755
 
711
756
  transaction = Appsignal::Transaction.current
@@ -741,7 +786,7 @@ module Appsignal
741
786
  # instrumented. Accepted values are {EventFormatter::DEFAULT} and
742
787
  # {EventFormatter::SQL_BODY_FORMAT}, but we recommend you use
743
788
  # {.instrument_sql} instead of {EventFormatter::SQL_BODY_FORMAT}.
744
- # @yield yields the given block of code instrumented in an AppSignal
789
+ # @yield [] yields the given block of code instrumented in an AppSignal
745
790
  # event.
746
791
  # @return [Object] Returns the block's return value.
747
792
  #
@@ -782,7 +827,7 @@ module Appsignal
782
827
  # naming guide listed under "See also".
783
828
  # @param title [String, nil] Human readable name of the event.
784
829
  # @param body [String, nil] SQL query that's being executed.
785
- # @yield yields the given block of code instrumented in an AppSignal
830
+ # @yield [] yields the given block of code instrumented in an AppSignal
786
831
  # event.
787
832
  # @return [Object] Returns the block's return value.
788
833
  #
@@ -824,14 +869,16 @@ module Appsignal
824
869
  # # Only the "my_event.my_group" instrumentation event is reported.
825
870
  #
826
871
  # @since 3.10.0
827
- # @yield block of code that shouldn't be instrumented.
828
- # @return [Object] Returns the return value of the block.
872
+ # @yield [] block of code that shouldn't be instrumented.
873
+ # @yieldreturn [Object] The return value of the block
874
+ # @return [Object, nil] Returns the return value of the block.
875
+ # Return nil if the block returns nil or no block is given.
829
876
  #
830
877
  # @see https://docs.appsignal.com/ruby/instrumentation/ignore-instrumentation.html
831
878
  # Ignore instrumentation guide
832
879
  def ignore_instrumentation_events
833
880
  Appsignal::Transaction.current&.pause!
834
- yield
881
+ yield if block_given?
835
882
  ensure
836
883
  Appsignal::Transaction.current&.resume!
837
884
  end
@@ -8,9 +8,10 @@ module Appsignal
8
8
  # @since 2.6.0
9
9
  # @param name [String, Symbol] The name of the metric.
10
10
  # @param value [Integer, Float] The value of the metric.
11
- # @param tags [Hash] The tags for the metric. The Hash keys can be either
12
- # a String or a Symbol. The tag values can be a String, Symbol,
13
- # Integer, Float, TrueClass or FalseClass.
11
+ # @param tags [Hash<String, Object>] The tags for the metric. The Hash
12
+ # keys can be either a String or a Symbol. The tag values can be a
13
+ # String, Symbol, Integer, Float, TrueClass or FalseClass.
14
+ # @return [void]
14
15
  #
15
16
  # @see https://docs.appsignal.com/metrics/custom.html
16
17
  # Metrics documentation
@@ -30,9 +31,10 @@ module Appsignal
30
31
  # @since 2.6.0
31
32
  # @param name [String, Symbol] The name of the metric.
32
33
  # @param value [Integer, Float] The value of the metric.
33
- # @param tags [Hash] The tags for the metric. The Hash keys can be either
34
- # a String or a Symbol. The tag values can be a String, Symbol,
35
- # Integer, Float, TrueClass or FalseClass.
34
+ # @param tags [Hash<String, Object>] The tags for the metric. The Hash
35
+ # keys can be either a String or a Symbol. The tag values can be a
36
+ # String, Symbol, Integer, Float, TrueClass or FalseClass.
37
+ # @return [void]
36
38
  #
37
39
  # @see https://docs.appsignal.com/metrics/custom.html
38
40
  # Metrics documentation
@@ -52,9 +54,10 @@ module Appsignal
52
54
  # @since 2.6.0
53
55
  # @param name [String, Symbol] The name of the metric.
54
56
  # @param value [Integer, Float] The value of the metric.
55
- # @param tags [Hash] The tags for the metric. The Hash keys can be either
56
- # a String or a Symbol. The tag values can be a String, Symbol,
57
- # Integer, Float, TrueClass or FalseClass.
57
+ # @param tags [Hash<String, Object>] The tags for the metric. The Hash
58
+ # keys can be either a String or a Symbol. The tag values can be a
59
+ # String, Symbol, Integer, Float, TrueClass or FalseClass.
60
+ # @return [void]
58
61
  #
59
62
  # @see https://docs.appsignal.com/metrics/custom.html
60
63
  # Metrics documentation
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
- # @api private
5
+ # @!visibility private
6
6
  class ActionCableHook < Appsignal::Hooks::Hook
7
7
  register :action_cable
8
8
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
+ # @!visibility private
5
6
  class ActionMailerHook < Appsignal::Hooks::Hook
6
7
  register :action_mailer
7
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
- # @api private
5
+ # @!visibility private
6
6
  class ActiveJobHook < Appsignal::Hooks::Hook
7
7
  register :active_job
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
- # @api private
5
+ # @!visibility private
6
6
  class ActiveSupportNotificationsHook < Appsignal::Hooks::Hook
7
7
  register :active_support_notifications
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
- # @api private
5
+ # @!visibility private
6
6
  class AtExit < Appsignal::Hooks::Hook
7
7
  register :at_exit
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
- # @api private
5
+ # @!visibility private
6
6
  class CelluloidHook < Appsignal::Hooks::Hook
7
7
  register :celluloid
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
- # @api private
5
+ # @!visibility private
6
6
  class DataMapperHook < Appsignal::Hooks::Hook
7
7
  register :data_mapper
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
- # @api private
5
+ # @!visibility private
6
6
  class DelayedJobHook < Appsignal::Hooks::Hook
7
7
  register :delayed_job
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
- # @api private
5
+ # @!visibility private
6
6
  class DryMonitorHook < Appsignal::Hooks::Hook
7
7
  register :dry_monitor
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
- # @api private
5
+ # @!visibility private
6
6
  class ExconHook < Appsignal::Hooks::Hook
7
7
  register :excon
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
- # @api private
5
+ # @!visibility private
6
6
  class GvlHook < Appsignal::Hooks::Hook
7
7
  register :gvl
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
- # @api private
5
+ # @!visibility private
6
6
  class HttpHook < Appsignal::Hooks::Hook
7
7
  register :http_rb
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
- # @api private
5
+ # @!visibility private
6
6
  class MongoRubyDriverHook < Appsignal::Hooks::Hook
7
7
  register :mongo_ruby_driver
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
- # @api private
5
+ # @!visibility private
6
6
  class MriHook < Appsignal::Hooks::Hook
7
7
  register :mri
8
8
 
@@ -4,7 +4,7 @@ require "net/http"
4
4
 
5
5
  module Appsignal
6
6
  class Hooks
7
- # @api private
7
+ # @!visibility private
8
8
  class NetHttpHook < Appsignal::Hooks::Hook
9
9
  register :net_http
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
- # @api private
5
+ # @!visibility private
6
6
  class OwnershipHook < Appsignal::Hooks::Hook
7
7
  register :ownership
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
- # @api private
5
+ # @!visibility private
6
6
  class PassengerHook < Appsignal::Hooks::Hook
7
7
  register :passenger
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
- # @api private
5
+ # @!visibility private
6
6
  class PumaHook < Appsignal::Hooks::Hook
7
7
  register :puma
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
- # @api private
5
+ # @!visibility private
6
6
  class QueHook < Appsignal::Hooks::Hook
7
7
  register :que
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Appsignal
4
4
  class Hooks
5
- # @api private
5
+ # @!visibility private
6
6
  class RakeHook < Appsignal::Hooks::Hook
7
7
  register :rake
8
8