Sha256: 04f5ed3a5097399c5bb10691e576019053151bcf58e0e1c35fe159fb5670aac0

Contents?: true

Size: 758 Bytes

Versions: 5

Compression:

Stored size: 758 Bytes

Contents

module Appsignal
  class EventFormatter
    module ElasticSearch
      class SearchFormatter < Appsignal::EventFormatter
        register "search.elasticsearch"

        def format(payload)
          [
            "#{payload[:name]}: #{payload[:klass]}",
            sanitized_search(payload[:search]).inspect
          ]
        end

        def sanitized_search(search)
          return unless search.is_a?(Hash)

          {}.tap do |hsh|
            search.each do |key, val|
              hsh[key] =
                if [:index, :type].include?(key)
                  val
                else
                  Appsignal::Utils::QueryParamsSanitizer.sanitize(val)
                end
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
appsignal-2.1.2 lib/appsignal/event_formatter/elastic_search/search_formatter.rb
appsignal-2.1.1 lib/appsignal/event_formatter/elastic_search/search_formatter.rb
appsignal-2.1.1.beta.1 lib/appsignal/event_formatter/elastic_search/search_formatter.rb
appsignal-2.1.0 lib/appsignal/event_formatter/elastic_search/search_formatter.rb
appsignal-2.1.0.beta.1 lib/appsignal/event_formatter/elastic_search/search_formatter.rb