Module: Datadog::Tracing::Contrib::ActionView::Instrumentation::TemplateRenderer::Rails31Plus
- Included in:
- RailsLessThan4
- Defined in:
- lib/datadog/tracing/contrib/action_view/instrumentation/template_renderer.rb
Overview
Legacy shared code for Rails >= 3.1 template rendering
Instance Method Summary collapse
- #datadog_render_template(template, layout_name) ⇒ Object
- #render(*args, &block) ⇒ Object
- #render_template(*args) ⇒ Object
Instance Method Details
#datadog_render_template(template, layout_name) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/datadog/tracing/contrib/action_view/instrumentation/template_renderer.rb', line 38 def datadog_render_template(template, layout_name) # update the tracing context with computed values before the rendering template_name = template.try('identifier') template_name = Utils.normalize_template_name(template_name) layout = layout_name.try(:[], 'virtual_path') # Proc can be called without parameters since Rails 6 if template_name active_datadog_span.resource = template_name active_datadog_span.set_tag( Ext::TAG_TEMPLATE_NAME, template_name ) end if layout active_datadog_span.set_tag( Ext::TAG_LAYOUT, layout ) end # Measure service stats Contrib::Analytics.set_measured(active_datadog_span) end |
#render(*args, &block) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/datadog/tracing/contrib/action_view/instrumentation/template_renderer.rb', line 13 def render(*args, &block) Tracing.trace( Ext::SPAN_RENDER_TEMPLATE, span_type: Tracing::Metadata::Ext::HTTP::TYPE_TEMPLATE ) do |span| span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT) span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_RENDER_TEMPLATE) with_datadog_span(span) { super(*args, &block) } end end |
#render_template(*args) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/datadog/tracing/contrib/action_view/instrumentation/template_renderer.rb', line 25 def render_template(*args) begin template, layout_name = datadog_parse_args(*args) datadog_render_template(template, layout_name) rescue StandardError => e Datadog.logger.debug(e.) end # execute the original function anyway super(*args) end |