MM-60285 Add fresh label to channel and team switch metrics (#28100)
* Changed measureAndReport to take an object as parameters * MM-60285 Add fresh label to channel and team switch metrics
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
8694b78cc8
Коммит
8c5f00da86
@@ -49,9 +49,19 @@ func (a *App) RegisterPerformanceReport(rctx request.CTX, report *model.Performa
|
||||
case model.ClientPageLoadDuration:
|
||||
a.Metrics().ObserveClientPageLoadDuration(commonLabels["platform"], commonLabels["agent"], h.Value/1000)
|
||||
case model.ClientChannelSwitchDuration:
|
||||
a.Metrics().ObserveClientChannelSwitchDuration(commonLabels["platform"], commonLabels["agent"], h.Value/1000)
|
||||
a.Metrics().ObserveClientChannelSwitchDuration(
|
||||
commonLabels["platform"],
|
||||
commonLabels["agent"],
|
||||
h.GetLabelValue("fresh", model.AcceptedTrueFalseLabels, ""),
|
||||
h.Value/1000,
|
||||
)
|
||||
case model.ClientTeamSwitchDuration:
|
||||
a.Metrics().ObserveClientTeamSwitchDuration(commonLabels["platform"], commonLabels["agent"], h.Value/1000)
|
||||
a.Metrics().ObserveClientTeamSwitchDuration(
|
||||
commonLabels["platform"],
|
||||
commonLabels["agent"],
|
||||
h.GetLabelValue("fresh", model.AcceptedTrueFalseLabels, ""),
|
||||
h.Value/1000,
|
||||
)
|
||||
case model.ClientRHSLoadDuration:
|
||||
a.Metrics().ObserveClientRHSLoadDuration(commonLabels["platform"], commonLabels["agent"], h.Value/1000)
|
||||
case model.ClientGlobalThreadsLoadDuration:
|
||||
|
||||
@@ -111,8 +111,8 @@ type MetricsInterface interface {
|
||||
ObserveClientCumulativeLayoutShift(platform, agent string, elapsed float64)
|
||||
IncrementClientLongTasks(platform, agent string, inc float64)
|
||||
ObserveClientPageLoadDuration(platform, agent string, elapsed float64)
|
||||
ObserveClientChannelSwitchDuration(platform, agent string, elapsed float64)
|
||||
ObserveClientTeamSwitchDuration(platform, agent string, elapsed float64)
|
||||
ObserveClientChannelSwitchDuration(platform, agent, fresh string, elapsed float64)
|
||||
ObserveClientTeamSwitchDuration(platform, agent, fresh string, elapsed float64)
|
||||
ObserveClientRHSLoadDuration(platform, agent string, elapsed float64)
|
||||
ObserveGlobalThreadsLoadDuration(platform, agent string, elapsed float64)
|
||||
ObserveMobileClientLoadDuration(platform string, elapsed float64)
|
||||
|
||||
@@ -298,9 +298,9 @@ func (_m *MetricsInterface) ObserveAPIEndpointDuration(endpoint string, method s
|
||||
_m.Called(endpoint, method, statusCode, originClient, pageLoadContext, elapsed)
|
||||
}
|
||||
|
||||
// ObserveClientChannelSwitchDuration provides a mock function with given fields: platform, agent, elapsed
|
||||
func (_m *MetricsInterface) ObserveClientChannelSwitchDuration(platform string, agent string, elapsed float64) {
|
||||
_m.Called(platform, agent, elapsed)
|
||||
// ObserveClientChannelSwitchDuration provides a mock function with given fields: platform, agent, fresh, elapsed
|
||||
func (_m *MetricsInterface) ObserveClientChannelSwitchDuration(platform string, agent string, fresh string, elapsed float64) {
|
||||
_m.Called(platform, agent, fresh, elapsed)
|
||||
}
|
||||
|
||||
// ObserveClientCumulativeLayoutShift provides a mock function with given fields: platform, agent, elapsed
|
||||
@@ -333,9 +333,9 @@ func (_m *MetricsInterface) ObserveClientRHSLoadDuration(platform string, agent
|
||||
_m.Called(platform, agent, elapsed)
|
||||
}
|
||||
|
||||
// ObserveClientTeamSwitchDuration provides a mock function with given fields: platform, agent, elapsed
|
||||
func (_m *MetricsInterface) ObserveClientTeamSwitchDuration(platform string, agent string, elapsed float64) {
|
||||
_m.Called(platform, agent, elapsed)
|
||||
// ObserveClientTeamSwitchDuration provides a mock function with given fields: platform, agent, fresh, elapsed
|
||||
func (_m *MetricsInterface) ObserveClientTeamSwitchDuration(platform string, agent string, fresh string, elapsed float64) {
|
||||
_m.Called(platform, agent, fresh, elapsed)
|
||||
}
|
||||
|
||||
// ObserveClientTimeToFirstByte provides a mock function with given fields: platform, agent, elapsed
|
||||
|
||||
@@ -1262,7 +1262,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
|
||||
Name: "channel_switch",
|
||||
Help: "Duration of the time taken from when a user clicks on a channel in the LHS to when posts in that channel become visible (seconds)",
|
||||
},
|
||||
[]string{"platform", "agent"},
|
||||
[]string{"platform", "agent", "fresh"},
|
||||
)
|
||||
m.Registry.MustRegister(m.ClientChannelSwitchDuration)
|
||||
|
||||
@@ -1273,7 +1273,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
|
||||
Name: "team_switch",
|
||||
Help: "Duration of the time taken from when a user clicks on a team in the LHS to when posts in that team become visible (seconds)",
|
||||
},
|
||||
[]string{"platform", "agent"},
|
||||
[]string{"platform", "agent", "fresh"},
|
||||
)
|
||||
m.Registry.MustRegister(m.ClientTeamSwitchDuration)
|
||||
|
||||
@@ -1822,12 +1822,12 @@ func (mi *MetricsInterfaceImpl) ObserveClientPageLoadDuration(platform, agent st
|
||||
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)
|
||||
func (mi *MetricsInterfaceImpl) ObserveClientChannelSwitchDuration(platform, agent, fresh string, elapsed float64) {
|
||||
mi.ClientChannelSwitchDuration.With(prometheus.Labels{"platform": platform, "agent": agent, "fresh": fresh}).Observe(elapsed)
|
||||
}
|
||||
|
||||
func (mi *MetricsInterfaceImpl) ObserveClientTeamSwitchDuration(platform, agent string, elapsed float64) {
|
||||
mi.ClientTeamSwitchDuration.With(prometheus.Labels{"platform": platform, "agent": agent}).Observe(elapsed)
|
||||
func (mi *MetricsInterfaceImpl) ObserveClientTeamSwitchDuration(platform, agent, fresh string, elapsed float64) {
|
||||
mi.ClientTeamSwitchDuration.With(prometheus.Labels{"platform": platform, "agent": agent, "fresh": fresh}).Observe(elapsed)
|
||||
}
|
||||
|
||||
func (mi *MetricsInterfaceImpl) ObserveClientRHSLoadDuration(platform, agent string, elapsed float64) {
|
||||
|
||||
@@ -51,6 +51,7 @@ var (
|
||||
"modal_content",
|
||||
"other",
|
||||
)
|
||||
AcceptedTrueFalseLabels = sliceToMapKey("true", "false")
|
||||
)
|
||||
|
||||
type MetricSample struct {
|
||||
|
||||
Ссылка в новой задаче
Block a user