monitoring/app/routers/metrics/task.go
Egor Matveev ea63cd794c
All checks were successful
Deploy Dev / Build (pull_request) Successful in 1m4s
Deploy Dev / Push (pull_request) Successful in 36s
Deploy Dev / Deploy dev (pull_request) Successful in 10s
Deploy Prod / Build (pull_request) Successful in 1m0s
Deploy Prod / Push (pull_request) Successful in 36s
Deploy Prod / Deploy prod (pull_request) Successful in 16s
fix
2025-06-21 12:04:27 +03:00

27 lines
509 B
Go

package routers
import (
"encoding/json"
"log"
client "monitoring/app/storage/clickhouse"
tasks "monitoring/app/storage/clickhouse/tables"
"net/http"
)
func AddTaskMetric(r *http.Request) (interface{}, int) {
d := json.NewDecoder(r.Body)
body := client.TaskMetric{}
err := d.Decode(&body)
if err != nil {
return nil, http.StatusBadRequest
}
tasks.AddTaskMetric(body)
if err != nil {
log.Print(err.Error())
return nil, http.StatusInternalServerError
}
return nil, http.StatusAccepted
}