intiail
This commit is contained in:
23
app/routers/metrics/endpoint.go
Normal file
23
app/routers/metrics/endpoint.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package routers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
endpoints "monitoring/app/storage/clickhouse/tables"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func AddEndpointMetric (r *http.Request) (interface{}, int) {
|
||||
d := json.NewDecoder(r.Body)
|
||||
body := endpoints.EndpointMetric{}
|
||||
err := d.Decode(&body)
|
||||
if err != nil {
|
||||
return nil, http.StatusBadRequest
|
||||
}
|
||||
|
||||
err = endpoints.AddEndpointMetric(body)
|
||||
if err != nil {
|
||||
return nil, http.StatusInternalServerError
|
||||
}
|
||||
|
||||
return nil, http.StatusAccepted
|
||||
}
|
||||
Reference in New Issue
Block a user