Skip to content

feat(coderd): support weekly aggregated insights #9684

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

Merged
merged 16 commits into from
Sep 19, 2023
Merged
Prev Previous commit
Next Next commit
more activity
  • Loading branch information
mtojek committed Sep 18, 2023
commit ecd27f4cdd2f90663e819dc6461a6e20353ab60b
12 changes: 12 additions & 0 deletions coderd/insights_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,18 @@ func TestTemplateInsights_Golden(t *testing.T) {
sessionCountVSCode: 1,
sessionCountSSH: 1,
},
{ // One hour of usage.
startedAt: frozenWeekAgo.AddDate(0, 0, -12),
endedAt: frozenWeekAgo.AddDate(0, 0, -12).Add(time.Hour),
sessionCountSSH: 1,
sessionCountReconnectingPTY: 0,
},
{ // Another one hour of usage, but "active users" shouldn't be increased twice.
startedAt: frozenWeekAgo.AddDate(0, 0, -10),
endedAt: frozenWeekAgo.AddDate(0, 0, -10).Add(time.Hour),
sessionCountSSH: 0,
sessionCountReconnectingPTY: 1,
},
},
appUsage: []appUsage{
// TODO(mafredri): This doesn't behave correctly right now
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"display_name": "Web Terminal",
"slug": "reconnecting-pty",
"icon": "/icon/terminal.svg",
"seconds": 0
"seconds": 3600
},
{
"template_ids": [
Expand All @@ -45,7 +45,7 @@
"display_name": "SSH",
"slug": "ssh",
"icon": "/icon/terminal.svg",
"seconds": 3600
"seconds": 7200
},
{
"template_ids": [
Expand All @@ -64,9 +64,11 @@
{
"start_time": "2023-08-01T00:00:00Z",
"end_time": "2023-08-08T00:00:00Z",
"template_ids": [],
"template_ids": [
"00000000-0000-0000-0000-000000000002"
],
"interval": "week",
"active_users": 0
"active_users": 1
},
{
"start_time": "2023-08-08T00:00:00Z",
Expand Down