Sha256: 3a00536aec1b00a54a413bca6f8e2f783f237d381d1d23e5835cc251da2356fa

Contents?: true

Size: 973 Bytes

Versions: 3

Compression:

Stored size: 973 Bytes

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.3.0 lib/opentelemetry/instrumentation/action_view/railtie.rb
opentelemetry-instrumentation-action_view-0.2.1 lib/opentelemetry/instrumentation/action_view/railtie.rb
opentelemetry-instrumentation-action_view-0.2.0 lib/opentelemetry/instrumentation/action_view/railtie.rb