Add metrics for mobile versions snapshots (#28191)
* Add metrics for mobile versions snapshots * Add notifications disabled and fix lint * Address feedback * Verify all references to JobTypeActiveUsers * Fix typos * Improve platform values * Add test and MySQL support
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d45a54a8e9
Коммит
040838b056
@@ -215,6 +215,7 @@ type MetricsInterfaceImpl struct {
|
||||
MobileClientLoadDuration *prometheus.HistogramVec
|
||||
MobileClientChannelSwitchDuration *prometheus.HistogramVec
|
||||
MobileClientTeamSwitchDuration *prometheus.HistogramVec
|
||||
MobileClientSessionMetadataGauge *prometheus.GaugeVec
|
||||
}
|
||||
|
||||
func init() {
|
||||
@@ -1335,6 +1336,17 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
|
||||
)
|
||||
m.Registry.MustRegister(m.MobileClientTeamSwitchDuration)
|
||||
|
||||
m.MobileClientSessionMetadataGauge = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_session_metadata",
|
||||
Help: "The number of mobile sessions in each version, platform and whether they have the notifications disabled",
|
||||
},
|
||||
[]string{"version", "platform", "notifications_disabled"},
|
||||
)
|
||||
m.Registry.MustRegister(m.MobileClientSessionMetadataGauge)
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
@@ -1850,6 +1862,14 @@ func (mi *MetricsInterfaceImpl) ObserveMobileClientTeamSwitchDuration(platform s
|
||||
mi.MobileClientTeamSwitchDuration.With(prometheus.Labels{"platform": platform}).Observe(elapsed)
|
||||
}
|
||||
|
||||
func (mi *MetricsInterfaceImpl) ObserveMobileClientSessionMetadata(version string, platform string, value float64, notificationDisabled string) {
|
||||
mi.MobileClientSessionMetadataGauge.With(prometheus.Labels{"version": version, "platform": platform, "notifications_disabled": notificationDisabled}).Set(value)
|
||||
}
|
||||
|
||||
func (mi *MetricsInterfaceImpl) ClearMobileClientSessionMetadata() {
|
||||
mi.MobileClientSessionMetadataGauge.Reset()
|
||||
}
|
||||
|
||||
func extractDBCluster(driver, connectionString string) (string, error) {
|
||||
host, err := extractHost(driver, connectionString)
|
||||
if err != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user