Repository navigation
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the
workspace-usageexperiment and the behavior behind it. Every code path now behaves as it did with the experiment off, which is the default. The public SDK and API surface is deprecated instead of removed.What the experiment did
With
workspace-usageenabled, clients sent{agent_id, app_name}toPOST /api/v2/workspaces/{id}/usage. The server recorded a synthetic agent stat for that request and setusage=trueon it. At the same time, the server dropped session counts reported by the agent. Metrics cache, Prometheus, and telemetry then read from separate*Usage*queries that filtered on theusagecolumn.Changes
ExperimentWorkspaceUsage,PostWorkspaceUsageRequest,UsageAppName*,PostWorkspaceUsageWithBody, andUpdateWorkspaceUsageWithBodyContextstay but are markedDeprecated. The body variants forward to the no-bodyPostWorkspaceUsage/UpdateWorkspaceUsageContext, which are no longer marked deprecated.workspace-usageis dropped fromExperimentsKnown, so setting it logs the existing "ignoring unknown experiment" warning.POST /workspaces/{id}/usagestays, and so does its optional body in Swagger, now documented as ignored. It does what it did with the experiment off: bumplast_used_atand return 204. Agent session counts are no longer cleared.usage boolparameter fromReporter.ReportAgentStats,Batcher.Add,metricscache.New, andprometheusmetrics.AgentStats. Removes the now-unusedagentapiExperimentsoption and theHasSessionCounts/ClearSessionCountshelpers.GetDeploymentWorkspaceAgentUsageStats,GetWorkspaceAgentUsageStats, andGetWorkspaceAgentUsageStatsAndLabels. Migration000606dropsworkspace_agent_stats.usage.ssh,vscodessh, andexp rptysend heartbeats without a body. The hidden--usage-appflag is kept because the VS Code extension passes it.disablestill turns off heartbeats, and any other value is ignored.workspaceUsageno longer takesusageAppand posts without a body.Compatibility notes
CODER_EXPERIMENTS=workspace-usagewill get the usual unknown-experiment handling.usage=truebefore the upgrade become ordinary agent stats. These rows age out with the normal stats retention window.Implementation plan / decision log
TrackUsage/last_used_at, agent-reported session counts, and insights unchanged.--usage-app(hidden) for VS Code extension compatibility. Only thedisablevalue still does anything.UpdateUsagesubtest incli/ssh_test,WorkspaceUsageExperimentinagentapi, the Usage query tests, and app-name normalization at ingest). Collapse the metricscache and prometheus tests that looped overusagetrue and false.TestWorkspaceUsageTrackingnow checks that both no-body and legacy-body requests return 204 and record no agent stats.Generated by Coder Agents on behalf of @f0ssel.