Class: ElasticAPM::Transport::Filters::SecretsFilter Private

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_apm/transport/filters/secrets_filter.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

Constructor Details

#initialize(config) ⇒ SecretsFilter

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.

Returns a new instance of SecretsFilter.



27
28
29
30
31
32
33
34
# File 'lib/elastic_apm/transport/filters/secrets_filter.rb', line 27

def initialize(config)
  @config = config
  @sanitizer =
    HashSanitizer.new(
      key_patterns: config.custom_key_filters +
                    config.sanitize_field_names
    )
end

Instance Method Details

#call(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.



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/elastic_apm/transport/filters/secrets_filter.rb', line 36

def call(payload)
  @sanitizer.strip_from!(
    payload.dig(:transaction, :context, :request, :body)
  )
  @sanitizer.strip_from!(
    payload.dig(:transaction, :context, :request, :cookies)
  )
  @sanitizer.strip_from!(
    payload.dig(:transaction, :context, :request, :env)
  )
  @sanitizer.strip_from!(
    payload.dig(:transaction, :context, :request, :headers)
  )
  @sanitizer.strip_from!(
    payload.dig(:transaction, :context, :response, :headers)
  )
  @sanitizer.strip_from!(
    payload.dig(:error, :context, :request, :body)
  )
  @sanitizer.strip_from!(
    payload.dig(:error, :context, :request, :cookies)
  )
  @sanitizer.strip_from!(
    payload.dig(:error, :context, :request, :env)
  )
  @sanitizer.strip_from!(
    payload.dig(:error, :context, :request, :headers)
  )
  @sanitizer.strip_from!(
    payload.dig(:error, :context, :response, :headers)
  )
  payload
end