Sha256: 07ae10efe825294a335af50c9138de70d9ba22096fa8948a9cb327b3f6daeded

Contents?: true

Size: 1.4 KB

Versions: 33

Compression:

Stored size: 1.4 KB

Contents

# frozen_string_literal: true

module Labkit
  module Tracing
    module Rails
      module ActionView
        autoload :RenderCollectionInstrumenter, "labkit/tracing/rails/action_view/render_collection_instrumenter"
        autoload :RenderPartialInstrumenter, "labkit/tracing/rails/action_view/render_partial_instrumenter"
        autoload :RenderTemplateInstrumenter, "labkit/tracing/rails/action_view/render_template_instrumenter"
        autoload :Subscriber, "labkit/tracing/rails/action_view/subscriber"

        COMPONENT_TAG = "ActionView"

        # Returns identifier relative to Rails.root. Rails supports different template types and returns corresponding identifiers:
        # - Text template: the identifier is "text template"
        # - Html template: the identifier is "html template"
        # - Inline template: the identifier is "inline template"
        # - Raw template: the identifier is the file path of the template
        # Therefore, the amount of returned identifiers is static.
        def self.template_identifier(payload)
          return if !defined?(::Rails.root) || payload[:identifier].nil?

          # Rails.root returns a Pathname object, whose `to_s` methods returns an absolute path without ending "/"
          # Source: https://github.com/rails/rails/blob/v6.0.3.1/railties/lib/rails.rb#L64
          payload[:identifier].sub("#{::Rails.root}/", "")
        end
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
gitlab-labkit-0.37.0 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.36.1 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.36.0 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.35.1 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.35.0 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.34.0 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.33.0 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.32.0 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.31.1 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.31.0 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.30.1 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.30.0 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.29.0 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.28.0 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.27.0 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.26.0 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.25.0 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.24.0 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.23.0 lib/labkit/tracing/rails/action_view.rb
gitlab-labkit-0.22.0 lib/labkit/tracing/rails/action_view.rb