Skip to content

Commit

Permalink
added Lag field
Browse files Browse the repository at this point in the history
  • Loading branch information
OS-M committed Dec 29, 2022
1 parent f060b87 commit 4483c60
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/utils/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (logger *Logger) StartLogging(ctx context.Context, logInterval time.Duratio
t := table.NewWriter()
t.SetStyle(table.StyleRounded)
t.SetOutputMirror(logger.file)
t.AppendHeader(table.Row{"Stream id", "Height", "Current Timestamp", "Avg Speed", "Speed", "Processed", "Remaining"})
t.AppendHeader(table.Row{"Stream id", "Height", "Current Timestamp", "Lag", "Avg Speed", "Speed", "Processed", "Remaining"})

log := time.NewTicker(logInterval)
defer log.Stop()
Expand Down Expand Up @@ -170,6 +170,7 @@ func streamRowFromData(lastLoggedTime time.Time, streamId string, data *streamDa
streamId,
data.lastProcessedEvent.Offset.Height,
data.lastProcessedEvent.Timestamp.Time().Format("2006-01-02 15:04:05"),
time.Now().Sub(data.lastProcessedEvent.Timestamp.Time()).Truncate(time.Second).String(),
fmt.Sprintf("%.2f", avgSpeed),
fmt.Sprintf("%.2f", divideAsFloats(
1000.*(data.messagesProcessed-data.messagesProcessedWhenLastLogged),
Expand Down

0 comments on commit 4483c60

Please sign in to comment.