From 35dcc8390cff657e69ea295525520569946a1a94 Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Sun, 15 Jun 2025 17:05:18 +0300 Subject: [PATCH] fix --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index c7d2fdb..e8fb004 100644 --- a/main.go +++ b/main.go @@ -53,12 +53,18 @@ func handlerWrapper(f func(*http.Request) (interface{}, int)) func(http.Response } } +func metricProxy(w http.ResponseWriter, r *http.Request) { + http.Post("http://monitoring:1237/api/v1/metrics/task", "application/json", r.Body) + w.WriteHeader(202) +} + func main() { client.Connect() routers.MutexMap = make(map[string]*sync.Mutex) http.HandleFunc("/api/v1/take", handlerWrapper(routers.Take)) http.HandleFunc("/api/v1/finish", handlerWrapper(routers.Finish)) http.HandleFunc("/api/v1/put", handlerWrapper(routers.Put)) + http.HandleFunc("/api/v1/metric", metricProxy) log.Printf("Server started") http.ListenAndServe(":1239", nil) }