mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 05:57:03 +09:00
request log
This commit is contained in:
parent
39a8c59f83
commit
0664c310fa
4 changed files with 33 additions and 8 deletions
|
@ -62,6 +62,7 @@ type HandleMessage struct {
|
|||
Deadline time.Time
|
||||
SenderId string
|
||||
Message *spacesyncproto.ObjectSyncMessage
|
||||
PeerCtx context.Context
|
||||
}
|
||||
|
||||
func (m HandleMessage) LogFields(fields ...zap.Field) []zap.Field {
|
||||
|
@ -407,7 +408,9 @@ func (s *space) handleMessage(msg HandleMessage) {
|
|||
ctx := peer.CtxWithPeerId(context.Background(), msg.SenderId)
|
||||
ctx = logger.CtxWithFields(ctx, zap.Uint64("msgId", msg.Id), zap.String("senderId", msg.SenderId))
|
||||
defer func() {
|
||||
s.metric.RequestLog(ctx, msg.LogFields(zap.Error(err))...)
|
||||
s.metric.RequestLog(msg.PeerCtx, "space.streamOp", msg.LogFields(
|
||||
zap.Error(err),
|
||||
)...)
|
||||
}()
|
||||
|
||||
if !msg.Deadline.IsZero() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue