Sha256: 23c12c8bcdafa1c1958d85be61b0dd8861b58ca67aba8e6560b670de9260d84c

Contents?: true

Size: 833 Bytes

Versions: 8

Compression:

Stored size: 833 Bytes

Contents

module Appsignal
  class EventFormatter
    # @api private
    module ElasticSearch
      class SearchFormatter
        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

Appsignal::EventFormatter.register(
  "search.elasticsearch",
  Appsignal::EventFormatter::ElasticSearch::SearchFormatter
)

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
appsignal-2.5.3-java lib/appsignal/event_formatter/elastic_search/search_formatter.rb
appsignal-2.5.3 lib/appsignal/event_formatter/elastic_search/search_formatter.rb
appsignal-2.5.3.alpha.2 lib/appsignal/event_formatter/elastic_search/search_formatter.rb
appsignal-2.5.3.alpha.2-java lib/appsignal/event_formatter/elastic_search/search_formatter.rb
appsignal-2.5.3.alpha.1 lib/appsignal/event_formatter/elastic_search/search_formatter.rb
appsignal-2.5.3.alpha.1-java lib/appsignal/event_formatter/elastic_search/search_formatter.rb
appsignal-2.5.2-java lib/appsignal/event_formatter/elastic_search/search_formatter.rb
appsignal-2.5.2 lib/appsignal/event_formatter/elastic_search/search_formatter.rb