mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 05:57:03 +09:00
30 lines
699 B
Go
30 lines
699 B
Go
package sync
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"go.uber.org/zap"
|
|
|
|
"github.com/anyproto/any-sync/commonspace/spacesyncproto"
|
|
"github.com/anyproto/any-sync/metric"
|
|
)
|
|
|
|
type HandleMessage struct {
|
|
Id uint64
|
|
ReceiveTime time.Time
|
|
StartHandlingTime time.Time
|
|
Deadline time.Time
|
|
SenderId string
|
|
Message *spacesyncproto.ObjectSyncMessage
|
|
PeerCtx context.Context
|
|
}
|
|
|
|
func (m HandleMessage) LogFields(fields ...zap.Field) []zap.Field {
|
|
return append(fields,
|
|
metric.SpaceId(m.Message.SpaceId),
|
|
metric.ObjectId(m.Message.ObjectId),
|
|
metric.QueueDur(m.StartHandlingTime.Sub(m.ReceiveTime)),
|
|
metric.TotalDur(time.Since(m.ReceiveTime)),
|
|
)
|
|
}
|