-
Notifications
You must be signed in to change notification settings - Fork 928
feat: add connectionlogs
API
#18628
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
base: ethan/reroute-connection-logs
Are you sure you want to change the base?
feat: add connectionlogs
API
#18628
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
||
httpapi.Write(ctx, rw, http.StatusOK, codersdk.ConnectionLogResponse{ | ||
ConnectionLogs: convertConnectionLogs(dblogs), | ||
Count: 0, // TODO(ethanndickson): Set count |
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.
This is populated in the next PR in the stack.
8cec6d1
to
482a5d3
Compare
e4e1a04
to
1fcd8d7
Compare
482a5d3
to
ccc7539
Compare
// ConnectionLogStatus is the status of a connection log entry. | ||
// It's the argument to the `status` filter when fetching connection logs. | ||
type ConnectionLogStatus string | ||
|
||
const ( | ||
ConnectionLogStatusConnected ConnectionLogStatus = "connected" | ||
ConnectionLogStatusDisconnected ConnectionLogStatus = "disconnected" | ||
) |
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.
Unused?
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.
Only used in the frontend for the UI filter😔
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.
In that case can you add a comment so it doesn't get removed by accident.
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.
"This is only used in the frontend, not the backend."
ccc7539
to
406e3f4
Compare
This is the second PR for moving connection events out of the audit log.
This PR:
/api/v2/connectionlogs
endpointGetAuthorizedConnectionLogsOffset
and thus the endpoint.There's quite a few, but I was aiming for feature parity with the audit log.
organization:<id|name>
workspace_owner:<username>
workspace_owner_email:<email>
type:<ssh|vscode|jetbrains|reconnecting_pty|workspace_app|port_forwarding>
username:<username>
user_email:<email>
started_after:<time>
started_before:<time>
workspace_id:<id>
connection_id:<id>
status:<connected|disconnected>
connected
only sessions with a nullclose_time
are returned, ifdisconnected
, only those with a non-nullclose_time
. If filter is omitted, both are returned.Future PRs:
count
onConnectionLogResponse
using a seperate query (to preemptively mitigate the issue described in Audit log slows to a crawl when nearing 1 million entries #17689)