1
0
Fork 0
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:
Sergey Cherepanov 2023-05-04 17:39:23 +02:00 committed by Mikhail Iudin
parent 39a8c59f83
commit 0664c310fa
No known key found for this signature in database
GPG key ID: FAAAA8BAABDFF1C0
4 changed files with 33 additions and 8 deletions

View file

@ -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() {