MM-56876: Redis: first introduction (#27752)
```release-note NONE ``` --------- Co-authored-by: Jesús Espino <jespinog@gmail.com> Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c3ed07e679
Коммит
540febd866
@@ -156,6 +156,7 @@ type MetricsInterfaceImpl struct {
|
||||
SearchFileSearchesDuration prometheus.Histogram
|
||||
StoreTimesHistograms *prometheus.HistogramVec
|
||||
APITimesHistograms *prometheus.HistogramVec
|
||||
RedisTimesHistograms *prometheus.HistogramVec
|
||||
SearchPostIndexCounter prometheus.Counter
|
||||
SearchFileIndexCounter prometheus.Counter
|
||||
SearchUserIndexCounter prometheus.Counter
|
||||
@@ -764,6 +765,18 @@ func New(ps *platform.PlatformService, driver, dataSource string) *MetricsInterf
|
||||
)
|
||||
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,
|
||||
},
|
||||
[]string{"cache_name", "operation"},
|
||||
)
|
||||
m.Registry.MustRegister(m.RedisTimesHistograms)
|
||||
|
||||
m.SearchPostIndexCounter = prometheus.NewCounter(prometheus.CounterOpts{
|
||||
Namespace: MetricsNamespace,
|
||||
Subsystem: MetricsSubsystemSearch,
|
||||
@@ -1499,6 +1512,13 @@ func (mi *MetricsInterfaceImpl) ObserveAPIEndpointDuration(handler, method, stat
|
||||
mi.APITimesHistograms.With(prometheus.Labels{"handler": handler, "method": method, "status_code": statusCode, "origin_client": originClient, "page_load_context": pageLoadContext}).Observe(elapsed)
|
||||
}
|
||||
|
||||
func (mi *MetricsInterfaceImpl) ObserveRedisEndpointDuration(cacheName, operation string, elapsed float64) {
|
||||
mi.RedisTimesHistograms.With(prometheus.Labels{
|
||||
"cache_name": cacheName,
|
||||
"operation": operation,
|
||||
}).Observe(elapsed)
|
||||
}
|
||||
|
||||
func (mi *MetricsInterfaceImpl) IncrementClusterEventType(eventType model.ClusterEvent) {
|
||||
if event, ok := mi.ClusterEventMap[eventType]; ok {
|
||||
event.Inc()
|
||||
|
||||
Ссылка в новой задаче
Block a user