
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
27 lines
529 B
Go
27 lines
529 B
Go
package routers
|
|
|
|
import (
|
|
"encoding/json"
|
|
"log"
|
|
client "monitoring/app/storage/clickhouse"
|
|
endpoints "monitoring/app/storage/clickhouse/tables"
|
|
"net/http"
|
|
)
|
|
|
|
func AddEndpointMetric(r *http.Request) (interface{}, int) {
|
|
d := json.NewDecoder(r.Body)
|
|
body := client.EndpointMetric{}
|
|
err := d.Decode(&body)
|
|
if err != nil {
|
|
return nil, http.StatusBadRequest
|
|
}
|
|
|
|
endpoints.AddEndpointMetric(body)
|
|
if err != nil {
|
|
log.Print(err.Error())
|
|
return nil, http.StatusInternalServerError
|
|
}
|
|
|
|
return nil, http.StatusAccepted
|
|
}
|