From 357418c66c504c00b9f89a45a03070ac8dadbc6a Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Sun, 15 Jun 2025 23:00:45 +0300 Subject: [PATCH] fix --- app/routers/take.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/routers/take.go b/app/routers/take.go index 21fd5dd..e2477ba 100644 --- a/app/routers/take.go +++ b/app/routers/take.go @@ -3,9 +3,11 @@ package routers import ( "bytes" "fmt" + "log" "net/http" "os" tasks "queues-go/app/storage/mongo/collections" + "strconv" "sync" "time" ) @@ -24,15 +26,19 @@ var MutexMap map[string]*sync.Mutex func sendLatency(timestamp time.Time, latency int) error { loc, _ := time.LoadLocation("Europe/Moscow") + s := fmt.Sprintf( `{"timestamp":"%s","service":"queues","environment":"%s","name":"latency","count":%s}`, timestamp.In(loc).Format("2006-01-02T15:04:05Z"), os.Getenv("STAGE"), - latency, + strconv.Itoa(latency), ) data := []byte(s) r := bytes.NewReader(data) _, err := http.Post("http://monitoring:1237/api/v1/metrics/increment", "application/json", r) + if err != nil { + log.Printf("ERROR %s", err.Error()) + } return err } -- 2.45.2