Full Mattermost server source with integrated Community Enterprise features. Includes vendor directory for offline/air-gapped builds. Structure: - enterprise-impl/: Enterprise feature implementations - enterprise-community/: Init files that register implementations - enterprise/: Bridge imports (community_imports.go) - vendor/: All dependencies for offline builds Build (online): go build ./cmd/mattermost Build (offline/air-gapped): go build -mod=vendor ./cmd/mattermost 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package api4
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"github.com/mattermost/mattermost/server/public/model"
|
|
)
|
|
|
|
func (api *API) InitClientPerformanceMetrics() {
|
|
api.BaseRoutes.APIRoot.Handle("/client_perf", api.APISessionRequiredTrustRequester(submitPerformanceReport)).Methods(http.MethodPost)
|
|
}
|
|
|
|
func submitPerformanceReport(c *Context, w http.ResponseWriter, r *http.Request) {
|
|
// we return early if server does not have any metrics infra available
|
|
if c.App.Metrics() == nil || !*c.App.Config().MetricsSettings.EnableClientMetrics {
|
|
return
|
|
}
|
|
|
|
var report model.PerformanceReport
|
|
if jsonErr := json.NewDecoder(r.Body).Decode(&report); jsonErr != nil {
|
|
c.SetInvalidParamWithErr("submitPerformanceReport", jsonErr)
|
|
return
|
|
}
|
|
|
|
if err := report.IsValid(); err != nil {
|
|
c.SetInvalidParamWithErr("submitPerformanceReport", err)
|
|
return
|
|
}
|
|
|
|
if appErr := c.App.RegisterPerformanceReport(c.AppContext, &report); appErr != nil {
|
|
c.Err = appErr
|
|
return
|
|
}
|
|
|
|
ReturnStatusOK(w)
|
|
}
|