This commit is contained in:
@@ -230,6 +230,7 @@ type JobMetricsOut struct {
|
||||
// @Tags jobs
|
||||
// @Produce json
|
||||
// @Param period query string false "Time period (e.g. 1h, 24h, 7d)" default(24h)
|
||||
// @Param agent_id query string false "Filter by agent ID"
|
||||
// @Success 200 {object} JobMetricsOut
|
||||
// @Failure 400 {object} map[string]string
|
||||
// @Security Bearer
|
||||
@@ -242,8 +243,9 @@ func (h *JobsHandlers) GetJobMetrics(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
agentID := c.Query("agent_id")
|
||||
since := time.Now().Add(-period)
|
||||
metrics, err := h.jobRepo.GetJobMetrics(c.Request.Context(), since)
|
||||
metrics, err := h.jobRepo.GetJobMetrics(c.Request.Context(), since, agentID)
|
||||
if err != nil {
|
||||
c.Error(err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user