Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Backend
Commits
4dfbf7fa
Commit
4dfbf7fa
authored
1 year ago
by
Valentin Rigal
Browse files
Options
Downloads
Patches
Plain Diff
Report the process ID as a Sentry tag when using task auth
parent
6401d875
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!2023
Report the process ID as a Sentry tag when using task auth
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arkindex/ponos/authentication.py
+5
-0
5 additions, 0 deletions
arkindex/ponos/authentication.py
with
5 additions
and
0 deletions
arkindex/ponos/authentication.py
+
5
−
0
View file @
4dfbf7fa
...
...
@@ -8,6 +8,7 @@ from arkindex.ponos.models import Agent, Task
from
rest_framework_simplejwt.authentication
import
JWTAuthentication
from
rest_framework_simplejwt.exceptions
import
InvalidToken
from
rest_framework_simplejwt.settings
import
api_settings
from
sentry_sdk
import
set_tag
class
AgentUser
(
Agent
):
...
...
@@ -91,6 +92,10 @@ class TaskAuthentication(TokenAuthentication):
except
ObjectDoesNotExist
:
raise
AuthenticationFailed
(
'
Task has no process.
'
)
# Add the process ID to Sentry tags, to speed up troubleshooting
# by identifying if and which process is affected by the error.
set_tag
(
"
process.id
"
,
str
(
process
.
id
))
if
not
process
.
creator_id
or
not
process
.
creator
.
is_active
:
# Same error message as the standard TokenAuthentication
raise
AuthenticationFailed
(
'
User inactive or deleted.
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment