Module: Datadog::Tracing::Contrib::Sinatra::Env
- Defined in:
- lib/datadog/tracing/contrib/sinatra/env.rb
Overview
Gets and sets trace information from a Rack Env
Class Method Summary collapse
- .datadog_span(env) ⇒ Object
- .route_path(env, use_script_names: Datadog.configuration.tracing[:sinatra]) ⇒ Object
- .set_datadog_span(env, span) ⇒ Object
Class Method Details
.datadog_span(env) ⇒ Object
14 15 16 |
# File 'lib/datadog/tracing/contrib/sinatra/env.rb', line 14 def datadog_span(env) env[Ext::RACK_ENV_SINATRA_REQUEST_SPAN] end |
.route_path(env, use_script_names: Datadog.configuration.tracing[:sinatra]) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/datadog/tracing/contrib/sinatra/env.rb', line 22 def route_path(env, use_script_names: Datadog.configuration.tracing[:sinatra][:resource_script_names]) return unless env['sinatra.route'] _, path = env['sinatra.route'].split(' ', 2) if use_script_names env['SCRIPT_NAME'].to_s + path else path end end |
.set_datadog_span(env, span) ⇒ Object
18 19 20 |
# File 'lib/datadog/tracing/contrib/sinatra/env.rb', line 18 def set_datadog_span(env, span) env[Ext::RACK_ENV_SINATRA_REQUEST_SPAN] = span end |