MM-58359 Add page_load to Prometheus metrics (#27159)

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Harrison Healey
2024-05-27 14:06:18 -04:00
коммит произвёл GitHub
родитель a9a2144999
Коммит 1bd7b6f4c2
7 изменённых файлов: 46 добавлений и 0 удалений

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

@@ -217,6 +217,7 @@ type MetricsInterfaceImpl struct {
ClientInteractionToNextPaint *prometheus.HistogramVec
ClientCumulativeLayoutShift *prometheus.HistogramVec
ClientLongTasks *prometheus.CounterVec
ClientPageLoadDuration *prometheus.HistogramVec
ClientChannelSwitchDuration *prometheus.HistogramVec
ClientTeamSwitchDuration *prometheus.HistogramVec
ClientRHSLoadDuration *prometheus.HistogramVec
@@ -1200,6 +1201,17 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
)
m.Registry.MustRegister(m.ClientLongTasks)
m.ClientPageLoadDuration = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: MetricsNamespace,
Subsystem: MetricsSubsystemClientsWeb,
Name: "page_load",
Help: "The amount of time from when the browser starts loading the web app until when the web app's load event has finished (seconds)",
},
[]string{"platform", "agent"},
)
m.Registry.MustRegister(m.ClientPageLoadDuration)
m.ClientChannelSwitchDuration = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: MetricsNamespace,
@@ -1726,6 +1738,10 @@ func (mi *MetricsInterfaceImpl) IncrementClientLongTasks(platform, agent string,
mi.ClientLongTasks.With(prometheus.Labels{"platform": platform, "agent": agent}).Add(inc)
}
func (mi *MetricsInterfaceImpl) ObserveClientPageLoadDuration(platform, agent string, elapsed float64) {
mi.ClientPageLoadDuration.With(prometheus.Labels{"platform": platform, "agent": agent}).Observe(elapsed)
}
func (mi *MetricsInterfaceImpl) ObserveClientChannelSwitchDuration(platform, agent string, elapsed float64) {
mi.ClientChannelSwitchDuration.With(prometheus.Labels{"platform": platform, "agent": agent}).Observe(elapsed)
}