MM-58303 Report client metrics to Prometheus in seconds (#27033)

This commit is contained in:
Harrison Healey
2024-05-21 13:47:44 -04:00
committed by GitHub
parent 72fcedd23a
commit b29c211ee2
2 changed files with 14 additions and 14 deletions

View File

@@ -27,21 +27,21 @@ func (a *App) RegisterPerformanceReport(rctx request.CTX, report *model.Performa
for _, h := range report.Histograms {
switch h.Metric {
case model.ClientTimeToFirstByte:
a.Metrics().ObserveClientTimeToFirstByte(commonLabels["platform"], commonLabels["agent"], h.Value)
a.Metrics().ObserveClientTimeToFirstByte(commonLabels["platform"], commonLabels["agent"], h.Value/1000)
case model.ClientFirstContentfulPaint:
a.Metrics().ObserveClientFirstContentfulPaint(commonLabels["platform"], commonLabels["agent"], h.Value)
a.Metrics().ObserveClientFirstContentfulPaint(commonLabels["platform"], commonLabels["agent"], h.Value/1000)
case model.ClientLargestContentfulPaint:
a.Metrics().ObserveClientLargestContentfulPaint(commonLabels["platform"], commonLabels["agent"], h.Value)
a.Metrics().ObserveClientLargestContentfulPaint(commonLabels["platform"], commonLabels["agent"], h.Value/1000)
case model.ClientInteractionToNextPaint:
a.Metrics().ObserveClientInteractionToNextPaint(commonLabels["platform"], commonLabels["agent"], h.Value)
a.Metrics().ObserveClientInteractionToNextPaint(commonLabels["platform"], commonLabels["agent"], h.Value/1000)
case model.ClientCumulativeLayoutShift:
a.Metrics().ObserveClientCumulativeLayoutShift(commonLabels["platform"], commonLabels["agent"], h.Value)
case model.ClientChannelSwitchDuration:
a.Metrics().ObserveClientChannelSwitchDuration(commonLabels["platform"], commonLabels["agent"], h.Value)
a.Metrics().ObserveClientChannelSwitchDuration(commonLabels["platform"], commonLabels["agent"], h.Value/1000)
case model.ClientTeamSwitchDuration:
a.Metrics().ObserveClientTeamSwitchDuration(commonLabels["platform"], commonLabels["agent"], h.Value)
a.Metrics().ObserveClientTeamSwitchDuration(commonLabels["platform"], commonLabels["agent"], h.Value/1000)
case model.ClientRHSLoadDuration:
a.Metrics().ObserveClientRHSLoadDuration(commonLabels["platform"], commonLabels["agent"], h.Value)
a.Metrics().ObserveClientRHSLoadDuration(commonLabels["platform"], commonLabels["agent"], h.Value/1000)
default:
// we intentionally skip unknown metrics
}

View File

@@ -1138,7 +1138,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Namespace: MetricsNamespace,
Subsystem: MetricsSubsystemClientsWeb,
Name: "time_to_first_byte",
Help: "Duration from when a browser starts to request a page from a server until when it starts to receive data in response (milliseconds)",
Help: "Duration from when a browser starts to request a page from a server until when it starts to receive data in response (seconds)",
},
[]string{"platform", "agent"},
)
@@ -1149,7 +1149,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Namespace: MetricsNamespace,
Subsystem: MetricsSubsystemClientsWeb,
Name: "first_contentful_paint",
Help: "Duration of how long it takes for any content to be displayed on screen to a user (milliseconds)",
Help: "Duration of how long it takes for any content to be displayed on screen to a user (seconds)",
},
[]string{"platform", "agent"},
)
@@ -1160,7 +1160,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Namespace: MetricsNamespace,
Subsystem: MetricsSubsystemClientsWeb,
Name: "largest_contentful_paint",
Help: "Duration of how long it takes for large content to be displayed on screen to a user (milliseconds)",
Help: "Duration of how long it takes for large content to be displayed on screen to a user (seconds)",
},
[]string{"platform", "agent"},
)
@@ -1171,7 +1171,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Namespace: MetricsNamespace,
Subsystem: MetricsSubsystemClientsWeb,
Name: "interaction_to_next_paint",
Help: "Measure of how long it takes for a user to see the effects of clicking with a mouse, tapping with a touchscreen, or pressing a key on the keyboard (milliseconds)",
Help: "Measure of how long it takes for a user to see the effects of clicking with a mouse, tapping with a touchscreen, or pressing a key on the keyboard (seconds)",
},
[]string{"platform", "agent"},
)
@@ -1204,7 +1204,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Namespace: MetricsNamespace,
Subsystem: MetricsSubsystemClientsWeb,
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 (milliseconds)",
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"},
)
@@ -1215,7 +1215,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Namespace: MetricsNamespace,
Subsystem: MetricsSubsystemClientsWeb,
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 (milliseconds)",
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"},
)
@@ -1226,7 +1226,7 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
Namespace: MetricsNamespace,
Subsystem: MetricsSubsystemClientsWeb,
Name: "rhs_load",
Help: "Duration of the time taken from when a user clicks to open a thread in the RHS until when posts in that thread become visible (milliseconds)",
Help: "Duration of the time taken from when a user clicks to open a thread in the RHS until when posts in that thread become visible (seconds)",
},
[]string{"platform", "agent"},
)