Skip to content
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

Refactor APIs to unify workspace activity #13279

Open
11 tasks
f0ssel opened this issue May 15, 2024 · 0 comments
Open
11 tasks

Refactor APIs to unify workspace activity #13279

f0ssel opened this issue May 15, 2024 · 0 comments
Assignees
Labels
chore Non-customer facing refactors, cleanup, or technical debt.

Comments

@f0ssel
Copy link
Contributor

f0ssel commented May 15, 2024

This is a collection of tasks related to stabilizing our internal tracking of user activity from a workspace. Once completed, the code should ensure that there's a single place to keep track of user activity in order to reduce the chance of bugs where we forget to implement it properly for future features.

Internal APIs

  • Migrate workspace_builds.deadline to a view and alter existing queries to query that view instead.
    • Implementation note: we can rename the existing column before deleting it later.
  • Modify UpdateWorkspaceDeadlineByIDUpdateWorkspaceMaxDeadlineByID and update existing callers
  • Replace existing usage of ActivityBumpWorkspace with StatsCollector.Collect()
  • Replace existing usage of UpdateWorkspaceLastUsedAt et al. with StatsCollector.Collect()
  • Modify metricscache to query AppStats to fetch session counts by IDE (for admin activity bar)

External APIs

Once we update how the internal APIs handle tracking of user activity we must update things like the CLI and jetbrains plugins to be compatible with the new flows. This will ensure users will continue to see accurate data from these external sources.

  • Modify /usage endpoint to accept a payload and call StatsCollector.Collect(), returning a SessionID if required
  • Update CLI commands (coder ssh, etc.) to periodically send a payload to /usage
  • Include an option to skip tracking
  • Update coder-jetbrains plugin to periodically send payloads to /usage
    • Ensure that periodic background activity does not send unwanted activity bumps

Release Readiness

Before release we need to make sure that the new code paths are stable and ready for customers to consume. This requires testing and release documentation for how to safely upgrade.

  • Scaletest new changes
  • Require cli upgrade in release notes
@f0ssel f0ssel added this to the Workspace Activity Refactor milestone May 15, 2024
@f0ssel f0ssel self-assigned this May 15, 2024
@coder-labeler coder-labeler bot added the chore Non-customer facing refactors, cleanup, or technical debt. label May 15, 2024
@f0ssel f0ssel changed the title Refactor internal APIs to unify workspace activity Refactor APIs to unify workspace activity May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Non-customer facing refactors, cleanup, or technical debt.
Projects
None yet
Development

No branches or pull requests

1 participant