[MM-57010] Include client type in websocket connections metric (#26763)

* Include client type in websocket connections metric

* Unexport field
Этот коммит содержится в:
Claudio Costa
2024-04-16 10:49:49 -06:00
коммит произвёл GitHub
родитель effb99301e
Коммит 4b508eed46
8 изменённых файлов: 51 добавлений и 11 удалений

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

@@ -11,6 +11,7 @@ import (
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/mlog"
"github.com/mattermost/mattermost/server/v8/channels/app/platform"
"github.com/mattermost/mattermost/server/v8/channels/web"
)
const (
@@ -48,6 +49,13 @@ func connectWebSocket(c *Context, w http.ResponseWriter, r *http.Request) {
Locale: "",
Active: true,
}
// The WebSocket upgrade request coming from mobile is missing the
// user agent so we need to fallback on the session's metadata.
if c.AppContext.Session().IsMobileApp() {
cfg.OriginClient = "mobile"
} else {
cfg.OriginClient = string(web.GetOriginClient(r))
}
cfg.ConnectionID = r.URL.Query().Get(connectionIDParam)
if cfg.ConnectionID == "" || c.AppContext.Session().UserId == "" {