feat: add connection statistics for workspace agents (#6469)

* fix: don't make session counts cumulative

This made for some weird tracking... we want the point-in-time
number of counts!

* Add databasefake query for getting agent stats

* Add deployment stats endpoint

* The query... works?!?

* Fix aggregation query

* Select from multiple tables instead

* Fix continuous stats

* Increase period of stat refreshes

* Add workspace counts to deployment stats

* fmt

* Add a slight bit of responsiveness

* Fix template version editor overflow

* Add refresh button

* Fix font family on button

* Fix latest stat being reported

* Revert agent conn stats

* Fix linting error

* Fix tests

* Fix gen

* Fix migrations

* Block on sending stat updates

* Add test fixtures

* Fix response structure

* make gen
This commit is contained in:
Kyle Carberry
2023-03-08 21:05:45 -06:00
committed by GitHub
parent 9d40d2ffdc
commit 5304b4e483
43 changed files with 1790 additions and 174 deletions
+26
View File
@@ -1445,6 +1445,7 @@ export const MockPermissions: Permissions = {
viewAuditLog: true,
viewDeploymentValues: true,
viewUpdateCheck: true,
viewDeploymentStats: true,
}
export const MockAppearance: TypesGen.AppearanceConfig = {
@@ -1536,3 +1537,28 @@ export const MockTemplateVersionGitAuth: TypesGen.TemplateVersionGitAuth = {
authenticate_url: "https://example.com/gitauth/github",
authenticated: false,
}
export const MockDeploymentStats: TypesGen.DeploymentStats = {
aggregated_from: "2023-03-06T19:08:55.211625Z",
collected_at: "2023-03-06T19:12:55.211625Z",
next_update_at: "2023-03-06T19:20:55.211625Z",
session_count: {
vscode: 128,
jetbrains: 5,
ssh: 32,
reconnecting_pty: 15,
},
workspaces: {
building: 15,
failed: 12,
pending: 5,
running: 32,
stopped: 16,
connection_latency_ms: {
P50: 32.56,
P95: 15.23,
},
rx_bytes: 15613513253,
tx_bytes: 36113513253,
},
}