Module: Datadog::Tracing::Contrib::Rack::Patcher
- Defined in:
- lib/datadog/tracing/contrib/rack/patcher.rb
Overview
Applies multiple patches
Constant Summary collapse
- PATCHERS =
[ MiddlewarePatcher, MiddlewareNamePatcher ].freeze
Class Method Summary collapse
- .get_option(option) ⇒ Object
- .patch ⇒ Object
- .patch_error_result ⇒ Object
- .patch_successful ⇒ Object
- .patched? ⇒ Boolean
- .target_version ⇒ Object
Class Method Details
.get_option(option) ⇒ Object
104 105 106 |
# File 'lib/datadog/tracing/contrib/rack/patcher.rb', line 104 def get_option(option) Datadog.configuration.tracing[:rack].get_option(option) end |
.patch ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/datadog/tracing/contrib/rack/patcher.rb', line 86 def patch MiddlewarePatcher.patch unless MiddlewarePatcher.patched? # Patch middleware names if !MiddlewareNamePatcher.patched? && get_option(:middleware_names) if get_option(:application) MiddlewareNamePatcher.patch else Datadog.logger.warn( %( Rack :middleware_names requires you to also pass :application. Middleware names have NOT been patched; please provide :application. e.g. use: :rack, middleware_names: true, application: my_rack_app) ) end end end |
.patch_error_result ⇒ Object
112 113 114 |
# File 'lib/datadog/tracing/contrib/rack/patcher.rb', line 112 def patch_error_result MiddlewarePatcher.patch_error_result || MiddlewareNamePatcher.patch_error_result end |
.patch_successful ⇒ Object
108 109 110 |
# File 'lib/datadog/tracing/contrib/rack/patcher.rb', line 108 def patch_successful MiddlewarePatcher.patch_successful || MiddlewareNamePatcher.patch_successful end |
.patched? ⇒ Boolean
78 79 80 |
# File 'lib/datadog/tracing/contrib/rack/patcher.rb', line 78 def patched? PATCHERS.all?(&:patched?) end |
.target_version ⇒ Object
82 83 84 |
# File 'lib/datadog/tracing/contrib/rack/patcher.rb', line 82 def target_version Integration.version end |