MCPcopy Index your code
hub / github.com/coder/coder / deploymentStats

Method deploymentStats

coderd/deployment.go:47–62  ·  view source on GitHub ↗

@Summary Get deployment stats @ID get-deployment-stats @Security CoderSessionToken @Produce json @Tags General @Success 200 {object} codersdk.DeploymentStats @Router /api/v2/deployment/stats [get]

(rw http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

45// @Success 200 {object} codersdk.DeploymentStats
46// @Router /api/v2/deployment/stats [get]
47func (api *API) deploymentStats(rw http.ResponseWriter, r *http.Request) {
48 if !api.Authorize(r, policy.ActionRead, rbac.ResourceDeploymentStats) {
49 httpapi.Forbidden(rw)
50 return
51 }
52
53 stats, ok := api.metricsCache.DeploymentStats()
54 if !ok {
55 httpapi.Write(r.Context(), rw, http.StatusBadRequest, codersdk.Response{
56 Message: "Deployment stats are still processing!",
57 })
58 return
59 }
60
61 httpapi.Write(r.Context(), rw, http.StatusOK, stats)
62}
63
64// @Summary Build info
65// @ID build-info

Callers

nothing calls this directly

Calls 5

AuthorizeMethod · 0.95
ForbiddenFunction · 0.92
WriteFunction · 0.92
ContextMethod · 0.65
DeploymentStatsMethod · 0.45

Tested by

no test coverage detected