Sha256: 6914f7f81548b15b30da29e952be7bd664381b1a7a6fb5c3e187d9b372301912
Contents?: true
Size: 1.02 KB
Versions: 2
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.before_initialize do ::ActiveSupport::Notifications.notifier = Fanout.new(::ActiveSupport::Notifications.notifier) end config.after_initialize do SUBSCRIPTIONS.each do |subscription_name| subscriber = OpenTelemetry::Instrumentation::ActionView::SpanSubscriber.new( name: subscription_name, tracer: ActionView::Instrumentation.instance.tracer ) ::ActiveSupport::Notifications.notifier.subscribe(subscription_name, subscriber) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems