Class: Gitlab::ErrorTracking::Processor::GrpcErrorProcessor

Inherits:
Raven::Processor
  • Object
show all
Defined in:
lib/gitlab/error_tracking/processor/grpc_error_processor.rb

Constant Summary collapse

DEBUG_ERROR_STRING_REGEX =
RE2('(.*) debug_error_string:(.*)')

Instance Method Summary collapse

Instance Method Details

#process(value) ⇒ Object


9
10
11
12
13
14
# File 'lib/gitlab/error_tracking/processor/grpc_error_processor.rb', line 9

def process(value)
  process_first_exception_value(value)
  process_custom_fingerprint(value)

  value
end

#process_custom_fingerprint(value) ⇒ Object


38
39
40
41
42
43
44
45
# File 'lib/gitlab/error_tracking/processor/grpc_error_processor.rb', line 38

def process_custom_fingerprint(value)
  fingerprint = value[:fingerprint]

  return value unless custom_grpc_fingerprint?(fingerprint)

  message, _ = split_debug_error_string(fingerprint[1])
  fingerprint[1] = message if message
end

#process_first_exception_value(value) ⇒ Object

Sentry can report multiple exceptions in an event. Sanitize only the first one since that's what is used for grouping.


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/gitlab/error_tracking/processor/grpc_error_processor.rb', line 18

def process_first_exception_value(value)
  exceptions = value.dig(:exception, :values)

  return unless exceptions.is_a?(Array)

  entry = exceptions.first

  return unless entry.is_a?(Hash)

  raw_message = entry[:value]

  return unless raw_message.start_with?('GRPC::')

  message, debug_str = split_debug_error_string(raw_message)

  entry[:value] = message if message
  extra = value[:extra] || {}
  extra[:grpc_debug_error_string] = debug_str if debug_str
end