Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
6cb5d7db
Commit
6cb5d7db
authored
Feb 24, 2022
by
LeoniePhiline
Committed by
Vitali Tatarintev
Feb 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(error-tracking): Accept empty transaction string in sentry payload
Fixes #353153
parent
e6b5fc5d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
7 deletions
+63
-7
app/services/error_tracking/collect_error_service.rb
app/services/error_tracking/collect_error_service.rb
+1
-1
spec/fixtures/error_tracking/php_empty_transaction.json
spec/fixtures/error_tracking/php_empty_transaction.json
+45
-0
spec/requests/api/error_tracking/collector_spec.rb
spec/requests/api/error_tracking/collector_spec.rb
+6
-0
spec/services/error_tracking/collect_error_service_spec.rb
spec/services/error_tracking/collect_error_service_spec.rb
+11
-6
No files found.
app/services/error_tracking/collect_error_service.rb
View file @
6cb5d7db
...
...
@@ -60,7 +60,7 @@ module ErrorTracking
end
def
actor
return
event
[
'transaction'
]
if
event
[
'transaction'
]
return
event
[
'transaction'
]
if
event
[
'transaction'
]
.
present?
# Some SDKs do not have a transaction attribute.
# So we build it by combining function name and module name from
...
...
spec/fixtures/error_tracking/php_empty_transaction.json
0 → 100644
View file @
6cb5d7db
{
"event_id"
:
"dquJXuPF9sP1fMy5RpKo979xUALjNDQB"
,
"timestamp"
:
1645191605.123456
,
"platform"
:
"php"
,
"sdk"
:
{
"name"
:
"sentry.php"
,
"version"
:
"3.3.7"
},
"logger"
:
"php"
,
"transaction"
:
""
,
"server_name"
:
"oAjA5zTgIjqP"
,
"release"
:
"C0FFEE"
,
"environment"
:
"Development/Berlin"
,
"exception"
:
{
"values"
:
[
{
"type"
:
"TestException"
,
"value"
:
"Sentry test exception"
,
"stacktrace"
:
{
"frames"
:
[
{
"filename"
:
"/src/Path/To/Class.php"
,
"lineno"
:
3
,
"in_app"
:
true
,
"abs_path"
:
"/var/www/html/src/Path/To/Class.php"
,
"function"
:
"Path
\\
To
\\
Class::method"
,
"raw_function"
:
"Path
\\
To
\\
Class::method"
,
"pre_context"
:
[
"// Pre-context"
],
"context_line"
:
"throw new TestException('Sentry test exception');"
,
"post_context"
:
[
"// Post-context"
]
}
]
},
"mechanism"
:
{
"type"
:
"generic"
,
"handled"
:
true
}
}
]
}
}
spec/requests/api/error_tracking/collector_spec.rb
View file @
6cb5d7db
...
...
@@ -171,6 +171,12 @@ RSpec.describe API::ErrorTracking::Collector do
it_behaves_like
'successful request'
end
context
'when JSON key transaction is empty string'
do
let_it_be
(
:raw_event
)
{
fixture_file
(
'error_tracking/php_empty_transaction.json'
)
}
it_behaves_like
'successful request'
end
context
'sentry_key as param and empty headers'
do
let
(
:url
)
{
"/error_tracking/collector/api/
#{
project
.
id
}
/store?sentry_key=
#{
sentry_key
}
"
}
let
(
:headers
)
{
{}
}
...
...
spec/services/error_tracking/collect_error_service_spec.rb
View file @
6cb5d7db
...
...
@@ -51,25 +51,30 @@ RSpec.describe ErrorTracking::CollectErrorService do
end
end
context
'unusual payload'
do
context
'
with
unusual payload'
do
let
(
:modified_event
)
{
parsed_event
}
let
(
:event
)
{
described_class
.
new
(
project
,
nil
,
event:
modified_event
).
execute
}
context
'
missing transaction
'
do
context
'
when transaction is missing
'
do
it
'builds actor from stacktrace'
do
modified_event
.
delete
(
'transaction'
)
event
=
described_class
.
new
(
project
,
nil
,
event:
modified_event
).
execute
expect
(
event
.
error
.
actor
).
to
eq
'find()'
end
end
context
'when transaction is an empty string'
do
\
it
'builds actor from stacktrace'
do
modified_event
[
'transaction'
]
=
''
expect
(
event
.
error
.
actor
).
to
eq
'find()'
end
end
context
'timestamp is numeric'
do
context
'
when
timestamp is numeric'
do
it
'parses timestamp'
do
modified_event
[
'timestamp'
]
=
'1631015580.50'
event
=
described_class
.
new
(
project
,
nil
,
event:
modified_event
).
execute
expect
(
event
.
occurred_at
).
to
eq
'2021-09-07T11:53:00.5'
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment