diff --git a/backend/cmd/assets/main.go b/backend/cmd/assets/main.go index 3d417d916..5ea9e6b94 100644 --- a/backend/cmd/assets/main.go +++ b/backend/cmd/assets/main.go @@ -1,7 +1,9 @@ package main import ( + "context" "log" + "openreplay/backend/pkg/monitoring" "os" "os/signal" "syscall" @@ -15,7 +17,13 @@ import ( "openreplay/backend/pkg/queue/types" ) +/* +Assets +*/ + func main() { + metrics := monitoring.New("assets") + log.SetFlags(log.LstdFlags | log.LUTC | log.Llongfile) cfg := config.New() @@ -27,6 +35,11 @@ func main() { cfg.AssetsSizeLimit, ) + totalAssets, err := metrics.RegisterCounter("assets_total") + if err != nil { + log.Printf("can't create assets_total metric: %s", err) + } + consumer := queue.NewMessageConsumer( cfg.GroupCache, []string{cfg.TopicCache}, @@ -34,6 +47,7 @@ func main() { switch msg := message.(type) { case *messages.AssetCache: cacher.CacheURL(sessionID, msg.URL) + totalAssets.Add(context.Background(), 1) case *messages.ErrorEvent: if msg.Source != "js_exception" { return diff --git a/backend/cmd/db/main.go b/backend/cmd/db/main.go index c46abd3f1..321e73829 100644 --- a/backend/cmd/db/main.go +++ b/backend/cmd/db/main.go @@ -21,6 +21,10 @@ import ( "openreplay/backend/pkg/queue/types" ) +/* +DB +*/ + func main() { log.SetFlags(log.LstdFlags | log.LUTC | log.Llongfile) diff --git a/backend/cmd/ender/main.go b/backend/cmd/ender/main.go index f9901921a..55b01219b 100644 --- a/backend/cmd/ender/main.go +++ b/backend/cmd/ender/main.go @@ -18,6 +18,10 @@ import ( "openreplay/backend/pkg/queue/types" ) +/* +Ender +*/ + func main() { metrics := monitoring.New("ender") diff --git a/backend/cmd/heuristics/main.go b/backend/cmd/heuristics/main.go index 9f5b38141..80134116d 100644 --- a/backend/cmd/heuristics/main.go +++ b/backend/cmd/heuristics/main.go @@ -19,6 +19,10 @@ import ( "time" ) +/* +Heuristics +*/ + func main() { log.SetFlags(log.LstdFlags | log.LUTC | log.Llongfile) diff --git a/backend/cmd/http/main.go b/backend/cmd/http/main.go index 97d49b93e..84271dd2a 100644 --- a/backend/cmd/http/main.go +++ b/backend/cmd/http/main.go @@ -17,6 +17,10 @@ import ( "openreplay/backend/pkg/queue" ) +/* +HTTP +*/ + func main() { metrics := monitoring.New("http") diff --git a/backend/cmd/integrations/main.go b/backend/cmd/integrations/main.go index 543e6e449..246e2c1fc 100644 --- a/backend/cmd/integrations/main.go +++ b/backend/cmd/integrations/main.go @@ -17,6 +17,10 @@ import ( "openreplay/backend/pkg/token" ) +/* +Integrations +*/ + func main() { log.SetFlags(log.LstdFlags | log.LUTC | log.Llongfile) diff --git a/backend/cmd/sink/main.go b/backend/cmd/sink/main.go index d6edbb22c..fca491069 100644 --- a/backend/cmd/sink/main.go +++ b/backend/cmd/sink/main.go @@ -21,6 +21,10 @@ import ( "openreplay/backend/pkg/url/assets" ) +/* +Sink +*/ + func main() { metrics := monitoring.New("sink") @@ -74,7 +78,7 @@ func main() { // If message timestamp is empty, use at least ts of session start ts := message.Meta().Timestamp if ts == 0 { - log.Printf("zero ts; sessID: %d, msg: %+v", sessionID, message) + //log.Printf("zero ts; sessID: %d, msg: %+v", sessionID, message) } else { // Log ts of last processed message counter.Update(sessionID, time.UnixMilli(ts)) diff --git a/backend/cmd/storage/main.go b/backend/cmd/storage/main.go index 541993df6..2f92d0259 100644 --- a/backend/cmd/storage/main.go +++ b/backend/cmd/storage/main.go @@ -17,6 +17,10 @@ import ( s3storage "openreplay/backend/pkg/storage" ) +/* +Storage +*/ + func main() { metrics := monitoring.New("storage")