mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 17:22:18 +08:00
Grafana: Replace magic number with a constant variable in response status (#80132)
* Chore: Replace response status with const var * Apply suggestions from code review Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com> * Add net/http import --------- Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
This commit is contained in:
@ -62,12 +62,12 @@ func (hs *HTTPServer) AdminGetVerboseSettings(c *contextmodel.ReqContext) respon
|
||||
func (hs *HTTPServer) AdminGetStats(c *contextmodel.ReqContext) response.Response {
|
||||
adminStats, err := hs.statsService.GetAdminStats(c.Req.Context(), &stats.GetAdminStatsQuery{})
|
||||
if err != nil {
|
||||
return response.Error(500, "Failed to get admin stats from database", err)
|
||||
return response.Error(http.StatusInternalServerError, "Failed to get admin stats from database", err)
|
||||
}
|
||||
anonymousDeviceExpiration := 30 * 24 * time.Hour
|
||||
devicesCount, err := hs.anonService.CountDevices(c.Req.Context(), time.Now().Add(-anonymousDeviceExpiration), time.Now().Add(time.Minute))
|
||||
if err != nil {
|
||||
return response.Error(500, "Failed to get anon stats from database", err)
|
||||
return response.Error(http.StatusInternalServerError, "Failed to get anon stats from database", err)
|
||||
}
|
||||
adminStats.AnonymousStats.ActiveDevices = devicesCount
|
||||
|
||||
|
Reference in New Issue
Block a user