Log google messages send response type

This commit is contained in:
Tulir Asokan 2023-08-30 19:37:04 +03:00
parent 2f8af9b6eb
commit 48d761a397
2 changed files with 11 additions and 4 deletions

View file

@ -226,10 +226,13 @@ func (portal *Portal) sendMessageMetrics(evt *event.Event, err error, part strin
}
portal.sendStatusEvent(origEvtID, evt.ID, err, nil)
} else {
portal.zlog.Debug().
logEvt := portal.zlog.Debug().
Str("event_id", evt.ID.String()).
Str("event_type", evt.Type.Type).
Msg("Handled Matrix event")
Str("event_type", evt.Type.Type)
if ms.responseType != 0 {
logEvt = logEvt.Int64("response_type", ms.responseType)
}
logEvt.Msg("Handled Matrix event")
portal.sendDeliveryReceipt(evt.ID)
if msgType != "message" {
portal.bridge.SendMessageSuccessCheckpoint(evt, status.MsgStepRemote, ms.getRetryNum())
@ -272,6 +275,7 @@ type metricSender struct {
completed bool
retryNum int
timings *messageTimings
responseType int64
}
func (ms *metricSender) getRetryNum() int {

View file

@ -1730,7 +1730,10 @@ func (portal *Portal) HandleMatrixMessage(sender *User, evt *event.Event, timing
Str("participant_id", req.GetMessagePayload().GetParticipantID()).
Msg("Sending Matrix message to Google Messages")
start = time.Now()
_, err = sender.Client.SendMessage(req)
resp, err := sender.Client.SendMessage(req)
if resp != nil {
ms.responseType = resp.Type
}
timings.send = time.Since(start)
if err != nil {
go ms.sendMessageMetrics(evt, err, "Error sending", true)