Sha256: 126e59168ccbbb729535272c1c45da80c1794f54b5bc05a125b44a0c363115d4

Contents?: true

Size: 1.05 KB

Versions: 11

Compression:

Stored size: 1.05 KB

Contents

# encoding: utf-8



module TingYun
  module Instrumentation
    module Support
      module ParameterFiltering

        module_function

        def filter_rails_request_parameters(params)
          result = params.dup
          result.delete("controller")
          result.delete("action")
          result.delete("commit")
          result.delete("authenticity_token")
          result.delete_if{|_,v| !v.is_a? String}
          TingYun::Agent.config["nbs.ignored_params"].split(',').each{|key| result.delete(key)}
          result
        end

        # turns {'a' => {'b' => 'c'}} into {'b' => 'c'}
        def dot_flattened(nested_hash, result={})
          nested_hash.each do |key, val|
            next if val == nil
            if val.respond_to?(:has_key?)
              dot_flattened(val, result)
            else
              result[key] = val
            end
          end
          result
        end

        def flattened_filter_request_parameters(params)
          filter_rails_request_parameters(dot_flattened(params))
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
tingyun_rpm-1.6.1 lib/ting_yun/instrumentation/support/parameter_filtering.rb
tingyun_rpm-1.5.0 lib/ting_yun/instrumentation/support/parameter_filtering.rb
tingyun_rpm-1.4.2 lib/ting_yun/instrumentation/support/parameter_filtering.rb
tingyun_rpm-1.4.1 lib/ting_yun/instrumentation/support/parameter_filtering.rb
tingyun_rpm-1.3.1 lib/ting_yun/instrumentation/support/parameter_filtering.rb
tingyun_rpm-1.3.0 lib/ting_yun/instrumentation/support/parameter_filtering.rb
tingyun_rpm-1.2.0 lib/ting_yun/instrumentation/support/parameter_filtering.rb
tingyun_rpm-1.1.4.2 lib/ting_yun/instrumentation/support/parameter_filtering.rb
tingyun_rpm-1.1.4.1 lib/ting_yun/instrumentation/support/parameter_filtering.rb
tingyun_rpm-1.1.4 lib/ting_yun/instrumentation/support/parameter_filtering.rb
tingyun_rpm-1.1.3 lib/ting_yun/instrumentation/support/parameter_filtering.rb