mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* docker: prometheus and grafana for development Add prometheus and grafana docker configuration when developing with access to the enterprise repository. This simplifies the setup for developers adding new metrics or even examining events from their development server. The services are disabled by default when no enterprise source is detected. Grafana is provisioned automatically with the Prometheus datasource, as well as the canonical dashboards used with Mattermost. Furthermore, no authentication is required to access Grafana to simplify access from a development environment. The default home dashboard is customized to automatically show links to the provisioned dashboards. Dashboards can be saved, and login remains available via the default `admin/admin` credentials (which initiates a password reset), but no dashboard or system configuration is (currently) persisted if the container is destroyed. Linux requires slightly special handling (well, really it's Docker for MacOS/Windows), in that `host.docker.internal` is the canonical way to resolve the host on MacOS/Windows, but on Linux it's usually sufficient to just use `localhost`. Until https://github.com/docker/for-linux/issues/264 is resolved, this PR includes code to customize the Prometheus configuration to point at the required address for the running platform. * metrics: track active jobs by type * metrics: active jobs chart * metrics: server start and job annotations * Update build/docker-compose.common.yml Co-authored-by: Claudio Costa <cstcld91@gmail.com> * prometheus: resolve docker host via 172.17.0.1 instead * skip enabling prometheus and grafana by default * handle JOB_STATUS_ERROR and JOB_STATUS_CANCELED end states * handle nil srv.metrics * lookup job to determine type for metrics * mocked unit tests for jobs * goimports lint fixes * missing license * add instance to server start tag * filter annotations by selected instance Co-authored-by: Claudio Costa <cstcld91@gmail.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
73 lines
2.3 KiB
Go
73 lines
2.3 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package einterfaces
|
|
|
|
import (
|
|
"github.com/mattermost/logr"
|
|
)
|
|
|
|
type MetricsInterface interface {
|
|
StartServer()
|
|
StopServer()
|
|
|
|
IncrementPostCreate()
|
|
IncrementWebhookPost()
|
|
IncrementPostSentEmail()
|
|
IncrementPostSentPush()
|
|
IncrementPostBroadcast()
|
|
IncrementPostFileAttachment(count int)
|
|
|
|
IncrementHttpRequest()
|
|
IncrementHttpError()
|
|
|
|
IncrementClusterRequest()
|
|
ObserveClusterRequestDuration(elapsed float64)
|
|
IncrementClusterEventType(eventType string)
|
|
|
|
IncrementLogin()
|
|
IncrementLoginFail()
|
|
|
|
IncrementEtagHitCounter(route string)
|
|
IncrementEtagMissCounter(route string)
|
|
|
|
IncrementMemCacheHitCounter(cacheName string)
|
|
IncrementMemCacheMissCounter(cacheName string)
|
|
IncrementMemCacheInvalidationCounter(cacheName string)
|
|
IncrementMemCacheMissCounterSession()
|
|
IncrementMemCacheHitCounterSession()
|
|
IncrementMemCacheInvalidationCounterSession()
|
|
|
|
IncrementWebsocketEvent(eventType string)
|
|
IncrementWebSocketBroadcast(eventType string)
|
|
IncrementWebSocketBroadcastBufferSize(hub string, amount float64)
|
|
DecrementWebSocketBroadcastBufferSize(hub string, amount float64)
|
|
IncrementWebSocketBroadcastUsersRegistered(hub string, amount float64)
|
|
DecrementWebSocketBroadcastUsersRegistered(hub string, amount float64)
|
|
|
|
AddMemCacheHitCounter(cacheName string, amount float64)
|
|
AddMemCacheMissCounter(cacheName string, amount float64)
|
|
|
|
IncrementPostsSearchCounter()
|
|
ObservePostsSearchDuration(elapsed float64)
|
|
IncrementFilesSearchCounter()
|
|
ObserveFilesSearchDuration(elapsed float64)
|
|
ObserveStoreMethodDuration(method, success string, elapsed float64)
|
|
ObserveApiEndpointDuration(endpoint, method, statusCode string, elapsed float64)
|
|
IncrementPostIndexCounter()
|
|
IncrementFileIndexCounter()
|
|
IncrementUserIndexCounter()
|
|
IncrementChannelIndexCounter()
|
|
|
|
ObservePluginHookDuration(pluginID, hookName string, success bool, elapsed float64)
|
|
ObservePluginMultiHookIterationDuration(pluginID string, elapsed float64)
|
|
ObservePluginMultiHookDuration(elapsed float64)
|
|
ObservePluginApiDuration(pluginID, apiName string, success bool, elapsed float64)
|
|
|
|
ObserveEnabledUsers(users int64)
|
|
GetLoggerMetricsCollector() logr.MetricsCollector
|
|
|
|
IncrementJobActive(jobType string)
|
|
DecrementJobActive(jobType string)
|
|
}
|