Skip to content

Commit

Permalink
feat: log redis latency
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bisonai committed Jul 30, 2024
1 parent 64cdb55 commit 966b44e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions node/pkg/aggregator/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type Proof types.Proof
type GlobalAggregate types.GlobalAggregate

type SubmissionData struct {
PublishTime time.Time
GlobalAggregate GlobalAggregate
Proof Proof
}
Expand Down
1 change: 1 addition & 0 deletions node/pkg/aggregator/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func PublishGlobalAggregateAndProof(ctx context.Context, globalAggregate GlobalA
data := SubmissionData{
GlobalAggregate: globalAggregate,
Proof: proof,
PublishTime: time.Now(),
}

diff := time.Since(globalAggregate.Timestamp)
Expand Down
7 changes: 6 additions & 1 deletion node/pkg/dal/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ func (c *Collector) processIncomingData(ctx context.Context, data aggregator.Sub
symbol := c.Symbols[data.GlobalAggregate.ConfigID]
diff := time.Since(data.GlobalAggregate.Timestamp)
if diff > 1*time.Second {
log.Warn().Int64("value", data.GlobalAggregate.Value).Dur("duration", diff).Str("Symbol", symbol).Str("Player", "DalCollector").Msg("processing incoming data")
log.Warn().Dur("duration", diff).Str("Symbol", symbol).Str("Player", "DalCollector").Msg("processing incoming data")
}

diffFromPublish := time.Since(data.PublishTime)
if diffFromPublish > 100*time.Millisecond {
log.Warn().Dur("redisDelay", diffFromPublish).Str("Symbol", symbol).Str("Player", "DalCollector").Msg("redis delay over 100 millisec")
}

result, err := c.IncomingDataToOutgoingData(ctx, data)
Expand Down

0 comments on commit 966b44e

Please sign in to comment.