Class: Appsignal::EventFormatter::ElasticSearch::SearchFormatter Private

Inherits:
Object
  • Object
show all
Defined in:
lib/appsignal/event_formatter/elastic_search/search_formatter.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#format(payload) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
11
12
13
# File 'lib/appsignal/event_formatter/elastic_search/search_formatter.rb', line 8

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

#sanitized_search(search) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/appsignal/event_formatter/elastic_search/search_formatter.rb', line 15

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