appsignal 4.10.4-java → 5.0.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +108 -0
- data/Rakefile +195 -4
- data/appsignal.gemspec +8 -0
- data/build_matrix.yml +12 -0
- data/ext/appsignal_extension.c +14 -0
- data/lib/appsignal/backends.rb +55 -0
- data/lib/appsignal/cli/diagnose.rb +2 -10
- data/lib/appsignal/config.rb +377 -13
- data/lib/appsignal/demo.rb +12 -10
- data/lib/appsignal/event_formatter/action_view/render_formatter.rb +34 -22
- data/lib/appsignal/event_formatter/active_job/perform_formatter.rb +35 -0
- data/lib/appsignal/event_formatter/active_record/sql_formatter.rb +19 -0
- data/lib/appsignal/event_formatter/elastic_search/search_formatter.rb +27 -0
- data/lib/appsignal/event_formatter/recorded_elsewhere.rb +17 -0
- data/lib/appsignal/event_formatter/rom/sql_formatter.rb +24 -0
- data/lib/appsignal/event_formatter/sequel/sql_formatter.rb +5 -0
- data/lib/appsignal/event_formatter/view_component/render_formatter.rb +21 -10
- data/lib/appsignal/event_formatter.rb +78 -0
- data/lib/appsignal/extension.rb +4 -0
- data/lib/appsignal/helpers/instrumentation.rb +324 -20
- data/lib/appsignal/helpers/metrics.rb +3 -24
- data/lib/appsignal/hooks/action_cable.rb +26 -8
- data/lib/appsignal/hooks/active_job.rb +184 -47
- data/lib/appsignal/hooks/at_exit.rb +4 -1
- data/lib/appsignal/hooks/excon.rb +20 -0
- data/lib/appsignal/hooks/faraday.rb +16 -0
- data/lib/appsignal/hooks/http.rb +5 -0
- data/lib/appsignal/hooks/resque.rb +1 -1
- data/lib/appsignal/hooks/sequel.rb +32 -2
- data/lib/appsignal/hooks/shoryuken.rb +3 -3
- data/lib/appsignal/hooks/sidekiq.rb +1 -1
- data/lib/appsignal/integrations/action_cable.rb +5 -2
- data/lib/appsignal/integrations/active_support_notifications.rb +59 -19
- data/lib/appsignal/integrations/data_mapper.rb +14 -2
- data/lib/appsignal/integrations/delayed_job_plugin.rb +81 -8
- data/lib/appsignal/integrations/dry_monitor.rb +39 -15
- data/lib/appsignal/integrations/excon/appsignal_middleware.rb +21 -0
- data/lib/appsignal/integrations/excon.rb +52 -15
- data/lib/appsignal/integrations/faraday.rb +47 -12
- data/lib/appsignal/integrations/http.rb +43 -1
- data/lib/appsignal/integrations/mongo_ruby_driver.rb +73 -4
- data/lib/appsignal/integrations/net_http.rb +31 -2
- data/lib/appsignal/integrations/puma.rb +4 -1
- data/lib/appsignal/integrations/que.rb +256 -37
- data/lib/appsignal/integrations/railtie.rb +4 -1
- data/lib/appsignal/integrations/rake.rb +9 -3
- data/lib/appsignal/integrations/redis.rb +22 -1
- data/lib/appsignal/integrations/redis_client.rb +22 -1
- data/lib/appsignal/integrations/resque.rb +81 -11
- data/lib/appsignal/integrations/shoryuken.rb +159 -12
- data/lib/appsignal/integrations/sidekiq.rb +94 -16
- data/lib/appsignal/integrations/webmachine.rb +56 -5
- data/lib/appsignal/loaders/padrino.rb +2 -1
- data/lib/appsignal/logger/extension_backend.rb +24 -0
- data/lib/appsignal/logger/opentelemetry_backend.rb +66 -0
- data/lib/appsignal/logger.rb +13 -9
- data/lib/appsignal/metrics/extension_backend.rb +47 -0
- data/lib/appsignal/metrics/opentelemetry_backend.rb +89 -0
- data/lib/appsignal/opentelemetry/attributes.rb +31 -0
- data/lib/appsignal/opentelemetry/dependencies.rb +35 -0
- data/lib/appsignal/opentelemetry/error_type.rb +37 -0
- data/lib/appsignal/opentelemetry/http_client_request.rb +83 -0
- data/lib/appsignal/opentelemetry/http_method.rb +59 -0
- data/lib/appsignal/opentelemetry/http_response.rb +30 -0
- data/lib/appsignal/opentelemetry/http_server_request.rb +79 -0
- data/lib/appsignal/opentelemetry/messaging.rb +82 -0
- data/lib/appsignal/opentelemetry/proxied_exporter.rb +83 -0
- data/lib/appsignal/opentelemetry/rendering.rb +29 -0
- data/lib/appsignal/opentelemetry/sql_db_system.rb +89 -0
- data/lib/appsignal/opentelemetry.rb +495 -0
- data/lib/appsignal/rack/abstract_middleware.rb +66 -4
- data/lib/appsignal/rack/body_wrapper.rb +18 -5
- data/lib/appsignal/rack/event_handler.rb +44 -4
- data/lib/appsignal/rack/grape_middleware.rb +1 -0
- data/lib/appsignal/rack/hanami_middleware.rb +2 -1
- data/lib/appsignal/rack/instrumentation_middleware.rb +1 -0
- data/lib/appsignal/rack/rails_instrumentation.rb +1 -0
- data/lib/appsignal/rack/sinatra_instrumentation.rb +1 -0
- data/lib/appsignal/rack.rb +68 -12
- data/lib/appsignal/sample_data.rb +4 -0
- data/lib/appsignal/transaction/base_backend.rb +128 -0
- data/lib/appsignal/transaction/extension_backend.rb +229 -0
- data/lib/appsignal/transaction/opentelemetry_backend.rb +847 -0
- data/lib/appsignal/transaction.rb +714 -164
- data/lib/appsignal/utils/request_headers.rb +78 -0
- data/lib/appsignal/utils/stdout_and_logger_message.rb +9 -0
- data/lib/appsignal/utils.rb +1 -0
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +10 -0
- data/sig/appsignal.rbi +630 -37
- data/sig/appsignal.rbs +582 -27
- metadata +25 -1
data/sig/appsignal.rbi
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
module Appsignal
|
|
9
9
|
extend Appsignal::Helpers::Metrics
|
|
10
10
|
extend Appsignal::Helpers::Instrumentation
|
|
11
|
-
VERSION = T.let("
|
|
11
|
+
VERSION = T.let("5.0.0", T.untyped)
|
|
12
12
|
|
|
13
13
|
class << self
|
|
14
14
|
# The loaded AppSignal configuration.
|
|
@@ -301,6 +301,14 @@ module Appsignal
|
|
|
301
301
|
#
|
|
302
302
|
# _@param_ `action` — The action name for the transaction. The action name is required to be set for the transaction to be reported. The argument can be set to `nil` or `:set_later` if the action is set within the block with {#set_action}. This will not update the active transaction's action if {.monitor} is called when another transaction is already active.
|
|
303
303
|
#
|
|
304
|
+
# _@param_ `opentelemetry_kind` — In collector mode, the OpenTelemetry span kind: one of `:server`, `:consumer`, `:producer` or `:internal`. Defaults to `:server`.
|
|
305
|
+
#
|
|
306
|
+
# _@param_ `opentelemetry_relationship` — In collector mode, how an incoming `opentelemetry_context` relates to this transaction's span: one of `:parent`, `:link`, `:both` or `:none`. Defaults to `:parent`.
|
|
307
|
+
#
|
|
308
|
+
# _@param_ `opentelemetry_context` — In collector mode, an incoming OpenTelemetry trace context to relate this transaction's span to.
|
|
309
|
+
#
|
|
310
|
+
# _@param_ `opentelemetry_scope` — In collector mode, the OpenTelemetry instrumentation scope to record this transaction's spans under, given as a `[name, version]` pair. Defaults to the AppSignal scope.
|
|
311
|
+
#
|
|
304
312
|
# _@return_ — The value of the given block is returned.
|
|
305
313
|
# Returns `nil` if there already is a transaction active and no block
|
|
306
314
|
# was given.
|
|
@@ -391,8 +399,18 @@ module Appsignal
|
|
|
391
399
|
# ```
|
|
392
400
|
#
|
|
393
401
|
# _@see_ `https://docs.appsignal.com/ruby/instrumentation/background-jobs.html` — Monitor guide
|
|
394
|
-
sig
|
|
395
|
-
|
|
402
|
+
sig do
|
|
403
|
+
params(
|
|
404
|
+
action: T.any(String, Symbol, NilClass),
|
|
405
|
+
namespace: T.nilable(T.any(String, Symbol)),
|
|
406
|
+
opentelemetry_context: T.untyped,
|
|
407
|
+
opentelemetry_scope: T.nilable([String, String]),
|
|
408
|
+
opentelemetry_kind: T.nilable(Symbol),
|
|
409
|
+
opentelemetry_relationship: T.nilable(Symbol),
|
|
410
|
+
blk: T.proc.returns(Object)
|
|
411
|
+
).returns(T.nilable(Object))
|
|
412
|
+
end
|
|
413
|
+
def self.monitor(action:, namespace: nil, opentelemetry_context: nil, opentelemetry_scope: nil, opentelemetry_kind: nil, opentelemetry_relationship: nil, &blk); end
|
|
396
414
|
|
|
397
415
|
# Instrument a block of code and stop AppSignal.
|
|
398
416
|
#
|
|
@@ -406,11 +424,29 @@ module Appsignal
|
|
|
406
424
|
#
|
|
407
425
|
# _@param_ `action` — The action name for the transaction. The action name is required to be set for the transaction to be reported. The argument can be set to `nil` or `:set_later` if the action is set within the block with {#set_action}. This will not update the active transaction's action if {.monitor} is called when another transaction is already active.
|
|
408
426
|
#
|
|
427
|
+
# _@param_ `opentelemetry_kind` — In collector mode, the OpenTelemetry span kind: one of `:server`, `:consumer`, `:producer` or `:internal`. Defaults to `:server`.
|
|
428
|
+
#
|
|
429
|
+
# _@param_ `opentelemetry_relationship` — In collector mode, how an incoming `opentelemetry_context` relates to this transaction's span: one of `:parent`, `:link`, `:both` or `:none`. Defaults to `:parent`.
|
|
430
|
+
#
|
|
431
|
+
# _@param_ `opentelemetry_context` — In collector mode, an incoming OpenTelemetry trace context to relate this transaction's span to.
|
|
432
|
+
#
|
|
433
|
+
# _@param_ `opentelemetry_scope` — In collector mode, the OpenTelemetry instrumentation scope to record this transaction's spans under, given as a `[name, version]` pair. Defaults to the AppSignal scope.
|
|
434
|
+
#
|
|
409
435
|
# _@return_ — The value of the given block is returned.
|
|
410
436
|
#
|
|
411
437
|
# _@see_ `monitor`
|
|
412
|
-
sig
|
|
413
|
-
|
|
438
|
+
sig do
|
|
439
|
+
params(
|
|
440
|
+
action: T.any(String, Symbol, NilClass),
|
|
441
|
+
namespace: T.nilable(T.any(String, Symbol)),
|
|
442
|
+
opentelemetry_context: T.untyped,
|
|
443
|
+
opentelemetry_scope: T.nilable([String, String]),
|
|
444
|
+
opentelemetry_kind: T.nilable(Symbol),
|
|
445
|
+
opentelemetry_relationship: T.nilable(Symbol),
|
|
446
|
+
block: T.proc.returns(Object)
|
|
447
|
+
).returns(T.nilable(Object))
|
|
448
|
+
end
|
|
449
|
+
def self.monitor_and_stop(action:, namespace: nil, opentelemetry_context: nil, opentelemetry_scope: nil, opentelemetry_kind: nil, opentelemetry_relationship: nil, &block); end
|
|
414
450
|
|
|
415
451
|
# Send an error to AppSignal regardless of the context.
|
|
416
452
|
#
|
|
@@ -429,6 +465,14 @@ module Appsignal
|
|
|
429
465
|
#
|
|
430
466
|
# _@param_ `error` — The error to send to AppSignal.
|
|
431
467
|
#
|
|
468
|
+
# _@param_ `opentelemetry_kind` — In collector mode, the OpenTelemetry span kind: one of `:server`, `:consumer`, `:producer` or `:internal`. Defaults to `:server`.
|
|
469
|
+
#
|
|
470
|
+
# _@param_ `opentelemetry_relationship` — In collector mode, how an incoming `opentelemetry_context` relates to this transaction's span: one of `:parent`, `:link`, `:both` or `:none`. Defaults to `:parent`.
|
|
471
|
+
#
|
|
472
|
+
# _@param_ `opentelemetry_context` — In collector mode, an incoming OpenTelemetry trace context to relate this transaction's span to.
|
|
473
|
+
#
|
|
474
|
+
# _@param_ `opentelemetry_scope` — In collector mode, the OpenTelemetry instrumentation scope to record this transaction's spans under, given as a `[name, version]` pair. Defaults to the AppSignal scope.
|
|
475
|
+
#
|
|
432
476
|
# Send an exception
|
|
433
477
|
# ```ruby
|
|
434
478
|
# begin
|
|
@@ -449,8 +493,17 @@ module Appsignal
|
|
|
449
493
|
# ```
|
|
450
494
|
#
|
|
451
495
|
# _@see_ `https://docs.appsignal.com/ruby/instrumentation/exception-handling.html` — Exception handling guide
|
|
452
|
-
sig
|
|
453
|
-
|
|
496
|
+
sig do
|
|
497
|
+
params(
|
|
498
|
+
error: Exception,
|
|
499
|
+
opentelemetry_context: T.untyped,
|
|
500
|
+
opentelemetry_scope: T.nilable([String, String]),
|
|
501
|
+
opentelemetry_kind: T.nilable(Symbol),
|
|
502
|
+
opentelemetry_relationship: T.nilable(Symbol),
|
|
503
|
+
block: T.proc.params(transaction: Transaction).void
|
|
504
|
+
).void
|
|
505
|
+
end
|
|
506
|
+
def self.send_error(error, opentelemetry_context: nil, opentelemetry_scope: nil, opentelemetry_kind: nil, opentelemetry_relationship: nil, &block); end
|
|
454
507
|
|
|
455
508
|
# Set an error on the current transaction.
|
|
456
509
|
#
|
|
@@ -523,6 +576,14 @@ module Appsignal
|
|
|
523
576
|
#
|
|
524
577
|
# _@param_ `exception` — The error to add to the current transaction.
|
|
525
578
|
#
|
|
579
|
+
# _@param_ `opentelemetry_kind` — In collector mode, the OpenTelemetry span kind: one of `:server`, `:consumer`, `:producer` or `:internal`. Defaults to `:server`. Only used when a new transaction is created.
|
|
580
|
+
#
|
|
581
|
+
# _@param_ `opentelemetry_relationship` — In collector mode, how an incoming `opentelemetry_context` relates to this transaction's span: one of `:parent`, `:link`, `:both` or `:none`. Defaults to `:parent`. Only used when a new transaction is created.
|
|
582
|
+
#
|
|
583
|
+
# _@param_ `opentelemetry_context` — In collector mode, an incoming OpenTelemetry trace context to relate this transaction's span to. Only used when a new transaction is created.
|
|
584
|
+
#
|
|
585
|
+
# _@param_ `opentelemetry_scope` — In collector mode, the OpenTelemetry instrumentation scope to record this transaction's spans under, given as a `[name, version]` pair. Defaults to the AppSignal scope.
|
|
586
|
+
#
|
|
526
587
|
# ```ruby
|
|
527
588
|
# class SomeController < ApplicationController
|
|
528
589
|
# def create
|
|
@@ -544,8 +605,17 @@ module Appsignal
|
|
|
544
605
|
# ```
|
|
545
606
|
#
|
|
546
607
|
# _@see_ `https://docs.appsignal.com/ruby/instrumentation/exception-handling.html` — Exception handling guide
|
|
547
|
-
sig
|
|
548
|
-
|
|
608
|
+
sig do
|
|
609
|
+
params(
|
|
610
|
+
exception: Exception,
|
|
611
|
+
opentelemetry_context: T.untyped,
|
|
612
|
+
opentelemetry_scope: T.nilable([String, String]),
|
|
613
|
+
opentelemetry_kind: T.nilable(Symbol),
|
|
614
|
+
opentelemetry_relationship: T.nilable(Symbol),
|
|
615
|
+
block: T.proc.params(transaction: Transaction).void
|
|
616
|
+
).void
|
|
617
|
+
end
|
|
618
|
+
def self.report_error(exception, opentelemetry_context: nil, opentelemetry_scope: nil, opentelemetry_kind: nil, opentelemetry_relationship: nil, &block); end
|
|
549
619
|
|
|
550
620
|
# Set a custom action name for the current transaction.
|
|
551
621
|
#
|
|
@@ -743,16 +813,65 @@ module Appsignal
|
|
|
743
813
|
sig { params(params: T.nilable(T.any(T::Hash[String, Object], T::Array[Object])), block: T.proc.returns(T.any(T::Hash[String, Object], T::Array[Object]))).void }
|
|
744
814
|
def self.add_params(params = nil, &block); end
|
|
745
815
|
|
|
816
|
+
# Add the request payload to the current transaction.
|
|
817
|
+
#
|
|
818
|
+
# The request payload is the parameters of an incoming request, such as
|
|
819
|
+
# the query string and the request body. In collector mode it maps to its
|
|
820
|
+
# own attribute, separate from the function parameters.
|
|
821
|
+
#
|
|
822
|
+
# Behaves like {#add_params}: merges when called multiple times, and a
|
|
823
|
+
# block takes precedence over the argument.
|
|
824
|
+
#
|
|
825
|
+
# _@param_ `params` — The request payload to add to the transaction.
|
|
826
|
+
#
|
|
827
|
+
# _@see_ `#add_function_parameters`
|
|
828
|
+
sig { params(params: T.nilable(T.any(T::Hash[String, Object], T::Array[Object])), block: T.proc.returns(T.any(T::Hash[String, Object], T::Array[Object]))).void }
|
|
829
|
+
def self.add_request_payload(params = nil, &block); end
|
|
830
|
+
|
|
831
|
+
# Add the function parameters to the current transaction.
|
|
832
|
+
#
|
|
833
|
+
# The function parameters are the arguments a background job or function
|
|
834
|
+
# was called with. In collector mode they map to their own attribute,
|
|
835
|
+
# separate from the request payload.
|
|
836
|
+
#
|
|
837
|
+
# Behaves like {#add_params}: merges when called multiple times, and a
|
|
838
|
+
# block takes precedence over the argument.
|
|
839
|
+
#
|
|
840
|
+
# _@param_ `params` — The function parameters to add to the transaction.
|
|
841
|
+
#
|
|
842
|
+
# _@see_ `#add_request_payload`
|
|
843
|
+
sig { params(params: T.nilable(T.any(T::Hash[String, Object], T::Array[Object])), block: T.proc.returns(T.any(T::Hash[String, Object], T::Array[Object]))).void }
|
|
844
|
+
def self.add_function_parameters(params = nil, &block); end
|
|
845
|
+
|
|
846
|
+
# Add the query parameters to the current transaction.
|
|
847
|
+
#
|
|
848
|
+
# The query parameters are the parameters parsed from an incoming
|
|
849
|
+
# request's query string. In collector mode they map to their own
|
|
850
|
+
# attribute, separate from the request payload and the function
|
|
851
|
+
# parameters.
|
|
852
|
+
#
|
|
853
|
+
# Behaves like {#add_params}: merges when called multiple times, and a
|
|
854
|
+
# block takes precedence over the argument.
|
|
855
|
+
#
|
|
856
|
+
# _@param_ `params` — The query parameters to add to the transaction.
|
|
857
|
+
#
|
|
858
|
+
# _@see_ `#add_request_payload`
|
|
859
|
+
sig { params(params: T.nilable(T.any(T::Hash[String, Object], T::Array[Object])), block: T.proc.returns(T.any(T::Hash[String, Object], T::Array[Object]))).void }
|
|
860
|
+
def self.add_query_parameters(params = nil, &block); end
|
|
861
|
+
|
|
746
862
|
# Mark the parameters sample data to be set as an empty value.
|
|
747
863
|
#
|
|
748
|
-
# Use this helper to
|
|
749
|
-
#
|
|
864
|
+
# Use this helper to report no parameters for this transaction, whatever
|
|
865
|
+
# their source.
|
|
750
866
|
#
|
|
751
|
-
#
|
|
752
|
-
#
|
|
867
|
+
# This suppresses every params channel. In collector mode, where the
|
|
868
|
+
# request payload and the function parameters (a background job's
|
|
869
|
+
# arguments) are tracked as separate attributes, it suppresses both, not
|
|
870
|
+
# only the request payload. Parameters that an AppSignal integration would
|
|
871
|
+
# otherwise add are not added.
|
|
753
872
|
#
|
|
754
|
-
# Calling {#add_params}
|
|
755
|
-
#
|
|
873
|
+
# Calling {#add_params}, {#add_request_payload} or
|
|
874
|
+
# {#add_function_parameters} after this helper adds parameters again.
|
|
756
875
|
#
|
|
757
876
|
# _@see_ `Transaction#set_empty_params!`
|
|
758
877
|
#
|
|
@@ -822,18 +941,95 @@ module Appsignal
|
|
|
822
941
|
# # { "PATH_INFO" => "/some-path", "HTTP_USER_AGENT" => "Firefox" }
|
|
823
942
|
# ```
|
|
824
943
|
#
|
|
944
|
+
# _@deprecated_ — Use {#add_request_headers} for request headers and
|
|
945
|
+
# {#add_request_environment} for the values a Rack environment holds
|
|
946
|
+
# that are not request headers. This method takes both kinds at once,
|
|
947
|
+
# so it has to work out which of them each value is.
|
|
948
|
+
#
|
|
949
|
+
# _@see_ `#add_request_headers`
|
|
950
|
+
#
|
|
951
|
+
# _@see_ `#add_request_environment`
|
|
952
|
+
#
|
|
825
953
|
# _@see_ `https://docs.appsignal.com/guides/custom-data/sample-data.html` — Sample data guide
|
|
826
954
|
#
|
|
827
955
|
# _@see_ `https://docs.appsignal.com/guides/filter-data/filter-headers.html` — Request headers filtering guide
|
|
828
956
|
sig { params(headers: T.nilable(T::Hash[String, Object]), block: T.proc.returns(T::Hash[String, Object])).void }
|
|
829
957
|
def self.add_headers(headers = nil, &block); end
|
|
830
958
|
|
|
959
|
+
# Add request headers to the current transaction.
|
|
960
|
+
#
|
|
961
|
+
# Request headers are automatically added by most of our integrations. It
|
|
962
|
+
# should not be necessary to call this method unless you want to also
|
|
963
|
+
# report different request headers.
|
|
964
|
+
#
|
|
965
|
+
# Name each header the way OpenTelemetry names it, in lowercase and with
|
|
966
|
+
# dashes. In agent mode the names are converted to the Rack spellings the
|
|
967
|
+
# environment uses, so `accept` is reported as `HTTP_ACCEPT`.
|
|
968
|
+
#
|
|
969
|
+
# To filter request headers, see our request header filtering guide.
|
|
970
|
+
#
|
|
971
|
+
# When both the `headers` argument and a block is given to this method,
|
|
972
|
+
# the block is leading and the argument will _not_ be used.
|
|
973
|
+
#
|
|
974
|
+
# _@param_ `headers` — The request headers to add to the transaction.
|
|
975
|
+
#
|
|
976
|
+
# Add request headers
|
|
977
|
+
# ```ruby
|
|
978
|
+
# Appsignal.add_request_headers("accept" => "text/html")
|
|
979
|
+
# # The request headers will include:
|
|
980
|
+
# # { "accept" => "text/html" }
|
|
981
|
+
# ```
|
|
982
|
+
#
|
|
983
|
+
# Calling `add_request_headers` multiple times merges the values
|
|
984
|
+
# ```ruby
|
|
985
|
+
# Appsignal.add_request_headers("accept" => "text/html")
|
|
986
|
+
# Appsignal.add_request_headers("user-agent" => "Firefox")
|
|
987
|
+
# # The request headers will include:
|
|
988
|
+
# # { "accept" => "text/html", "user-agent" => "Firefox" }
|
|
989
|
+
# ```
|
|
990
|
+
#
|
|
991
|
+
# _@see_ `#add_request_environment`
|
|
992
|
+
#
|
|
993
|
+
# _@see_ `https://docs.appsignal.com/guides/custom-data/sample-data.html` — Sample data guide
|
|
994
|
+
#
|
|
995
|
+
# _@see_ `https://docs.appsignal.com/guides/filter-data/filter-headers.html` — Request headers filtering guide
|
|
996
|
+
sig { params(headers: T.nilable(T::Hash[String, Object]), block: T.proc.returns(T::Hash[String, Object])).void }
|
|
997
|
+
def self.add_request_headers(headers = nil, &block); end
|
|
998
|
+
|
|
999
|
+
# Add values from the request environment to the current transaction.
|
|
1000
|
+
#
|
|
1001
|
+
# These are the values a Rack environment holds that are not request
|
|
1002
|
+
# headers, such as `REMOTE_ADDR` and `QUERY_STRING`. Name each one the
|
|
1003
|
+
# way Rack names it. Use {#add_request_headers} for the request headers.
|
|
1004
|
+
#
|
|
1005
|
+
# The request environment is automatically added by most of our
|
|
1006
|
+
# integrations. It should not be necessary to call this method unless you
|
|
1007
|
+
# want to also report different values.
|
|
1008
|
+
#
|
|
1009
|
+
# When both the `environment` argument and a block is given to this
|
|
1010
|
+
# method, the block is leading and the argument will _not_ be used.
|
|
1011
|
+
#
|
|
1012
|
+
# _@param_ `environment` — The request environment values to add to the transaction.
|
|
1013
|
+
#
|
|
1014
|
+
# Add request environment values
|
|
1015
|
+
# ```ruby
|
|
1016
|
+
# Appsignal.add_request_environment("REMOTE_ADDR" => "127.0.0.1")
|
|
1017
|
+
# # The request environment will include:
|
|
1018
|
+
# # { "REMOTE_ADDR" => "127.0.0.1" }
|
|
1019
|
+
# ```
|
|
1020
|
+
#
|
|
1021
|
+
# _@see_ `#add_request_headers`
|
|
1022
|
+
#
|
|
1023
|
+
# _@see_ `https://docs.appsignal.com/guides/custom-data/sample-data.html` — Sample data guide
|
|
1024
|
+
sig { params(environment: T.nilable(T::Hash[String, Object]), block: T.proc.returns(T::Hash[String, Object])).void }
|
|
1025
|
+
def self.add_request_environment(environment = nil, &block); end
|
|
1026
|
+
|
|
831
1027
|
# Add breadcrumbs to the transaction.
|
|
832
1028
|
#
|
|
833
1029
|
# Breadcrumbs can be used to trace what path a user has taken
|
|
834
1030
|
# before encountering an error.
|
|
835
1031
|
#
|
|
836
|
-
#
|
|
1032
|
+
# At most 20 of the added breadcrumbs will be saved.
|
|
837
1033
|
#
|
|
838
1034
|
# _@param_ `category` — category of breadcrumb e.g. "UI", "Network", "Navigation", "Console".
|
|
839
1035
|
#
|
|
@@ -891,6 +1087,10 @@ module Appsignal
|
|
|
891
1087
|
#
|
|
892
1088
|
# _@param_ `body_format` — Enum for the type of event that is instrumented. Accepted values are {EventFormatter::DEFAULT} and {EventFormatter::SQL_BODY_FORMAT}, but we recommend you use {.instrument_sql} instead of {EventFormatter::SQL_BODY_FORMAT}.
|
|
893
1089
|
#
|
|
1090
|
+
# _@param_ `opentelemetry_kind` — In collector mode, the OpenTelemetry span kind for the event's span, such as `:client` for an outgoing HTTP request. Defaults to the OpenTelemetry default of `:internal`.
|
|
1091
|
+
#
|
|
1092
|
+
# _@param_ `opentelemetry_scope` — In collector mode, the OpenTelemetry instrumentation scope to record the event's span under, given as a `[name, version]` pair. Defaults to the AppSignal scope.
|
|
1093
|
+
#
|
|
894
1094
|
# _@return_ — Returns the block's return value.
|
|
895
1095
|
#
|
|
896
1096
|
# Simple instrumentation
|
|
@@ -922,10 +1122,12 @@ module Appsignal
|
|
|
922
1122
|
title: T.nilable(String),
|
|
923
1123
|
body: T.nilable(String),
|
|
924
1124
|
body_format: Integer,
|
|
1125
|
+
opentelemetry_kind: T.nilable(Symbol),
|
|
1126
|
+
opentelemetry_scope: T.nilable([String, String]),
|
|
925
1127
|
block: T.untyped
|
|
926
1128
|
).returns(Object)
|
|
927
1129
|
end
|
|
928
|
-
def self.instrument(name, title = nil, body = nil, body_format = Appsignal::EventFormatter::DEFAULT, &block); end
|
|
1130
|
+
def self.instrument(name, title = nil, body = nil, body_format = Appsignal::EventFormatter::DEFAULT, opentelemetry_kind: nil, opentelemetry_scope: nil, &block); end
|
|
929
1131
|
|
|
930
1132
|
# Instrumentation helper for SQL queries.
|
|
931
1133
|
#
|
|
@@ -937,6 +1139,10 @@ module Appsignal
|
|
|
937
1139
|
#
|
|
938
1140
|
# _@param_ `body` — SQL query that's being executed.
|
|
939
1141
|
#
|
|
1142
|
+
# _@param_ `opentelemetry_kind` — In collector mode, the OpenTelemetry span kind for the event's span. Defaults to `:client`, because a query is an outgoing call to a datastore. Pass `:internal` for a query that is not an outgoing call.
|
|
1143
|
+
#
|
|
1144
|
+
# _@param_ `opentelemetry_scope` — In collector mode, the OpenTelemetry instrumentation scope to record the event's span under, given as a `[name, version]` pair. Defaults to the AppSignal scope.
|
|
1145
|
+
#
|
|
940
1146
|
# _@return_ — Returns the block's return value.
|
|
941
1147
|
#
|
|
942
1148
|
# SQL query instrumentation
|
|
@@ -965,10 +1171,12 @@ module Appsignal
|
|
|
965
1171
|
name: String,
|
|
966
1172
|
title: T.nilable(String),
|
|
967
1173
|
body: T.nilable(String),
|
|
1174
|
+
opentelemetry_kind: Symbol,
|
|
1175
|
+
opentelemetry_scope: T.nilable([String, String]),
|
|
968
1176
|
block: T.untyped
|
|
969
1177
|
).returns(Object)
|
|
970
1178
|
end
|
|
971
|
-
def self.instrument_sql(name, title = nil, body = nil, &block); end
|
|
1179
|
+
def self.instrument_sql(name, title = nil, body = nil, opentelemetry_kind: :client, opentelemetry_scope: nil, &block); end
|
|
972
1180
|
|
|
973
1181
|
# Convenience method for ignoring instrumentation events in a block of
|
|
974
1182
|
# code.
|
|
@@ -1041,6 +1249,38 @@ module Appsignal
|
|
|
1041
1249
|
sig { returns(T::Boolean) }
|
|
1042
1250
|
def active?; end
|
|
1043
1251
|
|
|
1252
|
+
# Check if collector mode is configured.
|
|
1253
|
+
#
|
|
1254
|
+
# Returns true when a non-empty `collector_endpoint` is set and the
|
|
1255
|
+
# running Ruby version is at least {MIN_RUBY_VERSION_FOR_COLLECTOR_MODE}.
|
|
1256
|
+
# On older Rubies, `collector_endpoint` is ignored (with a warning) and
|
|
1257
|
+
# the AppSignal agent is used instead.
|
|
1258
|
+
#
|
|
1259
|
+
# This is the *intent* check — it answers "did the user ask for
|
|
1260
|
+
# collector mode, and could we honor it?". It does not say whether the
|
|
1261
|
+
# OpenTelemetry SDK actually booted. See {#collector_mode?} for that.
|
|
1262
|
+
#
|
|
1263
|
+
# Memoised: the result is cached on first call so hot paths avoid
|
|
1264
|
+
# re-running the string-strip predicate, and so the unsupported-Ruby
|
|
1265
|
+
# warning is emitted at most once per `Config` instance.
|
|
1266
|
+
#
|
|
1267
|
+
# _@return_ — True if collector mode is configured.
|
|
1268
|
+
sig { returns(T::Boolean) }
|
|
1269
|
+
def collector_mode_configured?; end
|
|
1270
|
+
|
|
1271
|
+
# Check if AppSignal is actively running in collector mode.
|
|
1272
|
+
#
|
|
1273
|
+
# True only if collector mode is {#collector_mode_configured? configured}
|
|
1274
|
+
# *and* `Appsignal::OpenTelemetry.configure` has successfully booted the
|
|
1275
|
+
# SDK in this process. Use this for backend dispatch on hot paths
|
|
1276
|
+
# (metric and log emits): if the OTel boot failed, callers fall back to
|
|
1277
|
+
# the agent backend rather than silently dropping data into no-op
|
|
1278
|
+
# providers.
|
|
1279
|
+
#
|
|
1280
|
+
# _@return_ — True if collector mode is configured and started.
|
|
1281
|
+
sig { returns(T::Boolean) }
|
|
1282
|
+
def collector_mode?; end
|
|
1283
|
+
|
|
1044
1284
|
sig { returns(T::Boolean) }
|
|
1045
1285
|
def yml_config_file?; end
|
|
1046
1286
|
|
|
@@ -1330,6 +1570,16 @@ module Appsignal
|
|
|
1330
1570
|
sig { returns(T::Array[String]) }
|
|
1331
1571
|
attr_accessor :ignore_namespaces
|
|
1332
1572
|
|
|
1573
|
+
# _@return_ — Rack environment keys to report in collector
|
|
1574
|
+
# mode, named the way Rack names them
|
|
1575
|
+
sig { returns(T::Array[String]) }
|
|
1576
|
+
attr_accessor :keep_request_environment
|
|
1577
|
+
|
|
1578
|
+
# _@return_ — HTTP request headers to report in collector
|
|
1579
|
+
# mode, named the way OpenTelemetry names them
|
|
1580
|
+
sig { returns(T::Array[String]) }
|
|
1581
|
+
attr_accessor :keep_request_headers
|
|
1582
|
+
|
|
1333
1583
|
# _@return_ — HTTP request headers to include in error reports
|
|
1334
1584
|
sig { returns(T::Array[String]) }
|
|
1335
1585
|
attr_accessor :request_headers
|
|
@@ -1662,8 +1912,24 @@ module Appsignal
|
|
|
1662
1912
|
# transaction.
|
|
1663
1913
|
#
|
|
1664
1914
|
# _@param_ `namespace` — Namespace of the to be created transaction.
|
|
1665
|
-
|
|
1666
|
-
|
|
1915
|
+
#
|
|
1916
|
+
# _@param_ `opentelemetry_kind` — In collector mode, the OpenTelemetry span kind: one of `:server`, `:consumer`, `:producer` or `:internal`. Defaults to `:server`.
|
|
1917
|
+
#
|
|
1918
|
+
# _@param_ `opentelemetry_relationship` — In collector mode, how an incoming `opentelemetry_context` relates to this transaction's span: one of `:parent`, `:link`, `:both` or `:none`. Defaults to `:parent`.
|
|
1919
|
+
#
|
|
1920
|
+
# _@param_ `opentelemetry_context` — In collector mode, an incoming OpenTelemetry trace context to relate this transaction's span to.
|
|
1921
|
+
#
|
|
1922
|
+
# _@param_ `opentelemetry_scope` — In collector mode, the OpenTelemetry instrumentation scope to record this transaction's spans under, given as a `[name, version]` pair. Defaults to the AppSignal scope.
|
|
1923
|
+
sig do
|
|
1924
|
+
params(
|
|
1925
|
+
namespace: String,
|
|
1926
|
+
opentelemetry_context: T.untyped,
|
|
1927
|
+
opentelemetry_scope: T.nilable([String, String]),
|
|
1928
|
+
opentelemetry_kind: T.nilable(Symbol),
|
|
1929
|
+
opentelemetry_relationship: T.nilable(Symbol)
|
|
1930
|
+
).returns(Transaction)
|
|
1931
|
+
end
|
|
1932
|
+
def self.create(namespace, opentelemetry_context: nil, opentelemetry_scope: nil, opentelemetry_kind: nil, opentelemetry_relationship: nil); end
|
|
1667
1933
|
|
|
1668
1934
|
# Returns currently active transaction or a {NilTransaction} if none is
|
|
1669
1935
|
# active.
|
|
@@ -1699,6 +1965,52 @@ module Appsignal
|
|
|
1699
1965
|
sig { params(given_params: T.nilable(T.any(T::Hash[String, Object], T::Array[Object])), block: T.proc.returns(T.any(T::Hash[String, Object], T::Array[Object]))).void }
|
|
1700
1966
|
def add_params(given_params = nil, &block); end
|
|
1701
1967
|
|
|
1968
|
+
# Add the request payload to the transaction.
|
|
1969
|
+
#
|
|
1970
|
+
# These are the parameters of an incoming request, such as the query string
|
|
1971
|
+
# and the request body. In collector mode they map to the request payload
|
|
1972
|
+
# attribute. In agent mode they are the transaction's params.
|
|
1973
|
+
#
|
|
1974
|
+
# Behaves like {#add_params}: merges when called multiple times, and a
|
|
1975
|
+
# block takes precedence over the argument.
|
|
1976
|
+
#
|
|
1977
|
+
# _@param_ `given_params` — The parameters to add to the transaction.
|
|
1978
|
+
#
|
|
1979
|
+
# _@see_ `#add_function_parameters`
|
|
1980
|
+
sig { params(given_params: T.nilable(T.any(T::Hash[String, Object], T::Array[Object])), block: T.proc.returns(T.any(T::Hash[String, Object], T::Array[Object]))).void }
|
|
1981
|
+
def add_request_payload(given_params = nil, &block); end
|
|
1982
|
+
|
|
1983
|
+
# Add the function parameters to the transaction.
|
|
1984
|
+
#
|
|
1985
|
+
# These are the arguments a background job or function was called with. In
|
|
1986
|
+
# collector mode they map to the function parameters attribute. In agent
|
|
1987
|
+
# mode they are the transaction's params.
|
|
1988
|
+
#
|
|
1989
|
+
# Behaves like {#add_params}: merges when called multiple times, and a
|
|
1990
|
+
# block takes precedence over the argument.
|
|
1991
|
+
#
|
|
1992
|
+
# _@param_ `given_params` — The parameters to add to the transaction.
|
|
1993
|
+
#
|
|
1994
|
+
# _@see_ `#add_request_payload`
|
|
1995
|
+
sig { params(given_params: T.nilable(T.any(T::Hash[String, Object], T::Array[Object])), block: T.proc.returns(T.any(T::Hash[String, Object], T::Array[Object]))).void }
|
|
1996
|
+
def add_function_parameters(given_params = nil, &block); end
|
|
1997
|
+
|
|
1998
|
+
# Add the query parameters to the transaction.
|
|
1999
|
+
#
|
|
2000
|
+
# These are the parameters parsed from an incoming request's query string.
|
|
2001
|
+
# In collector mode they map to their own attribute, separate from the
|
|
2002
|
+
# request payload and the function parameters. In agent mode they are the
|
|
2003
|
+
# transaction's params.
|
|
2004
|
+
#
|
|
2005
|
+
# Behaves like {#add_params}: merges when called multiple times, and a
|
|
2006
|
+
# block takes precedence over the argument.
|
|
2007
|
+
#
|
|
2008
|
+
# _@param_ `given_params` — The parameters to add to the transaction.
|
|
2009
|
+
#
|
|
2010
|
+
# _@see_ `#add_request_payload`
|
|
2011
|
+
sig { params(given_params: T.nilable(T.any(T::Hash[String, Object], T::Array[Object])), block: T.proc.returns(T.any(T::Hash[String, Object], T::Array[Object]))).void }
|
|
2012
|
+
def add_query_parameters(given_params = nil, &block); end
|
|
2013
|
+
|
|
1702
2014
|
# Add tags to the transaction.
|
|
1703
2015
|
#
|
|
1704
2016
|
# When this method is called multiple times, it will merge the tags.
|
|
@@ -1730,12 +2042,52 @@ module Appsignal
|
|
|
1730
2042
|
#
|
|
1731
2043
|
# _@param_ `given_headers` — A hash containing headers.
|
|
1732
2044
|
#
|
|
2045
|
+
# _@deprecated_ — Use {#add_request_headers} for request headers and
|
|
2046
|
+
# {#add_request_environment} for the values a Rack environment holds that
|
|
2047
|
+
# are not request headers. This method takes both kinds at once, so it
|
|
2048
|
+
# has to work out which of them each value is.
|
|
2049
|
+
#
|
|
1733
2050
|
# _@see_ `Helpers::Instrumentation#add_headers`
|
|
1734
2051
|
#
|
|
1735
2052
|
# _@see_ `https://docs.appsignal.com/guides/custom-data/sample-data.html` — Sample data guide
|
|
1736
2053
|
sig { params(given_headers: T.nilable(T::Hash[String, Object]), block: T.proc.returns(T::Hash[String, Object])).void }
|
|
1737
2054
|
def add_headers(given_headers = nil, &block); end
|
|
1738
2055
|
|
|
2056
|
+
# Add request headers to the transaction.
|
|
2057
|
+
#
|
|
2058
|
+
# Name each header the way OpenTelemetry names it, in lowercase and with
|
|
2059
|
+
# dashes, such as `accept` and `content-length`. In agent mode the names
|
|
2060
|
+
# are converted to the Rack spellings the environment uses, such as
|
|
2061
|
+
# `HTTP_ACCEPT`.
|
|
2062
|
+
#
|
|
2063
|
+
# Behaves like {#add_headers}: merges when called multiple times, and a
|
|
2064
|
+
# block takes precedence over the argument.
|
|
2065
|
+
#
|
|
2066
|
+
# _@param_ `given_headers` — A hash containing request headers.
|
|
2067
|
+
#
|
|
2068
|
+
# _@see_ `#add_request_environment`
|
|
2069
|
+
#
|
|
2070
|
+
# _@see_ `https://docs.appsignal.com/guides/custom-data/sample-data.html` — Sample data guide
|
|
2071
|
+
sig { params(given_headers: T.nilable(T::Hash[String, Object]), block: T.proc.returns(T::Hash[String, Object])).void }
|
|
2072
|
+
def add_request_headers(given_headers = nil, &block); end
|
|
2073
|
+
|
|
2074
|
+
# Add values from the request environment to the transaction.
|
|
2075
|
+
#
|
|
2076
|
+
# These are the values a Rack environment holds that are not request
|
|
2077
|
+
# headers, such as `REMOTE_ADDR` and `QUERY_STRING`. Name each one the way
|
|
2078
|
+
# Rack names it. Use {#add_request_headers} for the request headers.
|
|
2079
|
+
#
|
|
2080
|
+
# Behaves like {#add_headers}: merges when called multiple times, and a
|
|
2081
|
+
# block takes precedence over the argument.
|
|
2082
|
+
#
|
|
2083
|
+
# _@param_ `given_environment` — A hash containing request environment values.
|
|
2084
|
+
#
|
|
2085
|
+
# _@see_ `#add_request_headers`
|
|
2086
|
+
#
|
|
2087
|
+
# _@see_ `https://docs.appsignal.com/guides/custom-data/sample-data.html` — Sample data guide
|
|
2088
|
+
sig { params(given_environment: T.nilable(T::Hash[String, Object]), block: T.proc.returns(T::Hash[String, Object])).void }
|
|
2089
|
+
def add_request_environment(given_environment = nil, &block); end
|
|
2090
|
+
|
|
1739
2091
|
# Add custom data to the transaction.
|
|
1740
2092
|
#
|
|
1741
2093
|
# _@param_ `data` — Custom data to add to the transaction.
|
|
@@ -1809,6 +2161,36 @@ module Appsignal
|
|
|
1809
2161
|
# _@param_ `start` — Queue start time in milliseconds.
|
|
1810
2162
|
sig { params(start: Integer).void }
|
|
1811
2163
|
def set_queue_start(start); end
|
|
2164
|
+
|
|
2165
|
+
# Add OpenTelemetry attributes to the span AppSignal is currently
|
|
2166
|
+
# recording.
|
|
2167
|
+
#
|
|
2168
|
+
# In collector mode, AppSignal records a transaction as an OpenTelemetry
|
|
2169
|
+
# span, and every instrumented event as a child span. This adds attributes
|
|
2170
|
+
# to whichever of those spans is open right now: the innermost event
|
|
2171
|
+
# started by {Appsignal::Helpers::Instrumentation#instrument}, or the
|
|
2172
|
+
# transaction's own span when no event is open.
|
|
2173
|
+
#
|
|
2174
|
+
# Use this to describe what is being instrumented in OpenTelemetry's own
|
|
2175
|
+
# terms, following the OpenTelemetry semantic conventions where they apply.
|
|
2176
|
+
# Attributes have no equivalent outside collector mode, so this does
|
|
2177
|
+
# nothing when collector mode is not active.
|
|
2178
|
+
#
|
|
2179
|
+
# _@param_ `attributes` — Attributes to add to the current span. Values that are not a String, Integer, Float or boolean are converted to a String. Nothing is added when this is nil or empty.
|
|
2180
|
+
#
|
|
2181
|
+
# Describing a database query
|
|
2182
|
+
# ```ruby
|
|
2183
|
+
# Appsignal.instrument("query.my_database") do
|
|
2184
|
+
# Appsignal::Transaction.current.add_opentelemetry_attributes(
|
|
2185
|
+
# "db.system.name" => "mysql"
|
|
2186
|
+
# )
|
|
2187
|
+
# run_the_query
|
|
2188
|
+
# end
|
|
2189
|
+
# ```
|
|
2190
|
+
#
|
|
2191
|
+
# _@see_ `https://opentelemetry.io/docs/specs/semconv/` — OpenTelemetry semantic conventions
|
|
2192
|
+
sig { params(attributes: T.nilable(T::Hash[String, Object])).void }
|
|
2193
|
+
def add_opentelemetry_attributes(attributes = {}); end
|
|
1812
2194
|
end
|
|
1813
2195
|
|
|
1814
2196
|
# Custom markers are used on AppSignal.com to indicate events in an
|
|
@@ -1957,6 +2339,14 @@ module Appsignal
|
|
|
1957
2339
|
#
|
|
1958
2340
|
# _@param_ `action` — The action name for the transaction. The action name is required to be set for the transaction to be reported. The argument can be set to `nil` or `:set_later` if the action is set within the block with {#set_action}. This will not update the active transaction's action if {.monitor} is called when another transaction is already active.
|
|
1959
2341
|
#
|
|
2342
|
+
# _@param_ `opentelemetry_kind` — In collector mode, the OpenTelemetry span kind: one of `:server`, `:consumer`, `:producer` or `:internal`. Defaults to `:server`.
|
|
2343
|
+
#
|
|
2344
|
+
# _@param_ `opentelemetry_relationship` — In collector mode, how an incoming `opentelemetry_context` relates to this transaction's span: one of `:parent`, `:link`, `:both` or `:none`. Defaults to `:parent`.
|
|
2345
|
+
#
|
|
2346
|
+
# _@param_ `opentelemetry_context` — In collector mode, an incoming OpenTelemetry trace context to relate this transaction's span to.
|
|
2347
|
+
#
|
|
2348
|
+
# _@param_ `opentelemetry_scope` — In collector mode, the OpenTelemetry instrumentation scope to record this transaction's spans under, given as a `[name, version]` pair. Defaults to the AppSignal scope.
|
|
2349
|
+
#
|
|
1960
2350
|
# _@return_ — The value of the given block is returned.
|
|
1961
2351
|
# Returns `nil` if there already is a transaction active and no block
|
|
1962
2352
|
# was given.
|
|
@@ -2047,8 +2437,18 @@ module Appsignal
|
|
|
2047
2437
|
# ```
|
|
2048
2438
|
#
|
|
2049
2439
|
# _@see_ `https://docs.appsignal.com/ruby/instrumentation/background-jobs.html` — Monitor guide
|
|
2050
|
-
sig
|
|
2051
|
-
|
|
2440
|
+
sig do
|
|
2441
|
+
params(
|
|
2442
|
+
action: T.any(String, Symbol, NilClass),
|
|
2443
|
+
namespace: T.nilable(T.any(String, Symbol)),
|
|
2444
|
+
opentelemetry_context: T.untyped,
|
|
2445
|
+
opentelemetry_scope: T.nilable([String, String]),
|
|
2446
|
+
opentelemetry_kind: T.nilable(Symbol),
|
|
2447
|
+
opentelemetry_relationship: T.nilable(Symbol),
|
|
2448
|
+
blk: T.proc.returns(Object)
|
|
2449
|
+
).returns(T.nilable(Object))
|
|
2450
|
+
end
|
|
2451
|
+
def monitor(action:, namespace: nil, opentelemetry_context: nil, opentelemetry_scope: nil, opentelemetry_kind: nil, opentelemetry_relationship: nil, &blk); end
|
|
2052
2452
|
|
|
2053
2453
|
# Instrument a block of code and stop AppSignal.
|
|
2054
2454
|
#
|
|
@@ -2062,11 +2462,29 @@ module Appsignal
|
|
|
2062
2462
|
#
|
|
2063
2463
|
# _@param_ `action` — The action name for the transaction. The action name is required to be set for the transaction to be reported. The argument can be set to `nil` or `:set_later` if the action is set within the block with {#set_action}. This will not update the active transaction's action if {.monitor} is called when another transaction is already active.
|
|
2064
2464
|
#
|
|
2465
|
+
# _@param_ `opentelemetry_kind` — In collector mode, the OpenTelemetry span kind: one of `:server`, `:consumer`, `:producer` or `:internal`. Defaults to `:server`.
|
|
2466
|
+
#
|
|
2467
|
+
# _@param_ `opentelemetry_relationship` — In collector mode, how an incoming `opentelemetry_context` relates to this transaction's span: one of `:parent`, `:link`, `:both` or `:none`. Defaults to `:parent`.
|
|
2468
|
+
#
|
|
2469
|
+
# _@param_ `opentelemetry_context` — In collector mode, an incoming OpenTelemetry trace context to relate this transaction's span to.
|
|
2470
|
+
#
|
|
2471
|
+
# _@param_ `opentelemetry_scope` — In collector mode, the OpenTelemetry instrumentation scope to record this transaction's spans under, given as a `[name, version]` pair. Defaults to the AppSignal scope.
|
|
2472
|
+
#
|
|
2065
2473
|
# _@return_ — The value of the given block is returned.
|
|
2066
2474
|
#
|
|
2067
2475
|
# _@see_ `monitor`
|
|
2068
|
-
sig
|
|
2069
|
-
|
|
2476
|
+
sig do
|
|
2477
|
+
params(
|
|
2478
|
+
action: T.any(String, Symbol, NilClass),
|
|
2479
|
+
namespace: T.nilable(T.any(String, Symbol)),
|
|
2480
|
+
opentelemetry_context: T.untyped,
|
|
2481
|
+
opentelemetry_scope: T.nilable([String, String]),
|
|
2482
|
+
opentelemetry_kind: T.nilable(Symbol),
|
|
2483
|
+
opentelemetry_relationship: T.nilable(Symbol),
|
|
2484
|
+
block: T.proc.returns(Object)
|
|
2485
|
+
).returns(T.nilable(Object))
|
|
2486
|
+
end
|
|
2487
|
+
def monitor_and_stop(action:, namespace: nil, opentelemetry_context: nil, opentelemetry_scope: nil, opentelemetry_kind: nil, opentelemetry_relationship: nil, &block); end
|
|
2070
2488
|
|
|
2071
2489
|
# Send an error to AppSignal regardless of the context.
|
|
2072
2490
|
#
|
|
@@ -2085,6 +2503,14 @@ module Appsignal
|
|
|
2085
2503
|
#
|
|
2086
2504
|
# _@param_ `error` — The error to send to AppSignal.
|
|
2087
2505
|
#
|
|
2506
|
+
# _@param_ `opentelemetry_kind` — In collector mode, the OpenTelemetry span kind: one of `:server`, `:consumer`, `:producer` or `:internal`. Defaults to `:server`.
|
|
2507
|
+
#
|
|
2508
|
+
# _@param_ `opentelemetry_relationship` — In collector mode, how an incoming `opentelemetry_context` relates to this transaction's span: one of `:parent`, `:link`, `:both` or `:none`. Defaults to `:parent`.
|
|
2509
|
+
#
|
|
2510
|
+
# _@param_ `opentelemetry_context` — In collector mode, an incoming OpenTelemetry trace context to relate this transaction's span to.
|
|
2511
|
+
#
|
|
2512
|
+
# _@param_ `opentelemetry_scope` — In collector mode, the OpenTelemetry instrumentation scope to record this transaction's spans under, given as a `[name, version]` pair. Defaults to the AppSignal scope.
|
|
2513
|
+
#
|
|
2088
2514
|
# Send an exception
|
|
2089
2515
|
# ```ruby
|
|
2090
2516
|
# begin
|
|
@@ -2105,8 +2531,17 @@ module Appsignal
|
|
|
2105
2531
|
# ```
|
|
2106
2532
|
#
|
|
2107
2533
|
# _@see_ `https://docs.appsignal.com/ruby/instrumentation/exception-handling.html` — Exception handling guide
|
|
2108
|
-
sig
|
|
2109
|
-
|
|
2534
|
+
sig do
|
|
2535
|
+
params(
|
|
2536
|
+
error: Exception,
|
|
2537
|
+
opentelemetry_context: T.untyped,
|
|
2538
|
+
opentelemetry_scope: T.nilable([String, String]),
|
|
2539
|
+
opentelemetry_kind: T.nilable(Symbol),
|
|
2540
|
+
opentelemetry_relationship: T.nilable(Symbol),
|
|
2541
|
+
block: T.proc.params(transaction: Transaction).void
|
|
2542
|
+
).void
|
|
2543
|
+
end
|
|
2544
|
+
def send_error(error, opentelemetry_context: nil, opentelemetry_scope: nil, opentelemetry_kind: nil, opentelemetry_relationship: nil, &block); end
|
|
2110
2545
|
|
|
2111
2546
|
# Set an error on the current transaction.
|
|
2112
2547
|
#
|
|
@@ -2179,6 +2614,14 @@ module Appsignal
|
|
|
2179
2614
|
#
|
|
2180
2615
|
# _@param_ `exception` — The error to add to the current transaction.
|
|
2181
2616
|
#
|
|
2617
|
+
# _@param_ `opentelemetry_kind` — In collector mode, the OpenTelemetry span kind: one of `:server`, `:consumer`, `:producer` or `:internal`. Defaults to `:server`. Only used when a new transaction is created.
|
|
2618
|
+
#
|
|
2619
|
+
# _@param_ `opentelemetry_relationship` — In collector mode, how an incoming `opentelemetry_context` relates to this transaction's span: one of `:parent`, `:link`, `:both` or `:none`. Defaults to `:parent`. Only used when a new transaction is created.
|
|
2620
|
+
#
|
|
2621
|
+
# _@param_ `opentelemetry_context` — In collector mode, an incoming OpenTelemetry trace context to relate this transaction's span to. Only used when a new transaction is created.
|
|
2622
|
+
#
|
|
2623
|
+
# _@param_ `opentelemetry_scope` — In collector mode, the OpenTelemetry instrumentation scope to record this transaction's spans under, given as a `[name, version]` pair. Defaults to the AppSignal scope.
|
|
2624
|
+
#
|
|
2182
2625
|
# ```ruby
|
|
2183
2626
|
# class SomeController < ApplicationController
|
|
2184
2627
|
# def create
|
|
@@ -2200,8 +2643,17 @@ module Appsignal
|
|
|
2200
2643
|
# ```
|
|
2201
2644
|
#
|
|
2202
2645
|
# _@see_ `https://docs.appsignal.com/ruby/instrumentation/exception-handling.html` — Exception handling guide
|
|
2203
|
-
sig
|
|
2204
|
-
|
|
2646
|
+
sig do
|
|
2647
|
+
params(
|
|
2648
|
+
exception: Exception,
|
|
2649
|
+
opentelemetry_context: T.untyped,
|
|
2650
|
+
opentelemetry_scope: T.nilable([String, String]),
|
|
2651
|
+
opentelemetry_kind: T.nilable(Symbol),
|
|
2652
|
+
opentelemetry_relationship: T.nilable(Symbol),
|
|
2653
|
+
block: T.proc.params(transaction: Transaction).void
|
|
2654
|
+
).void
|
|
2655
|
+
end
|
|
2656
|
+
def report_error(exception, opentelemetry_context: nil, opentelemetry_scope: nil, opentelemetry_kind: nil, opentelemetry_relationship: nil, &block); end
|
|
2205
2657
|
|
|
2206
2658
|
# Set a custom action name for the current transaction.
|
|
2207
2659
|
#
|
|
@@ -2399,16 +2851,65 @@ module Appsignal
|
|
|
2399
2851
|
sig { params(params: T.nilable(T.any(T::Hash[String, Object], T::Array[Object])), block: T.proc.returns(T.any(T::Hash[String, Object], T::Array[Object]))).void }
|
|
2400
2852
|
def add_params(params = nil, &block); end
|
|
2401
2853
|
|
|
2854
|
+
# Add the request payload to the current transaction.
|
|
2855
|
+
#
|
|
2856
|
+
# The request payload is the parameters of an incoming request, such as
|
|
2857
|
+
# the query string and the request body. In collector mode it maps to its
|
|
2858
|
+
# own attribute, separate from the function parameters.
|
|
2859
|
+
#
|
|
2860
|
+
# Behaves like {#add_params}: merges when called multiple times, and a
|
|
2861
|
+
# block takes precedence over the argument.
|
|
2862
|
+
#
|
|
2863
|
+
# _@param_ `params` — The request payload to add to the transaction.
|
|
2864
|
+
#
|
|
2865
|
+
# _@see_ `#add_function_parameters`
|
|
2866
|
+
sig { params(params: T.nilable(T.any(T::Hash[String, Object], T::Array[Object])), block: T.proc.returns(T.any(T::Hash[String, Object], T::Array[Object]))).void }
|
|
2867
|
+
def add_request_payload(params = nil, &block); end
|
|
2868
|
+
|
|
2869
|
+
# Add the function parameters to the current transaction.
|
|
2870
|
+
#
|
|
2871
|
+
# The function parameters are the arguments a background job or function
|
|
2872
|
+
# was called with. In collector mode they map to their own attribute,
|
|
2873
|
+
# separate from the request payload.
|
|
2874
|
+
#
|
|
2875
|
+
# Behaves like {#add_params}: merges when called multiple times, and a
|
|
2876
|
+
# block takes precedence over the argument.
|
|
2877
|
+
#
|
|
2878
|
+
# _@param_ `params` — The function parameters to add to the transaction.
|
|
2879
|
+
#
|
|
2880
|
+
# _@see_ `#add_request_payload`
|
|
2881
|
+
sig { params(params: T.nilable(T.any(T::Hash[String, Object], T::Array[Object])), block: T.proc.returns(T.any(T::Hash[String, Object], T::Array[Object]))).void }
|
|
2882
|
+
def add_function_parameters(params = nil, &block); end
|
|
2883
|
+
|
|
2884
|
+
# Add the query parameters to the current transaction.
|
|
2885
|
+
#
|
|
2886
|
+
# The query parameters are the parameters parsed from an incoming
|
|
2887
|
+
# request's query string. In collector mode they map to their own
|
|
2888
|
+
# attribute, separate from the request payload and the function
|
|
2889
|
+
# parameters.
|
|
2890
|
+
#
|
|
2891
|
+
# Behaves like {#add_params}: merges when called multiple times, and a
|
|
2892
|
+
# block takes precedence over the argument.
|
|
2893
|
+
#
|
|
2894
|
+
# _@param_ `params` — The query parameters to add to the transaction.
|
|
2895
|
+
#
|
|
2896
|
+
# _@see_ `#add_request_payload`
|
|
2897
|
+
sig { params(params: T.nilable(T.any(T::Hash[String, Object], T::Array[Object])), block: T.proc.returns(T.any(T::Hash[String, Object], T::Array[Object]))).void }
|
|
2898
|
+
def add_query_parameters(params = nil, &block); end
|
|
2899
|
+
|
|
2402
2900
|
# Mark the parameters sample data to be set as an empty value.
|
|
2403
2901
|
#
|
|
2404
|
-
# Use this helper to
|
|
2405
|
-
#
|
|
2902
|
+
# Use this helper to report no parameters for this transaction, whatever
|
|
2903
|
+
# their source.
|
|
2406
2904
|
#
|
|
2407
|
-
#
|
|
2408
|
-
#
|
|
2905
|
+
# This suppresses every params channel. In collector mode, where the
|
|
2906
|
+
# request payload and the function parameters (a background job's
|
|
2907
|
+
# arguments) are tracked as separate attributes, it suppresses both, not
|
|
2908
|
+
# only the request payload. Parameters that an AppSignal integration would
|
|
2909
|
+
# otherwise add are not added.
|
|
2409
2910
|
#
|
|
2410
|
-
# Calling {#add_params}
|
|
2411
|
-
#
|
|
2911
|
+
# Calling {#add_params}, {#add_request_payload} or
|
|
2912
|
+
# {#add_function_parameters} after this helper adds parameters again.
|
|
2412
2913
|
#
|
|
2413
2914
|
# _@see_ `Transaction#set_empty_params!`
|
|
2414
2915
|
#
|
|
@@ -2478,18 +2979,95 @@ module Appsignal
|
|
|
2478
2979
|
# # { "PATH_INFO" => "/some-path", "HTTP_USER_AGENT" => "Firefox" }
|
|
2479
2980
|
# ```
|
|
2480
2981
|
#
|
|
2982
|
+
# _@deprecated_ — Use {#add_request_headers} for request headers and
|
|
2983
|
+
# {#add_request_environment} for the values a Rack environment holds
|
|
2984
|
+
# that are not request headers. This method takes both kinds at once,
|
|
2985
|
+
# so it has to work out which of them each value is.
|
|
2986
|
+
#
|
|
2987
|
+
# _@see_ `#add_request_headers`
|
|
2988
|
+
#
|
|
2989
|
+
# _@see_ `#add_request_environment`
|
|
2990
|
+
#
|
|
2481
2991
|
# _@see_ `https://docs.appsignal.com/guides/custom-data/sample-data.html` — Sample data guide
|
|
2482
2992
|
#
|
|
2483
2993
|
# _@see_ `https://docs.appsignal.com/guides/filter-data/filter-headers.html` — Request headers filtering guide
|
|
2484
2994
|
sig { params(headers: T.nilable(T::Hash[String, Object]), block: T.proc.returns(T::Hash[String, Object])).void }
|
|
2485
2995
|
def add_headers(headers = nil, &block); end
|
|
2486
2996
|
|
|
2997
|
+
# Add request headers to the current transaction.
|
|
2998
|
+
#
|
|
2999
|
+
# Request headers are automatically added by most of our integrations. It
|
|
3000
|
+
# should not be necessary to call this method unless you want to also
|
|
3001
|
+
# report different request headers.
|
|
3002
|
+
#
|
|
3003
|
+
# Name each header the way OpenTelemetry names it, in lowercase and with
|
|
3004
|
+
# dashes. In agent mode the names are converted to the Rack spellings the
|
|
3005
|
+
# environment uses, so `accept` is reported as `HTTP_ACCEPT`.
|
|
3006
|
+
#
|
|
3007
|
+
# To filter request headers, see our request header filtering guide.
|
|
3008
|
+
#
|
|
3009
|
+
# When both the `headers` argument and a block is given to this method,
|
|
3010
|
+
# the block is leading and the argument will _not_ be used.
|
|
3011
|
+
#
|
|
3012
|
+
# _@param_ `headers` — The request headers to add to the transaction.
|
|
3013
|
+
#
|
|
3014
|
+
# Add request headers
|
|
3015
|
+
# ```ruby
|
|
3016
|
+
# Appsignal.add_request_headers("accept" => "text/html")
|
|
3017
|
+
# # The request headers will include:
|
|
3018
|
+
# # { "accept" => "text/html" }
|
|
3019
|
+
# ```
|
|
3020
|
+
#
|
|
3021
|
+
# Calling `add_request_headers` multiple times merges the values
|
|
3022
|
+
# ```ruby
|
|
3023
|
+
# Appsignal.add_request_headers("accept" => "text/html")
|
|
3024
|
+
# Appsignal.add_request_headers("user-agent" => "Firefox")
|
|
3025
|
+
# # The request headers will include:
|
|
3026
|
+
# # { "accept" => "text/html", "user-agent" => "Firefox" }
|
|
3027
|
+
# ```
|
|
3028
|
+
#
|
|
3029
|
+
# _@see_ `#add_request_environment`
|
|
3030
|
+
#
|
|
3031
|
+
# _@see_ `https://docs.appsignal.com/guides/custom-data/sample-data.html` — Sample data guide
|
|
3032
|
+
#
|
|
3033
|
+
# _@see_ `https://docs.appsignal.com/guides/filter-data/filter-headers.html` — Request headers filtering guide
|
|
3034
|
+
sig { params(headers: T.nilable(T::Hash[String, Object]), block: T.proc.returns(T::Hash[String, Object])).void }
|
|
3035
|
+
def add_request_headers(headers = nil, &block); end
|
|
3036
|
+
|
|
3037
|
+
# Add values from the request environment to the current transaction.
|
|
3038
|
+
#
|
|
3039
|
+
# These are the values a Rack environment holds that are not request
|
|
3040
|
+
# headers, such as `REMOTE_ADDR` and `QUERY_STRING`. Name each one the
|
|
3041
|
+
# way Rack names it. Use {#add_request_headers} for the request headers.
|
|
3042
|
+
#
|
|
3043
|
+
# The request environment is automatically added by most of our
|
|
3044
|
+
# integrations. It should not be necessary to call this method unless you
|
|
3045
|
+
# want to also report different values.
|
|
3046
|
+
#
|
|
3047
|
+
# When both the `environment` argument and a block is given to this
|
|
3048
|
+
# method, the block is leading and the argument will _not_ be used.
|
|
3049
|
+
#
|
|
3050
|
+
# _@param_ `environment` — The request environment values to add to the transaction.
|
|
3051
|
+
#
|
|
3052
|
+
# Add request environment values
|
|
3053
|
+
# ```ruby
|
|
3054
|
+
# Appsignal.add_request_environment("REMOTE_ADDR" => "127.0.0.1")
|
|
3055
|
+
# # The request environment will include:
|
|
3056
|
+
# # { "REMOTE_ADDR" => "127.0.0.1" }
|
|
3057
|
+
# ```
|
|
3058
|
+
#
|
|
3059
|
+
# _@see_ `#add_request_headers`
|
|
3060
|
+
#
|
|
3061
|
+
# _@see_ `https://docs.appsignal.com/guides/custom-data/sample-data.html` — Sample data guide
|
|
3062
|
+
sig { params(environment: T.nilable(T::Hash[String, Object]), block: T.proc.returns(T::Hash[String, Object])).void }
|
|
3063
|
+
def add_request_environment(environment = nil, &block); end
|
|
3064
|
+
|
|
2487
3065
|
# Add breadcrumbs to the transaction.
|
|
2488
3066
|
#
|
|
2489
3067
|
# Breadcrumbs can be used to trace what path a user has taken
|
|
2490
3068
|
# before encountering an error.
|
|
2491
3069
|
#
|
|
2492
|
-
#
|
|
3070
|
+
# At most 20 of the added breadcrumbs will be saved.
|
|
2493
3071
|
#
|
|
2494
3072
|
# _@param_ `category` — category of breadcrumb e.g. "UI", "Network", "Navigation", "Console".
|
|
2495
3073
|
#
|
|
@@ -2547,6 +3125,10 @@ module Appsignal
|
|
|
2547
3125
|
#
|
|
2548
3126
|
# _@param_ `body_format` — Enum for the type of event that is instrumented. Accepted values are {EventFormatter::DEFAULT} and {EventFormatter::SQL_BODY_FORMAT}, but we recommend you use {.instrument_sql} instead of {EventFormatter::SQL_BODY_FORMAT}.
|
|
2549
3127
|
#
|
|
3128
|
+
# _@param_ `opentelemetry_kind` — In collector mode, the OpenTelemetry span kind for the event's span, such as `:client` for an outgoing HTTP request. Defaults to the OpenTelemetry default of `:internal`.
|
|
3129
|
+
#
|
|
3130
|
+
# _@param_ `opentelemetry_scope` — In collector mode, the OpenTelemetry instrumentation scope to record the event's span under, given as a `[name, version]` pair. Defaults to the AppSignal scope.
|
|
3131
|
+
#
|
|
2550
3132
|
# _@return_ — Returns the block's return value.
|
|
2551
3133
|
#
|
|
2552
3134
|
# Simple instrumentation
|
|
@@ -2578,10 +3160,12 @@ module Appsignal
|
|
|
2578
3160
|
title: T.nilable(String),
|
|
2579
3161
|
body: T.nilable(String),
|
|
2580
3162
|
body_format: Integer,
|
|
3163
|
+
opentelemetry_kind: T.nilable(Symbol),
|
|
3164
|
+
opentelemetry_scope: T.nilable([String, String]),
|
|
2581
3165
|
block: T.untyped
|
|
2582
3166
|
).returns(Object)
|
|
2583
3167
|
end
|
|
2584
|
-
def instrument(name, title = nil, body = nil, body_format = Appsignal::EventFormatter::DEFAULT, &block); end
|
|
3168
|
+
def instrument(name, title = nil, body = nil, body_format = Appsignal::EventFormatter::DEFAULT, opentelemetry_kind: nil, opentelemetry_scope: nil, &block); end
|
|
2585
3169
|
|
|
2586
3170
|
# Instrumentation helper for SQL queries.
|
|
2587
3171
|
#
|
|
@@ -2593,6 +3177,10 @@ module Appsignal
|
|
|
2593
3177
|
#
|
|
2594
3178
|
# _@param_ `body` — SQL query that's being executed.
|
|
2595
3179
|
#
|
|
3180
|
+
# _@param_ `opentelemetry_kind` — In collector mode, the OpenTelemetry span kind for the event's span. Defaults to `:client`, because a query is an outgoing call to a datastore. Pass `:internal` for a query that is not an outgoing call.
|
|
3181
|
+
#
|
|
3182
|
+
# _@param_ `opentelemetry_scope` — In collector mode, the OpenTelemetry instrumentation scope to record the event's span under, given as a `[name, version]` pair. Defaults to the AppSignal scope.
|
|
3183
|
+
#
|
|
2596
3184
|
# _@return_ — Returns the block's return value.
|
|
2597
3185
|
#
|
|
2598
3186
|
# SQL query instrumentation
|
|
@@ -2621,10 +3209,12 @@ module Appsignal
|
|
|
2621
3209
|
name: String,
|
|
2622
3210
|
title: T.nilable(String),
|
|
2623
3211
|
body: T.nilable(String),
|
|
3212
|
+
opentelemetry_kind: Symbol,
|
|
3213
|
+
opentelemetry_scope: T.nilable([String, String]),
|
|
2624
3214
|
block: T.untyped
|
|
2625
3215
|
).returns(Object)
|
|
2626
3216
|
end
|
|
2627
|
-
def instrument_sql(name, title = nil, body = nil, &block); end
|
|
3217
|
+
def instrument_sql(name, title = nil, body = nil, opentelemetry_kind: :client, opentelemetry_scope: nil, &block); end
|
|
2628
3218
|
|
|
2629
3219
|
# Convenience method for ignoring instrumentation events in a block of
|
|
2630
3220
|
# code.
|
|
@@ -2665,6 +3255,9 @@ module Appsignal
|
|
|
2665
3255
|
sig { returns(String) }
|
|
2666
3256
|
def message; end
|
|
2667
3257
|
end
|
|
3258
|
+
|
|
3259
|
+
module Metrics
|
|
3260
|
+
end
|
|
2668
3261
|
end
|
|
2669
3262
|
|
|
2670
3263
|
# Extensions to Object for AppSignal method instrumentation.
|