@Summary Report workspace app stats @ID report-workspace-app-stats @Security CoderSessionToken @Accept json @Tags Enterprise @Param request body wsproxysdk.ReportAppStatsRequest true "Report app stats request" @Success 204 @Router /api/v2/workspaceproxies/me/app-stats [post] @x-apidocgen {"skip": tr
(rw http.ResponseWriter, r *http.Request)
| 516 | // @Router /api/v2/workspaceproxies/me/app-stats [post] |
| 517 | // @x-apidocgen {"skip": true} |
| 518 | func (api *API) workspaceProxyReportAppStats(rw http.ResponseWriter, r *http.Request) { |
| 519 | ctx := r.Context() |
| 520 | _ = httpmw.WorkspaceProxy(r) // Ensure the proxy is authenticated. |
| 521 | |
| 522 | var req wsproxysdk.ReportAppStatsRequest |
| 523 | if !httpapi.Read(ctx, rw, r, &req) { |
| 524 | return |
| 525 | } |
| 526 | |
| 527 | api.Logger.Debug(ctx, "report app stats", slog.F("stats", req.Stats)) |
| 528 | |
| 529 | reporter := api.WorkspaceAppsStatsCollectorOptions.Reporter |
| 530 | if err := reporter.ReportAppStats(ctx, req.Stats); err != nil { |
| 531 | api.Logger.Error(ctx, "report app stats failed", slog.Error(err)) |
| 532 | httpapi.InternalServerError(rw, err) |
| 533 | return |
| 534 | } |
| 535 | |
| 536 | httpapi.Write(ctx, rw, http.StatusNoContent, nil) |
| 537 | } |
| 538 | |
| 539 | // workspaceProxyRegister is used to register a new workspace proxy. When a proxy |
| 540 | // comes online, it will announce itself to this endpoint. This updates its values |
nothing calls this directly
no test coverage detected