Skip to content

feat(coderd): add coder_app usage stats #9001

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 28 commits into from
Aug 16, 2023
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
befb4dc
feat(coderd): track `coder_app` usage
mafredri Aug 9, 2023
0bb672a
amend pr comments
mafredri Aug 10, 2023
1171a9d
refactor stats with rollups, add tests
mafredri Aug 10, 2023
858264a
add close
mafredri Aug 14, 2023
e8969d3
fix wsproxy endpoint auth todo
mafredri Aug 14, 2023
7dc4ff2
add backlog for re-reporting in case of failure
mafredri Aug 14, 2023
0561f8d
update dbauthz
mafredri Aug 14, 2023
59d69ac
use dbauthz.AsSystemRestricted for collector flush
mafredri Aug 14, 2023
97ef37b
add stats collection test to apptest
mafredri Aug 14, 2023
fda79c6
Merge branch 'main' into mafredri/feat-add-app-usage-to-template-insi…
mafredri Aug 14, 2023
8926dd0
fix migrations
mafredri Aug 14, 2023
1705138
update plumbing to fix wsproxy tests
mafredri Aug 14, 2023
d709e68
test the stat output in apptest
mafredri Aug 14, 2023
6ec178b
fix issues
mafredri Aug 14, 2023
7db34ba
fix id in dbfake
mafredri Aug 14, 2023
ca83430
fix gen
mafredri Aug 14, 2023
80b7ff3
Merge branch 'main' into mafredri/feat-add-app-usage-to-template-insi…
mafredri Aug 15, 2023
8039a4d
add fixture
mafredri Aug 15, 2023
7e2ec9f
use 15s timeout and timer reset
mafredri Aug 16, 2023
70f6249
pass now to rollup
mafredri Aug 16, 2023
5615e27
track last insert id in fakedb
mafredri Aug 16, 2023
9418abd
fix migration indentation
mafredri Aug 16, 2023
a032f8a
remove sqlc type alias
mafredri Aug 16, 2023
94563ef
defer collect stats
mafredri Aug 16, 2023
e27e905
remove stale comment
mafredri Aug 16, 2023
be67aef
preallocate batch slices
mafredri Aug 16, 2023
37d06e3
Merge branch 'main' into mafredri/feat-add-app-usage-to-template-insi…
mafredri Aug 16, 2023
c9272c5
lower log level to debug for start/stop
mafredri Aug 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix migration indentation
  • Loading branch information
mafredri committed Aug 16, 2023
commit 9418abd01742210b5557b6929d33cd054f28d95c
10 changes: 5 additions & 5 deletions coderd/database/migrations/000150_workspace_app_stats.up.sql
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note before merging: double-check for a duplicate migration!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's any newer migration on main? But yea, I will merge in main and fix if needed before merge. 👍🏻

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
CREATE TABLE workspace_app_stats (
id BIGSERIAL PRIMARY KEY,
user_id uuid NOT NULL REFERENCES users (id),
id BIGSERIAL PRIMARY KEY,
user_id uuid NOT NULL REFERENCES users (id),
workspace_id uuid NOT NULL REFERENCES workspaces (id),
agent_id uuid NOT NULL REFERENCES workspace_agents (id),
agent_id uuid NOT NULL REFERENCES workspace_agents (id),
access_method text NOT NULL,
slug_or_port text NOT NULL,
session_id uuid NOT NULL,
session_started_at timestamptz NOT NULL,
session_ended_at timestamptz NOT NULL,
session_started_at timestamptz NOT NULL,
session_ended_at timestamptz NOT NULL,
requests integer NOT NULL,

-- Set a unique constraint to allow upserting the session_ended_at
Expand Down