Sha256: 1aa38f725d80c5e105b8be5114dc1c029c4b72a4923485dc56621a9194a95e4a

Contents?: true

Size: 1.35 KB

Versions: 18

Compression:

Stored size: 1.35 KB

Contents

# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2021

module Instana
  module Instrumentation
    module ActionCableConnection
      def instana_trace_context
        @instana_trace_context
      end

      def process
        @instana_trace_context ||= ::Instana.tracer.tracing? ? ::Instana.tracer.current_span.context : {}
        super
      end
    end

    module ActionCableChannel
      def transmit(data, via: nil)
        rpc_tags = {
          service: ::Instana::Util.get_app_name,
          rpc: {
            flavor: :actioncable,
            call: self.class.to_s,
            call_type: :transmit,
            host: Socket.gethostname
          }
        }

        context = connection.instana_trace_context
        ::Instana.tracer.start_or_continue_trace(:'rpc-server', rpc_tags, context) do
          super(data, via: via)
        end
      end

      def dispatch_action(action, data)
        rpc_tags = {
          service: ::Instana::Util.get_app_name,
          rpc: {
            flavor: :actioncable,
            call: "#{self.class}##{action}",
            call_type: :action,
            host: Socket.gethostname
          }
        }

        context = connection.instana_trace_context
        ::Instana.tracer.start_or_continue_trace(:'rpc-server', rpc_tags, context) do
          super(action, data)
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
instana-1.217.1 lib/instana/instrumentation/action_cable.rb
instana-1.217.0 lib/instana/instrumentation/action_cable.rb
instana-1.216.0 lib/instana/instrumentation/action_cable.rb
instana-1.215.1 lib/instana/instrumentation/action_cable.rb
instana-1.215.0 lib/instana/instrumentation/action_cable.rb
instana-1.214.4 lib/instana/instrumentation/action_cable.rb
instana-1.214.3 lib/instana/instrumentation/action_cable.rb
instana-1.214.2 lib/instana/instrumentation/action_cable.rb
instana-1.214.1 lib/instana/instrumentation/action_cable.rb
instana-1.214.0 lib/instana/instrumentation/action_cable.rb
instana-1.213.3 lib/instana/instrumentation/action_cable.rb
instana-1.213.2 lib/instana/instrumentation/action_cable.rb
instana-1.213.1 lib/instana/instrumentation/action_cable.rb
instana-1.213.0 lib/instana/instrumentation/action_cable.rb
instana-1.212.0 lib/instana/instrumentation/action_cable.rb
instana-1.211.0 lib/instana/instrumentation/action_cable.rb
instana-1.210.1 lib/instana/instrumentation/action_cable.rb
instana-1.210.0 lib/instana/instrumentation/action_cable.rb