Class: Sentry::EventScrubber

Inherits:
Object
  • Object
show all
Defined in:
lib/sentry/event_scrubber.rb

Instance Method Summary collapse

Constructor Details

#initialize(event, _hint) ⇒ EventScrubber

Returns a new instance of EventScrubber.



12
13
14
# File 'lib/sentry/event_scrubber.rb', line 12

def initialize(event, _hint)
  @unclean_event = event
end

Instance Method Details

#cleaned_eventObject



16
17
18
19
20
21
22
# File 'lib/sentry/event_scrubber.rb', line 16

def cleaned_event
  event = @unclean_event
  scrubbers.each do |scrubber|
    event = scrub_with(event:, scrubber:)
  end
  event
end

#email_sanitizerObject (private)



35
36
37
# File 'lib/sentry/event_scrubber.rb', line 35

def email_sanitizer
  Scrubbers::EmailSanitizer.new
end

#filter_request_bodyObject (private)



47
48
49
# File 'lib/sentry/event_scrubber.rb', line 47

def filter_request_body
  Scrubbers::FilterRequestBody.new
end

#log_as_warningObject (private)



43
44
45
# File 'lib/sentry/event_scrubber.rb', line 43

def log_as_warning
  Scrubbers::LogAsWarning.new
end

#pii_sanitizerObject (private)



39
40
41
# File 'lib/sentry/event_scrubber.rb', line 39

def pii_sanitizer
  Scrubbers::PIISanitizer.new
end

#scrub_with(event:, scrubber:) ⇒ Object (private)



31
32
33
# File 'lib/sentry/event_scrubber.rb', line 31

def scrub_with(event:, scrubber:)
  scrubber.process(event.to_hash)
end

#scrubbersObject

NOTE: Unsure if the order matters



25
26
27
# File 'lib/sentry/event_scrubber.rb', line 25

def scrubbers
  [email_sanitizer, pii_sanitizer, log_as_warning, filter_request_body]
end