Commit e0d5bee3 authored by Bastian Ike's avatar Bastian Ike Committed by Bastian Ike

Error Tracking: Fix collecting errors for golang

This change makes the schema match Go error events, see:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/72050.
The sentry message format is described here:
https://github.com/getsentry/develop/commit/7578cb2b.

Changelog: fixed
parent 21a5ce7d
...@@ -13,57 +13,72 @@ ...@@ -13,57 +13,72 @@
"type": "object" "type": "object"
}, },
"exception": { "exception": {
"type": "object", "oneOf": [
"required": ["values"], {
"properties": {
"values": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object", "$ref": "#/definitions/exception"
"required": [], }
"properties": { },
"type": { {
"type": "string" "type": "object",
}, "required": ["values"],
"value": { "properties": {
"type": "string" "values": {
}, "type": "array",
"stacktrace": { "items": {
"$ref": "#/definitions/exception"
}
}
}
}
]
}
},
"definitions": {
"exception": {
"type": "object",
"required": [],
"properties": {
"type": {
"type": "string"
},
"value": {
"type": "string"
},
"stacktrace": {
"type": "object",
"required": [],
"properties": {
"frames": {
"type": "array",
"items": {
"type": "object", "type": "object",
"required": [], "required": [],
"properties": { "properties": {
"frames": { "abs_path": {
"type": "array", "type": "string"
"items": { },
"type": "object", "function": {
"required": [], "type": "string"
"properties": { },
"abs_path": { "lineno": {
"type": "string" "type": "number"
}, },
"function": { "in_app": {
"type": "string" "type": "boolean"
}, },
"lineno": { "filename": {
"type": "number" "type": "string"
}, },
"in_app": { "pre_context": {
"type": "boolean" "type": "array"
}, },
"filename": { "context_line": {
"type": "string" "type": ["string", "null"]
}, },
"pre_context": { "post_context": {
"type": "array" "type": "array"
},
"context_line": {
"type": ["string", "null"]
},
"post_context": {
"type": "array"
}
}
}
} }
} }
} }
......
...@@ -42,6 +42,12 @@ RSpec.describe ErrorTracking::Collector::PayloadValidator do ...@@ -42,6 +42,12 @@ RSpec.describe ErrorTracking::Collector::PayloadValidator do
it_behaves_like 'valid payload' it_behaves_like 'valid payload'
end end
context 'go payload' do
let(:payload) { Gitlab::Json.parse(fixture_file('error_tracking/go_parsed_event.json')) }
it_behaves_like 'valid payload'
end
context 'empty payload' do context 'empty payload' do
let(:payload) { '' } let(:payload) { '' }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment