Sha256: ea2da4a33c3645877bac746dc9b1654a9c057471fa85e1e85a49c66cff18d4a6

Contents?: true

Size: 1.05 KB

Versions: 5

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

module OpenTelemetry
  module Instrumentation
    module ActionView
      SUBSCRIPTIONS = %w[
        render_template.action_view
        render_partial.action_view
        render_collection.action_view
        render_layout.action_view
      ].freeze

      # This Railtie sets up subscriptions to relevant ActionView notifications
      class Railtie < ::Rails::Railtie
        config.after_initialize do
          ::OpenTelemetry::Instrumentation::ActiveSupport::Instrumentation.instance.install({})

          SUBSCRIPTIONS.each do |subscription_name|
            config = ActionView::Instrumentation.instance.config
            ::OpenTelemetry::Instrumentation::ActiveSupport.subscribe(
              ActionView::Instrumentation.instance.tracer,
              subscription_name,
              config[:notification_payload_transform],
              config[:disallowed_notification_payload_keys]
            )
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-action_view-0.7.2 lib/opentelemetry/instrumentation/action_view/railtie.rb
opentelemetry-instrumentation-action_view-0.7.1 lib/opentelemetry/instrumentation/action_view/railtie.rb
opentelemetry-instrumentation-action_view-0.7.0 lib/opentelemetry/instrumentation/action_view/railtie.rb
opentelemetry-instrumentation-action_view-0.6.1 lib/opentelemetry/instrumentation/action_view/railtie.rb
opentelemetry-instrumentation-action_view-0.6.0 lib/opentelemetry/instrumentation/action_view/railtie.rb