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
102 103 104 |
# File 'lib/datadog/tracing/contrib/rack/patcher.rb', line 102 def get_option(option) Datadog.configuration.tracing[:rack].get_option(option) end |
.patch ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/datadog/tracing/contrib/rack/patcher.rb', line 84 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).freeze ) end end end |
.patch_error_result ⇒ Object
110 111 112 |
# File 'lib/datadog/tracing/contrib/rack/patcher.rb', line 110 def patch_error_result MiddlewarePatcher.patch_error_result || MiddlewareNamePatcher.patch_error_result end |
.patch_successful ⇒ Object
106 107 108 |
# File 'lib/datadog/tracing/contrib/rack/patcher.rb', line 106 def patch_successful MiddlewarePatcher.patch_successful || MiddlewareNamePatcher.patch_successful end |
.patched? ⇒ Boolean
76 77 78 |
# File 'lib/datadog/tracing/contrib/rack/patcher.rb', line 76 def patched? PATCHERS.all?(&:patched?) end |
.target_version ⇒ Object
80 81 82 |
# File 'lib/datadog/tracing/contrib/rack/patcher.rb', line 80 def target_version Integration.version end |