diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-20 13:43:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-20 13:43:29 +0300 |
commit | 3b1af5cc7ed2666ff18b718ce5d30fa5a2756674 (patch) | |
tree | 3bc4a40e0ee51ec27eabf917c537033c0c5b14d4 /lib/error_tracking | |
parent | 9bba14be3f2c211bf79e15769cd9b77bc73a13bc (diff) |
Add latest changes from gitlab-org/gitlab@16-1-stable-eev16.1.0-rc42
Diffstat (limited to 'lib/error_tracking')
-rw-r--r-- | lib/error_tracking/collector/payload_validator.rb | 13 | ||||
-rw-r--r-- | lib/error_tracking/collector/sentry_auth_parser.rb | 25 | ||||
-rw-r--r-- | lib/error_tracking/collector/sentry_request_parser.rb | 30 | ||||
-rw-r--r-- | lib/error_tracking/stacktrace_builder.rb | 1 |
4 files changed, 1 insertions, 68 deletions
diff --git a/lib/error_tracking/collector/payload_validator.rb b/lib/error_tracking/collector/payload_validator.rb deleted file mode 100644 index aae19a3635a..00000000000 --- a/lib/error_tracking/collector/payload_validator.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module ErrorTracking - module Collector - class PayloadValidator - PAYLOAD_SCHEMA_PATH = Rails.root.join('app', 'validators', 'json_schemas', 'error_tracking_event_payload.json').to_s - - def valid?(payload) - JSONSchemer.schema(Pathname.new(PAYLOAD_SCHEMA_PATH)).valid?(payload) - end - end - end -end diff --git a/lib/error_tracking/collector/sentry_auth_parser.rb b/lib/error_tracking/collector/sentry_auth_parser.rb deleted file mode 100644 index 4945b8f73e1..00000000000 --- a/lib/error_tracking/collector/sentry_auth_parser.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -module ErrorTracking - module Collector - class SentryAuthParser - def self.parse(request) - # Sentry client sends auth in X-Sentry-Auth header - # - # Example of content: - # "Sentry sentry_version=7, sentry_client=sentry-ruby/4.5.1, sentry_timestamp=1623923398, - # sentry_key=afadk312..., sentry_secret=123456asd32131..." - auth = request.headers['X-Sentry-Auth'] - - # Sentry DSN contains key and secret. - # The key is required while secret is optional. - # We are going to use only the key since secret is deprecated. - public_key = auth[/sentry_key=(\w+)/, 1] - - { - public_key: public_key - } - end - end - end -end diff --git a/lib/error_tracking/collector/sentry_request_parser.rb b/lib/error_tracking/collector/sentry_request_parser.rb deleted file mode 100644 index ae632ebd518..00000000000 --- a/lib/error_tracking/collector/sentry_request_parser.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -module ErrorTracking - module Collector - class SentryRequestParser - def self.parse(request) - body = request.body.read - - # Request body contains 3 json objects merged together in one StringIO. - # We need to separate and parse them into array of hash objects. - json_objects = [] - parser = Yajl::Parser.new - - parser.parse(body) do |json_object| - json_objects << json_object - end - - # The request contains 3 objects: sentry metadata, type data and event data. - # We need only last two. Type to decide what to do with the request. - # And event data as it contains all information about the exception. - _, type, event = json_objects - - { - request_type: type['type'], - event: event - } - end - end - end -end diff --git a/lib/error_tracking/stacktrace_builder.rb b/lib/error_tracking/stacktrace_builder.rb index 024587e8683..a2d7091a62a 100644 --- a/lib/error_tracking/stacktrace_builder.rb +++ b/lib/error_tracking/stacktrace_builder.rb @@ -19,6 +19,7 @@ module ErrorTracking 'lineNo' => entry['lineno'], 'context' => build_stacktrace_context(entry), 'filename' => entry['filename'], + 'abs_path' => entry['abs_path'], 'function' => entry['function'], 'colNo' => 0 # we don't support colNo yet. } |