Skip to content

Commit

Permalink
improved logging
Browse files Browse the repository at this point in the history
  • Loading branch information
TymKh committed Mar 6, 2024
1 parent 0af8323 commit daf636b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions mevshare/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ func (m *API) SendBundle(ctx context.Context, bundle SendMevBundleArgs) (_ SendM
logger.Warn("failed to validate bundle", zap.Error(err))
return SendMevBundleResponse{}, err
}
logger.Debug("received bundle", zap.String("bundle", hash.String()), zap.Time("receivedAt", startAt), zap.Int64("timestamp", startAt.Unix()))

if oldBundle, ok := m.knownBundleCache.Get(hash); ok {
if !newerInclusion(&oldBundle, &bundle) {
logger.Debug("bundle already known, ignoring", zap.String("hash", hash.Hex()))
Expand Down
10 changes: 6 additions & 4 deletions mevshare/builders.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,11 @@ func (b *BuildersBackend) SendBundle(ctx context.Context, logger *zap.Logger, bu

start := time.Now()
err := builder.SendBundle(ctx, &args)
logger.Debug("Sent bundle to internal builder", zap.String("builder", builder.Name), zap.Duration("duration", time.Since(start)), zap.Error(err))
now := time.Now()
logger.Debug("Sent bundle to internal builder", zap.String("builder", builder.Name), zap.Duration("duration", time.Since(start)), zap.Error(err), zap.Time("time", now), zap.Int64("timestamp", now.Unix()))

if err != nil {
logger.Warn("Failed to send bundle to internal builder", zap.Error(err), zap.String("builder", builder.Name))
logger.Warn("Failed to send bundle to internal builder", zap.Error(err), zap.String("builder", builder.Name), zap.Time("time", now), zap.Int64("timestamp", now.Unix()))
} else {
internalBuildersSuccess[idx] = true
}
Expand All @@ -236,10 +237,11 @@ func (b *BuildersBackend) SendBundle(ctx context.Context, logger *zap.Logger, bu

start := time.Now()
err := builder.SendBundle(ctx, &args)
logger.Debug("Sent bundle to external builder", zap.String("builder", builder.Name), zap.Duration("duration", time.Since(start)), zap.Error(err))
now := time.Now()
logger.Debug("Sent bundle to external builder", zap.String("builder", builder.Name), zap.Duration("duration", time.Since(start)), zap.Error(err), zap.Time("time", now), zap.Int64("timestamp", now.Unix()))

if err != nil {
logger.Warn("Failed to send bundle to external builder", zap.Error(err), zap.String("builder", builder.Name))
logger.Warn("Failed to send bundle to external builder", zap.Error(err), zap.String("builder", builder.Name), zap.Time("time", now), zap.Int64("timestamp", now.Unix()))
}
}(builder)
} else {
Expand Down

0 comments on commit daf636b

Please sign in to comment.