Add platform information for push notification metrics (#27460)

* Add platform information for push notification metrics

* Address feedback

* Add the client platform returned by the devices to the normalize function

* Add "no platform" platform label to distinguish from unknown
Этот коммит содержится в:
Daniel Espino García
2024-07-05 09:34:01 +02:00
коммит произвёл GitHub
родитель 6bbf7bbb9f
Коммит e5a3dd7fea
15 изменённых файлов: 122 добавлений и 105 удалений

Просмотреть файл

@@ -24,7 +24,7 @@ func (a *App) NotifySessionsExpired() error {
// Get all mobile sessions that expired within the last hour.
sessions, err := a.ch.srv.Store().Session().GetSessionsExpired(OneHourMillis, true, true)
if err != nil {
a.CountNotificationReason(model.NotificationStatusError, model.NotificationTypePush, model.NotificationReasonFetchError)
a.CountNotificationReason(model.NotificationStatusError, model.NotificationTypePush, model.NotificationReasonFetchError, model.NotificationNoPlatform)
a.NotificationsLog().Error("Cannot get sessions expired",
mlog.String("type", model.NotificationTypePush),
mlog.String("status", model.NotificationStatusError),
@@ -47,7 +47,7 @@ func (a *App) NotifySessionsExpired() error {
errPush := a.sendToPushProxy(tmpMessage, session)
if errPush != nil {
a.CountNotificationReason(model.NotificationStatusError, model.NotificationTypePush, model.NotificationReasonPushProxySendError)
a.CountNotificationReason(model.NotificationStatusError, model.NotificationTypePush, model.NotificationReasonPushProxySendError, tmpMessage.Platform)
a.NotificationsLog().Error("Failed to send to push proxy",
mlog.String("type", model.NotificationTypePush),
mlog.String("status", model.NotificationStatusNotSent),