feat(backend/assets): added metric (total_assets)
This commit is contained in:
parent
9292d315c4
commit
0b0798b0ef
8 changed files with 43 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ import (
|
|||
"openreplay/backend/pkg/queue/types"
|
||||
)
|
||||
|
||||
/*
|
||||
DB
|
||||
*/
|
||||
|
||||
func main() {
|
||||
log.SetFlags(log.LstdFlags | log.LUTC | log.Llongfile)
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@ import (
|
|||
"openreplay/backend/pkg/queue/types"
|
||||
)
|
||||
|
||||
/*
|
||||
Ender
|
||||
*/
|
||||
|
||||
func main() {
|
||||
metrics := monitoring.New("ender")
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
/*
|
||||
Heuristics
|
||||
*/
|
||||
|
||||
func main() {
|
||||
log.SetFlags(log.LstdFlags | log.LUTC | log.Llongfile)
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ import (
|
|||
"openreplay/backend/pkg/queue"
|
||||
)
|
||||
|
||||
/*
|
||||
HTTP
|
||||
*/
|
||||
|
||||
func main() {
|
||||
metrics := monitoring.New("http")
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ import (
|
|||
"openreplay/backend/pkg/token"
|
||||
)
|
||||
|
||||
/*
|
||||
Integrations
|
||||
*/
|
||||
|
||||
func main() {
|
||||
log.SetFlags(log.LstdFlags | log.LUTC | log.Llongfile)
|
||||
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ import (
|
|||
s3storage "openreplay/backend/pkg/storage"
|
||||
)
|
||||
|
||||
/*
|
||||
Storage
|
||||
*/
|
||||
|
||||
func main() {
|
||||
metrics := monitoring.New("storage")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue