feat: add workspace agent stat reporting to telemetry (#6577)

This aggregates stats periodically and sends them by agent ID to
our telemetry server. It should help us identify which editors are
primarily in use.
This commit is contained in:
Kyle Carberry
2023-03-13 14:16:54 -05:00
committed by GitHub
parent 813b54942f
commit 35df1b10d0
7 changed files with 237 additions and 0 deletions
+2
View File
@@ -67,6 +67,7 @@ func TestTelemetry(t *testing.T) {
_ = dbgen.WorkspaceResource(t, db, database.WorkspaceResource{
Transition: database.WorkspaceTransitionStart,
})
_ = dbgen.WorkspaceAgentStat(t, db, database.WorkspaceAgentStat{})
_, err = db.InsertLicense(ctx, database.InsertLicenseParams{
UploadedAt: database.Now(),
JWT: "",
@@ -86,6 +87,7 @@ func TestTelemetry(t *testing.T) {
require.Len(t, snapshot.WorkspaceAgents, 1)
require.Len(t, snapshot.WorkspaceBuilds, 1)
require.Len(t, snapshot.WorkspaceResources, 1)
require.Len(t, snapshot.WorkspaceAgentStats, 1)
})
t.Run("HashedEmail", func(t *testing.T) {
t.Parallel()