MM-63467: Refactor constLabels to a common initializer (#30779)
This is useful to avoid mistakes while adding new metrics. https://mattermost.atlassian.net/browse/MM-63467 ```release-note NONE ``` Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
6ae0efd285
Коммит
271d928e87
@@ -276,6 +276,12 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
|
||||
additionalLabels[MetricsCloudDatabaseClusterLabel] = cluster
|
||||
}
|
||||
}
|
||||
|
||||
// Helper function to apply additional labels to histogram options
|
||||
withLabels := func(opts prometheus.HistogramOpts) prometheus.HistogramOpts {
|
||||
opts.ConstLabels = additionalLabels
|
||||
return opts
|
||||
}
|
||||
// Posts Subsystem
|
||||
|
||||
m.PostCreateCounter = prometheus.NewCounter(prometheus.CounterOpts{
|
||||
@@ -460,13 +466,12 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
|
||||
})
|
||||
m.Registry.MustRegister(m.ClusterRequestsCounter)
|
||||
|
||||
m.ClusterRequestsDuration = prometheus.NewHistogram(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemCluster,
|
||||
Name: "cluster_request_duration_seconds",
|
||||
Help: "The total duration in seconds of the inter-node cluster requests.",
|
||||
ConstLabels: additionalLabels,
|
||||
})
|
||||
m.ClusterRequestsDuration = prometheus.NewHistogram(withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemCluster,
|
||||
Name: "cluster_request_duration_seconds",
|
||||
Help: "The total duration in seconds of the inter-node cluster requests.",
|
||||
}))
|
||||
m.Registry.MustRegister(m.ClusterRequestsDuration)
|
||||
|
||||
m.ClusterEventTypeCounters = prometheus.NewCounterVec(
|
||||
@@ -730,13 +735,12 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
|
||||
})
|
||||
m.Registry.MustRegister(m.SearchPostSearchesCounter)
|
||||
|
||||
m.SearchPostSearchesDuration = prometheus.NewHistogram(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemSearch,
|
||||
Name: "posts_searches_duration_seconds",
|
||||
Help: "The total duration in seconds of post searches.",
|
||||
ConstLabels: additionalLabels,
|
||||
})
|
||||
m.SearchPostSearchesDuration = prometheus.NewHistogram(withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemSearch,
|
||||
Name: "posts_searches_duration_seconds",
|
||||
Help: "The total duration in seconds of post searches.",
|
||||
}))
|
||||
m.Registry.MustRegister(m.SearchPostSearchesDuration)
|
||||
|
||||
m.SearchFileSearchesCounter = prometheus.NewCounter(prometheus.CounterOpts{
|
||||
@@ -748,13 +752,12 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
|
||||
})
|
||||
m.Registry.MustRegister(m.SearchFileSearchesCounter)
|
||||
|
||||
m.SearchFileSearchesDuration = prometheus.NewHistogram(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemSearch,
|
||||
Name: "files_searches_duration_seconds",
|
||||
Help: "The total duration in seconds of file searches.",
|
||||
ConstLabels: additionalLabels,
|
||||
})
|
||||
m.SearchFileSearchesDuration = prometheus.NewHistogram(withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemSearch,
|
||||
Name: "files_searches_duration_seconds",
|
||||
Help: "The total duration in seconds of file searches.",
|
||||
}))
|
||||
m.Registry.MustRegister(m.SearchFileSearchesDuration)
|
||||
|
||||
m.ActiveUsers = prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
@@ -767,37 +770,34 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
|
||||
m.Registry.MustRegister(m.ActiveUsers)
|
||||
|
||||
m.StoreTimesHistograms = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemDB,
|
||||
Name: "store_time",
|
||||
Help: "Time to execute the store method",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemDB,
|
||||
Name: "store_time",
|
||||
Help: "Time to execute the store method",
|
||||
}),
|
||||
[]string{"method", "success"},
|
||||
)
|
||||
m.Registry.MustRegister(m.StoreTimesHistograms)
|
||||
|
||||
m.APITimesHistograms = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemAPI,
|
||||
Name: "time",
|
||||
Help: "Time to execute the api handler",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemAPI,
|
||||
Name: "time",
|
||||
Help: "Time to execute the api handler",
|
||||
}),
|
||||
[]string{"handler", "method", "status_code", "origin_client", "page_load_context"},
|
||||
)
|
||||
m.Registry.MustRegister(m.APITimesHistograms)
|
||||
|
||||
m.RedisTimesHistograms = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemDB,
|
||||
Name: "cache_time",
|
||||
Help: "Time to execute the cache handler",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemDB,
|
||||
Name: "cache_time",
|
||||
Help: "Time to execute the cache handler",
|
||||
}),
|
||||
[]string{"cache_name", "operation"},
|
||||
)
|
||||
m.Registry.MustRegister(m.RedisTimesHistograms)
|
||||
@@ -841,48 +841,44 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
|
||||
// Plugin Subsystem
|
||||
|
||||
m.PluginHookTimeHistogram = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemPlugin,
|
||||
Name: "hook_time",
|
||||
Help: "Time to execute plugin hook handler in seconds.",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemPlugin,
|
||||
Name: "hook_time",
|
||||
Help: "Time to execute plugin hook handler in seconds.",
|
||||
}),
|
||||
[]string{"plugin_id", "hook_name", "success"},
|
||||
)
|
||||
m.Registry.MustRegister(m.PluginHookTimeHistogram)
|
||||
|
||||
m.PluginMultiHookTimeHistogram = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemPlugin,
|
||||
Name: "multi_hook_time",
|
||||
Help: "Time to execute multiple plugin hook handler in seconds.",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemPlugin,
|
||||
Name: "multi_hook_time",
|
||||
Help: "Time to execute multiple plugin hook handler in seconds.",
|
||||
}),
|
||||
[]string{"plugin_id"},
|
||||
)
|
||||
m.Registry.MustRegister(m.PluginMultiHookTimeHistogram)
|
||||
|
||||
m.PluginMultiHookServerTimeHistogram = prometheus.NewHistogram(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemPlugin,
|
||||
Name: "multi_hook_server_time",
|
||||
Help: "Time for the server to execute multiple plugin hook handlers in seconds.",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemPlugin,
|
||||
Name: "multi_hook_server_time",
|
||||
Help: "Time for the server to execute multiple plugin hook handlers in seconds.",
|
||||
}),
|
||||
)
|
||||
m.Registry.MustRegister(m.PluginMultiHookServerTimeHistogram)
|
||||
|
||||
m.PluginAPITimeHistogram = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemPlugin,
|
||||
Name: "api_time",
|
||||
Help: "Time to execute plugin API handlers in seconds.",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemPlugin,
|
||||
Name: "api_time",
|
||||
Help: "Time to execute plugin API handlers in seconds.",
|
||||
}),
|
||||
[]string{"plugin_id", "api_name", "success"},
|
||||
)
|
||||
m.Registry.MustRegister(m.PluginAPITimeHistogram)
|
||||
@@ -983,25 +979,23 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
|
||||
m.Registry.MustRegister(m.RemoteClusterMsgErrorsCounter)
|
||||
|
||||
m.RemoteClusterPingTimesHistograms = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemRemoteCluster,
|
||||
Name: "ping_time",
|
||||
Help: "The ping roundtrip times to the remote cluster",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemRemoteCluster,
|
||||
Name: "ping_time",
|
||||
Help: "The ping roundtrip times to the remote cluster",
|
||||
}),
|
||||
[]string{"remote_id"},
|
||||
)
|
||||
m.Registry.MustRegister(m.RemoteClusterPingTimesHistograms)
|
||||
|
||||
m.RemoteClusterClockSkewHistograms = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemRemoteCluster,
|
||||
Name: "clock_skew",
|
||||
Help: "An approximated value for clock skew between clusters",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemRemoteCluster,
|
||||
Name: "clock_skew",
|
||||
Help: "An approximated value for clock skew between clusters",
|
||||
}),
|
||||
[]string{"remote_id"},
|
||||
)
|
||||
m.Registry.MustRegister(m.RemoteClusterClockSkewHistograms)
|
||||
@@ -1033,13 +1027,12 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
|
||||
m.Registry.MustRegister(m.SharedChannelsSyncCount)
|
||||
|
||||
m.SharedChannelsTaskInQueueHistogram = prometheus.NewHistogram(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemSharedChannels,
|
||||
Name: "task_in_queue_duration_seconds",
|
||||
Help: "Duration tasks spend in queue (seconds)",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemSharedChannels,
|
||||
Name: "task_in_queue_duration_seconds",
|
||||
Help: "Duration tasks spend in queue (seconds)",
|
||||
}),
|
||||
)
|
||||
m.Registry.MustRegister(m.SharedChannelsTaskInQueueHistogram)
|
||||
|
||||
@@ -1055,49 +1048,45 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
|
||||
m.Registry.MustRegister(m.SharedChannelsQueueSize)
|
||||
|
||||
m.SharedChannelsSyncCollectionHistogram = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemSharedChannels,
|
||||
Name: "sync_collection_duration_seconds",
|
||||
Help: "Duration tasks spend collecting sync data (seconds)",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemSharedChannels,
|
||||
Name: "sync_collection_duration_seconds",
|
||||
Help: "Duration tasks spend collecting sync data (seconds)",
|
||||
}),
|
||||
[]string{"remote_id"},
|
||||
)
|
||||
m.Registry.MustRegister(m.SharedChannelsSyncCollectionHistogram)
|
||||
|
||||
m.SharedChannelsSyncSendHistogram = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemSharedChannels,
|
||||
Name: "sync_send_duration_seconds",
|
||||
Help: "Duration tasks spend sending sync data (seconds)",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemSharedChannels,
|
||||
Name: "sync_send_duration_seconds",
|
||||
Help: "Duration tasks spend sending sync data (seconds)",
|
||||
}),
|
||||
[]string{"remote_id"},
|
||||
)
|
||||
m.Registry.MustRegister(m.SharedChannelsSyncSendHistogram)
|
||||
|
||||
m.SharedChannelsSyncCollectionStepHistogram = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemSharedChannels,
|
||||
Name: "sync_collection_step_duration_seconds",
|
||||
Help: "Duration tasks spend in each step collecting data (seconds)",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemSharedChannels,
|
||||
Name: "sync_collection_step_duration_seconds",
|
||||
Help: "Duration tasks spend in each step collecting data (seconds)",
|
||||
}),
|
||||
[]string{"remote_id", "step"},
|
||||
)
|
||||
m.Registry.MustRegister(m.SharedChannelsSyncCollectionStepHistogram)
|
||||
|
||||
m.SharedChannelsSyncSendStepHistogram = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemSharedChannels,
|
||||
Name: "sync_send_step_duration_seconds",
|
||||
Help: "Duration tasks spend in each step sending data (seconds)",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemSharedChannels,
|
||||
Name: "sync_send_step_duration_seconds",
|
||||
Help: "Duration tasks spend in each step sending data (seconds)",
|
||||
}),
|
||||
[]string{"remote_id", "step"},
|
||||
)
|
||||
m.Registry.MustRegister(m.SharedChannelsSyncSendStepHistogram)
|
||||
@@ -1197,109 +1186,101 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
|
||||
m.Registry.MustRegister(m.NotificationUnsupportedCounters)
|
||||
|
||||
m.ClientTimeToFirstByte = NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
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 (seconds)",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
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 (seconds)",
|
||||
}),
|
||||
[]string{"platform", "agent", "user_id"},
|
||||
m.Platform.Log(),
|
||||
)
|
||||
m.Registry.MustRegister(m.ClientTimeToFirstByte)
|
||||
|
||||
m.ClientTimeToLastByte = NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsWeb,
|
||||
Name: "time_to_last_byte",
|
||||
Help: "Duration from when a browser starts to request a page from a server until when it receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first. (seconds)",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsWeb,
|
||||
Name: "time_to_last_byte",
|
||||
Help: "Duration from when a browser starts to request a page from a server until when it receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first. (seconds)",
|
||||
}),
|
||||
[]string{"platform", "agent", "user_id"},
|
||||
m.Platform.Log(),
|
||||
)
|
||||
m.Registry.MustRegister(m.ClientTimeToLastByte)
|
||||
|
||||
m.ClientTimeToDOMInteractive = NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsWeb,
|
||||
Name: "dom_interactive",
|
||||
Help: "Duration from when a browser starts to request a page from a server until when it sets the document's readyState to interactive. (seconds)",
|
||||
Buckets: []float64{.1, .25, .5, 1, 2.5, 5, 7.5, 10, 12.5, 15},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsWeb,
|
||||
Name: "dom_interactive",
|
||||
Help: "Duration from when a browser starts to request a page from a server until when it sets the document's readyState to interactive. (seconds)",
|
||||
Buckets: []float64{.1, .25, .5, 1, 2.5, 5, 7.5, 10, 12.5, 15},
|
||||
}),
|
||||
[]string{"platform", "agent", "user_id"},
|
||||
m.Platform.Log(),
|
||||
)
|
||||
m.Registry.MustRegister(m.ClientTimeToDOMInteractive)
|
||||
|
||||
m.ClientSplashScreenEnd = NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsWeb,
|
||||
Name: "splash_screen",
|
||||
Help: "Duration from when a browser starts to request a page from a server until when the splash screen ends. (seconds)",
|
||||
Buckets: []float64{.1, .25, .5, 1, 2.5, 5, 7.5, 10, 12.5, 15},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsWeb,
|
||||
Name: "splash_screen",
|
||||
Help: "Duration from when a browser starts to request a page from a server until when the splash screen ends. (seconds)",
|
||||
Buckets: []float64{.1, .25, .5, 1, 2.5, 5, 7.5, 10, 12.5, 15},
|
||||
}),
|
||||
[]string{"platform", "agent", "page_type", "user_id"},
|
||||
m.Platform.Log(),
|
||||
)
|
||||
m.Registry.MustRegister(m.ClientSplashScreenEnd)
|
||||
|
||||
m.ClientFirstContentfulPaint = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
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 (seconds)",
|
||||
|
||||
// Extend the range of buckets for this while we get a better idea of the expected range of this metric is
|
||||
Buckets: []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 15, 20},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
Buckets: []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 15, 20},
|
||||
}),
|
||||
[]string{"platform", "agent", "user_id"},
|
||||
)
|
||||
m.Registry.MustRegister(m.ClientFirstContentfulPaint)
|
||||
|
||||
m.ClientLargestContentfulPaint = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
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 (seconds)",
|
||||
|
||||
// Extend the range of buckets for this while we get a better idea of the expected range of this metric is
|
||||
Buckets: []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 15, 20},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
Buckets: []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 15, 20},
|
||||
}),
|
||||
[]string{"platform", "agent", "region", "user_id"},
|
||||
)
|
||||
m.Registry.MustRegister(m.ClientLargestContentfulPaint)
|
||||
|
||||
m.ClientInteractionToNextPaint = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
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 (seconds)",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
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 (seconds)",
|
||||
}),
|
||||
[]string{"platform", "agent", "interaction", "user_id"},
|
||||
)
|
||||
m.Registry.MustRegister(m.ClientInteractionToNextPaint)
|
||||
|
||||
m.ClientCumulativeLayoutShift = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsWeb,
|
||||
Name: "cumulative_layout_shift",
|
||||
Help: "Measure of how much a page's content shifts unexpectedly",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsWeb,
|
||||
Name: "cumulative_layout_shift",
|
||||
Help: "Measure of how much a page's content shifts unexpectedly",
|
||||
}),
|
||||
[]string{"platform", "agent", "user_id"},
|
||||
)
|
||||
m.Registry.MustRegister(m.ClientCumulativeLayoutShift)
|
||||
@@ -1317,184 +1298,169 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
|
||||
m.Registry.MustRegister(m.ClientLongTasks)
|
||||
|
||||
m.ClientPageLoadDuration = 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)",
|
||||
Buckets: []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 20, 40},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(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)",
|
||||
Buckets: []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 20, 40},
|
||||
}),
|
||||
[]string{"platform", "agent", "user_id"},
|
||||
m.Platform.Log(),
|
||||
)
|
||||
m.Registry.MustRegister(m.ClientPageLoadDuration)
|
||||
|
||||
m.ClientChannelSwitchDuration = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
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 (seconds)",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
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 (seconds)",
|
||||
}),
|
||||
[]string{"platform", "agent", "fresh", "user_id"},
|
||||
)
|
||||
m.Registry.MustRegister(m.ClientChannelSwitchDuration)
|
||||
|
||||
m.ClientTeamSwitchDuration = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
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 (seconds)",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
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 (seconds)",
|
||||
}),
|
||||
[]string{"platform", "agent", "fresh", "user_id"},
|
||||
)
|
||||
m.Registry.MustRegister(m.ClientTeamSwitchDuration)
|
||||
|
||||
m.ClientRHSLoadDuration = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
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 (seconds)",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
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 (seconds)",
|
||||
}),
|
||||
[]string{"platform", "agent", "user_id"},
|
||||
)
|
||||
m.Registry.MustRegister(m.ClientRHSLoadDuration)
|
||||
|
||||
m.ClientGlobalThreadsLoadDuration = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsWeb,
|
||||
Name: "global_threads_load",
|
||||
Help: "Duration of the time taken from when a user clicks to open Threads in the LHS until when the global threads view becomes visible (milliseconds)",
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsWeb,
|
||||
Name: "global_threads_load",
|
||||
Help: "Duration of the time taken from when a user clicks to open Threads in the LHS until when the global threads view becomes visible (milliseconds)",
|
||||
}),
|
||||
[]string{"platform", "agent", "user_id"},
|
||||
)
|
||||
m.Registry.MustRegister(m.ClientGlobalThreadsLoadDuration)
|
||||
|
||||
m.MobileClientLoadDuration = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_load",
|
||||
Help: "Duration of the time taken from when a user opens the app and the app finally loads all relevant information (seconds)",
|
||||
Buckets: []float64{1, 1.5, 2, 3, 4, 4.5, 5, 5.5, 6, 7.5, 10, 20, 25, 30},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_load",
|
||||
Help: "Duration of the time taken from when a user opens the app and the app finally loads all relevant information (seconds)",
|
||||
Buckets: []float64{1, 1.5, 2, 3, 4, 4.5, 5, 5.5, 6, 7.5, 10, 20, 25, 30},
|
||||
}),
|
||||
[]string{"platform"},
|
||||
)
|
||||
|
||||
m.MobileClientNetworkRequestsAverageSpeed = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_network_requests_average_speed",
|
||||
Help: "Average speed of network requests in megabytes per second (MBps)",
|
||||
Buckets: []float64{1000, 10000, 50000, 100000, 500000, 1000000, 5000000},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_network_requests_average_speed",
|
||||
Help: "Average speed of network requests in megabytes per second (MBps)",
|
||||
Buckets: []float64{1000, 10000, 50000, 100000, 500000, 1000000, 5000000},
|
||||
}),
|
||||
[]string{"platform", "agent", "network_request_group"},
|
||||
)
|
||||
|
||||
m.MobileClientNetworkRequestsEffectiveLatency = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_network_requests_effective_latency",
|
||||
Help: "Effective latency of network requests in seconds",
|
||||
Buckets: []float64{0.1, 0.25, 0.5, 1, 2.5, 5, 10},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_network_requests_effective_latency",
|
||||
Help: "Effective latency of network requests in seconds",
|
||||
Buckets: []float64{0.1, 0.25, 0.5, 1, 2.5, 5, 10},
|
||||
}),
|
||||
[]string{"platform", "agent", "network_request_group"},
|
||||
)
|
||||
|
||||
m.MobileClientNetworkRequestsElapsedTime = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_network_requests_elapsed_time",
|
||||
Help: "Total elapsed time of network requests in seconds",
|
||||
Buckets: []float64{0.1, 0.25, 0.5, 1, 2.5, 5, 10},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_network_requests_elapsed_time",
|
||||
Help: "Total elapsed time of network requests in seconds",
|
||||
Buckets: []float64{0.1, 0.25, 0.5, 1, 2.5, 5, 10},
|
||||
}),
|
||||
[]string{"platform", "agent", "network_request_group"},
|
||||
)
|
||||
|
||||
m.MobileClientNetworkRequestsLatency = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_network_requests_latency",
|
||||
Help: "Latency of network requests in seconds",
|
||||
Buckets: []float64{0.1, 0.25, 0.5, 1, 2.5, 5, 10},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_network_requests_latency",
|
||||
Help: "Latency of network requests in seconds",
|
||||
Buckets: []float64{0.1, 0.25, 0.5, 1, 2.5, 5, 10},
|
||||
}),
|
||||
[]string{"platform", "agent", "network_request_group"},
|
||||
)
|
||||
|
||||
m.MobileClientNetworkRequestsTotalCompressedSize = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_network_requests_total_compressed_size",
|
||||
Help: "Total compressed size of network requests in bytes",
|
||||
Buckets: []float64{0.1, 0.5, 1, 2, 5, 10, 20, 50},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_network_requests_total_compressed_size",
|
||||
Help: "Total compressed size of network requests in bytes",
|
||||
Buckets: []float64{0.1, 0.5, 1, 2, 5, 10, 20, 50},
|
||||
}),
|
||||
[]string{"platform", "agent", "network_request_group"},
|
||||
)
|
||||
|
||||
m.MobileClientNetworkRequestsTotalParallelRequests = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_network_requests_total_parallel_requests",
|
||||
Help: "Total number of parallel network requests made",
|
||||
Buckets: []float64{1, 2, 5, 10, 20, 50, 100},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_network_requests_total_parallel_requests",
|
||||
Help: "Total number of parallel network requests made",
|
||||
Buckets: []float64{1, 2, 5, 10, 20, 50, 100},
|
||||
}),
|
||||
[]string{"platform", "agent", "network_request_group"},
|
||||
)
|
||||
|
||||
m.MobileClientNetworkRequestsTotalRequests = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_network_requests_total_requests",
|
||||
Help: "Total number of network requests made",
|
||||
Buckets: []float64{1, 2, 5, 10, 20, 50, 100},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_network_requests_total_requests",
|
||||
Help: "Total number of network requests made",
|
||||
Buckets: []float64{1, 2, 5, 10, 20, 50, 100},
|
||||
}),
|
||||
[]string{"platform", "agent", "network_request_group"},
|
||||
)
|
||||
|
||||
m.MobileClientNetworkRequestsTotalSequentialRequests = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_network_requests_total_sequential_requests",
|
||||
Help: "Total number of sequential network requests made",
|
||||
Buckets: []float64{1, 2, 5, 10, 20, 50, 100},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_network_requests_total_sequential_requests",
|
||||
Help: "Total number of sequential network requests made",
|
||||
Buckets: []float64{1, 2, 5, 10, 20, 50, 100},
|
||||
}),
|
||||
[]string{"platform", "agent", "network_request_group"},
|
||||
)
|
||||
|
||||
m.MobileClientNetworkRequestsTotalSize = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_network_requests_total_size",
|
||||
Help: "Total uncompressed size of network requests in bytes",
|
||||
Buckets: []float64{1000, 10000, 50000, 100000, 500000, 1000000, 5000000},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_network_requests_total_size",
|
||||
Help: "Total uncompressed size of network requests in bytes",
|
||||
Buckets: []float64{1000, 10000, 50000, 100000, 500000, 1000000, 5000000},
|
||||
}),
|
||||
[]string{"platform", "agent", "network_request_group"},
|
||||
)
|
||||
|
||||
@@ -1510,27 +1476,25 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
|
||||
m.Registry.MustRegister(m.MobileClientNetworkRequestsTotalSize)
|
||||
|
||||
m.MobileClientChannelSwitchDuration = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_channel_switch",
|
||||
Help: "Duration of the time taken from when a user clicks on a channel name, and the full channel sreen is loaded (seconds)",
|
||||
Buckets: []float64{0.150, 0.200, 0.300, 0.400, 0.450, 0.500, 0.550, 0.600, 0.750, 1, 2, 3},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_channel_switch",
|
||||
Help: "Duration of the time taken from when a user clicks on a channel name, and the full channel sreen is loaded (seconds)",
|
||||
Buckets: []float64{0.150, 0.200, 0.300, 0.400, 0.450, 0.500, 0.550, 0.600, 0.750, 1, 2, 3},
|
||||
}),
|
||||
[]string{"platform"},
|
||||
)
|
||||
m.Registry.MustRegister(m.MobileClientChannelSwitchDuration)
|
||||
|
||||
m.MobileClientTeamSwitchDuration = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_team_switch",
|
||||
Help: "Duration of the time taken from when a user clicks on a team, and the full categories screen is loaded (seconds)",
|
||||
Buckets: []float64{0.150, 0.200, 0.250, 0.300, 0.350, 0.400, 0.500, 0.750, 1, 2, 3},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsMobileApp,
|
||||
Name: "mobile_team_switch",
|
||||
Help: "Duration of the time taken from when a user clicks on a team, and the full categories screen is loaded (seconds)",
|
||||
Buckets: []float64{0.150, 0.200, 0.250, 0.300, 0.350, 0.400, 0.500, 0.750, 1, 2, 3},
|
||||
}),
|
||||
[]string{"platform"},
|
||||
)
|
||||
m.Registry.MustRegister(m.MobileClientTeamSwitchDuration)
|
||||
@@ -1548,27 +1512,25 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
|
||||
m.Registry.MustRegister(m.MobileClientSessionMetadataGauge)
|
||||
|
||||
m.DesktopClientCPUUsage = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsDesktopApp,
|
||||
Name: "cpu_usage",
|
||||
Help: "Average CPU usage of a specific process over an interval",
|
||||
Buckets: []float64{0, 1, 2, 3, 5, 8, 13, 21, 34, 55, 80, 100},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsDesktopApp,
|
||||
Name: "cpu_usage",
|
||||
Help: "Average CPU usage of a specific process over an interval",
|
||||
Buckets: []float64{0, 1, 2, 3, 5, 8, 13, 21, 34, 55, 80, 100},
|
||||
}),
|
||||
[]string{"platform", "version", "processName"},
|
||||
)
|
||||
m.Registry.MustRegister(m.DesktopClientCPUUsage)
|
||||
|
||||
m.DesktopClientMemoryUsage = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsDesktopApp,
|
||||
Name: "memory_usage",
|
||||
Help: "Memory usage in MB of a specific process",
|
||||
Buckets: []float64{0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 3000, 5000},
|
||||
ConstLabels: additionalLabels,
|
||||
},
|
||||
withLabels(prometheus.HistogramOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemClientsDesktopApp,
|
||||
Name: "memory_usage",
|
||||
Help: "Memory usage in MB of a specific process",
|
||||
Buckets: []float64{0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 3000, 5000},
|
||||
}),
|
||||
[]string{"platform", "version", "processName"},
|
||||
)
|
||||
m.Registry.MustRegister(m.DesktopClientMemoryUsage)
|
||||
|
||||
Ссылка в новой задаче
Block a user