Skip to content

chore: accept payload on workspace usage route #13544

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 12 commits into from
Jun 14, 2024
Merged

Conversation

f0ssel
Copy link
Contributor

@f0ssel f0ssel commented Jun 11, 2024

This adds new behavior to the workspace usage endpoint to accept a payload containing an AgentID and AppName. This is so the CLI can start informing us of activity based on different "defined apps". This is currently behind an experiment flag workspace-usage which it will stay behind until we are reading to migrate from workspace_agent_stats table to workspace_app_stats.

@f0ssel f0ssel marked this pull request as ready for review June 12, 2024 18:30
@f0ssel f0ssel requested a review from johnstcn June 12, 2024 18:37
@@ -137,7 +137,7 @@ func (r *RootCmd) portForward() *serpent.Command {
listeners[i] = l
}

stopUpdating := client.UpdateWorkspaceUsageContext(ctx, workspace.ID)
stopUpdating := client.UpdateWorkspaceUsageContext(ctx, workspace.ID, codersdk.PostWorkspaceUsageRequest{})
Copy link
Member

Choose a reason for hiding this comment

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

non-blocking: We might want to expose this as an app named "port-forward" or similar?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this will require we add a field to the workspace_agent_stats table which is a change I did not want to include in this PR. In general, do you think it's a good idea to add this field given it may impact other features like insights?

Copy link
Member

Choose a reason for hiding this comment

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

Let's leave it for now. I'd like to avoid any insights changes in the course of this refactor.

@f0ssel f0ssel requested a review from johnstcn June 13, 2024 20:57
@f0ssel f0ssel merged commit 44d6913 into main Jun 14, 2024
31 checks passed
@f0ssel f0ssel deleted the f0ssel/usage-payload branch June 14, 2024 14:08
@github-actions github-actions bot locked and limited conversation to collaborators Jun 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants