Sha256: ec99b5c97bab3496fb381674b3a40c4436333c0532df27bed007b88690279795

Contents?: true

Size: 809 Bytes

Versions: 64

Compression:

Stored size: 809 Bytes

Contents

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

require "instana/rack"

module Instana
  module CubaPathTemplateExtractor
    REPLACE_TARGET = /:(?<term>[^\/]+)/i

    def self.prepended(base)
      ::Instana.logger.debug "#{base} prepended #{self}"
    end

    def on(*args, &blk)
      wrapper = lambda do |*caputres|
        env['INSTANA_PATH_TEMPLATE_FRAGMENTS'] << args
          .select { |a| a.is_a?(String) }
          .join('/')

        blk.call(*captures)
      end

      super(*args, &wrapper)
    end

    def call!(env)
      env['INSTANA_PATH_TEMPLATE_FRAGMENTS'] = []
      response = super(env)
      env['INSTANA_HTTP_PATH_TEMPLATE'] = env['INSTANA_PATH_TEMPLATE_FRAGMENTS']
        .join('/')
        .gsub(REPLACE_TARGET, '{\k<term>}')
      response
    end
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
instana-1.202.0 lib/instana/frameworks/cuba.rb
instana-1.201.0 lib/instana/frameworks/cuba.rb
instana-1.201.0.pre1 lib/instana/frameworks/cuba.rb
instana-1.200.0 lib/instana/frameworks/cuba.rb
instana-1.200.0.pre1 lib/instana/frameworks/cuba.rb
instana-1.199.6 lib/instana/frameworks/cuba.rb
instana-1.199.5 lib/instana/frameworks/cuba.rb
instana-1.199.4 lib/instana/frameworks/cuba.rb
instana-1.199.3 lib/instana/frameworks/cuba.rb
instana-1.199.2 lib/instana/frameworks/cuba.rb
instana-1.199.1 lib/instana/frameworks/cuba.rb
instana-1.199.0 lib/instana/frameworks/cuba.rb
instana-1.198.0 lib/instana/frameworks/cuba.rb
instana-1.198.0.pre1 lib/instana/frameworks/cuba.rb
instana-1.197.0 lib/instana/frameworks/cuba.rb
instana-1.197.0.pre2 lib/instana/frameworks/cuba.rb
instana-1.197.0.pre1 lib/instana/frameworks/cuba.rb
instana-1.195.4 lib/instana/frameworks/cuba.rb
instana-1.195.3 lib/instana/frameworks/cuba.rb
instana-1.195.2 lib/instana/frameworks/cuba.rb