Sha256: b39e9647591479ebe21dfe0da7c26a8e5f54bce2891a6515917fc2db3107092f

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 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
      ].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

3 entries across 3 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-action_view-0.5.0 lib/opentelemetry/instrumentation/action_view/railtie.rb
opentelemetry-instrumentation-action_view-0.4.0 lib/opentelemetry/instrumentation/action_view/railtie.rb
opentelemetry-instrumentation-action_view-0.3.1 lib/opentelemetry/instrumentation/action_view/railtie.rb