-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add telemetry events for Jupyterhub REST APIs #3218
base: main
Are you sure you want to change the base?
Conversation
48b04ef
to
c799a7f
Compare
c799a7f
to
22e7311
Compare
Originally sorting was added for easier testing
jupyterhub/apihandlers/auth.py
Outdated
self.eventlog.record_event( | ||
eventlogging_schema_fqn('auth-token-action'), | ||
1, | ||
{'action': 'get', 'token_id': token}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't include the token itself in events. This should be orm_token.api_id
jupyterhub/apihandlers/auth.py
Outdated
self.eventlog.record_event( | ||
eventlogging_schema_fqn('auth-token-action'), | ||
1, | ||
{'action': 'create', 'token_id': api_token,}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here about token id
jupyterhub/apihandlers/users.py
Outdated
1, | ||
{ | ||
'action': 'create', | ||
'target_user': {'username': user.name, 'admin': False}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'target_user': {'username': user.name, 'admin': False}, | |
'target_user': {'username': user.name, 'admin': admin}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops
jupyterhub/apihandlers/users.py
Outdated
1, | ||
{ | ||
'action': 'get', | ||
'target_user': {'username': user.name, 'admin': user.admin}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try to use the same fields as the user model, so 'name'
here so it's user.name
instead of the redundant user.username
'requester': self.current_user.name, | ||
'target_user': {'username': user.name, 'admin': user.admin}, | ||
'prior_state': prior_state, | ||
'auth_state_change': 'auth_state' in data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
jupyterhub/apihandlers/users.py
Outdated
1, | ||
{ | ||
'action': 'get', | ||
'target_user': user.name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should target_user always have the same schema ({name, admin}
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we do the same for requester everywhere as well?
jupyterhub/apihandlers/users.py
Outdated
'action': 'delete', | ||
'target_user': user.name, | ||
'requester': self.current_user.name, | ||
'token_id': token_id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'token_id': token_id, | |
'token_id': token.api_id, |
same schema for /authorizations/token and /users/{name}/tokens endpoints
I've marked this as draft for now. @minrk @yuvipanda What do you think are the next steps for this PR (and presumably jupyter-server/jupyter_server#364)? |
I think it just needs review (and now conflict resolution). @yuvipanda do you want to have a look over the schemas? I can handle the conflicts. |
Add event schemas + code for emitting those events for the endpoints in Jupyterhub REST APIs.