Documentation ¶
Overview ¶
Package metrics is a generated GoMock package.
Index ¶
- func Handler(log logrus.FieldLogger, m goMiddleware.Middleware, h http.Handler) http.Handler
- func NewRecorder(cfg Config) metrics.Recorder
- func WithMatchedRoute(log logrus.FieldLogger, registry prometheus.Registerer) func(http.Handler) http.Handler
- type API
- type Config
- type MetricsManager
- func (m *MetricsManager) ClusterInstallationFinished(log logrus.FieldLogger, result, clusterVersion string, ...)
- func (m *MetricsManager) ClusterRegistered(clusterVersion string)
- func (m *MetricsManager) InstallationStarted(clusterVersion string)
- func (m *MetricsManager) ReportHostInstallationMetrics(log logrus.FieldLogger, clusterVersion string, h *models.Host, ...)
- type MockAPI
- func (m *MockAPI) ClusterInstallationFinished(log logrus.FieldLogger, result, clusterVersion string, ...)
- func (m *MockAPI) ClusterRegistered(clusterVersion string)
- func (m *MockAPI) EXPECT() *MockAPIMockRecorder
- func (m *MockAPI) InstallationStarted(clusterVersion string)
- func (m *MockAPI) ReportHostInstallationMetrics(log logrus.FieldLogger, clusterVersion string, h *models.Host, ...)
- type MockAPIMockRecorder
- func (mr *MockAPIMockRecorder) ClusterInstallationFinished(log, result, clusterVersion, installationStratedTime interface{}) *gomock.Call
- func (mr *MockAPIMockRecorder) ClusterRegistered(clusterVersion interface{}) *gomock.Call
- func (mr *MockAPIMockRecorder) InstallationStarted(clusterVersion interface{}) *gomock.Call
- func (mr *MockAPIMockRecorder) ReportHostInstallationMetrics(log, clusterVersion, h, previousProgress, currentStage interface{}) *gomock.Call
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
func Handler(log logrus.FieldLogger, m goMiddleware.Middleware, h http.Handler) http.Handler
Handler returns an measuring standard http.Handler. it should be added as an innerMiddleware because it relies on the MatchedRoute to provide more information about the route
func NewRecorder ¶
NewRecorder returns a new metrics recorder that implements the recorder using Prometheus as the backend.
func WithMatchedRoute ¶
func WithMatchedRoute(log logrus.FieldLogger, registry prometheus.Registerer) func(http.Handler) http.Handler
To be used as an inner middleware to provide metrics for the endpoints
Types ¶
type API ¶
type API interface { ClusterRegistered(clusterVersion string) InstallationStarted(clusterVersion string) ClusterInstallationFinished(log logrus.FieldLogger, result, clusterVersion string, installationStratedTime strfmt.DateTime) ReportHostInstallationMetrics(log logrus.FieldLogger, clusterVersion string, h *models.Host, previousProgress *models.HostProgressInfo, currentStage models.HostStage) }
type Config ¶
type Config struct { Log logrus.FieldLogger Service string // Prefix is the prefix that will be set on the metrics, by default it will be empty. Prefix string // DurationBuckets are the buckets used by Prometheus for the HTTP request duration metrics, // by default uses Prometheus default buckets (from 5ms to 10s). DurationBuckets []float64 // SizeBuckets are the buckets used by Prometheus for the HTTP response size metrics, // by default uses a exponential buckets from 100B to 1GB. SizeBuckets []float64 // Registry is the registry that will be used by the recorder to store the metrics, // if the default registry is not used then it will use the default one. Registry prometheus.Registerer // HandlerIDLabel is the name that will be set to the handler ID label, by default is `handler`. HandlerIDLabel string // StatusCodeLabel is the name that will be set to the status code label, by default is `code`. StatusCodeLabel string // MethodLabel is the name that will be set to the method label, by default is `method`. MethodLabel string // ServiceLabel is the name that will be set to the service label, by default is `service`. ServiceLabel string // IDLabel is the name that will be set to the ID label. ny default is 'id'. IDLabel string }
Config has the dependencies and values of the recorder.
type MetricsManager ¶
type MetricsManager struct {
// contains filtered or unexported fields
}
func NewMetricsManager ¶
func NewMetricsManager(registry prometheus.Registerer) *MetricsManager
func (*MetricsManager) ClusterInstallationFinished ¶
func (m *MetricsManager) ClusterInstallationFinished(log logrus.FieldLogger, result, clusterVersion string, installationStratedTime strfmt.DateTime)
func (*MetricsManager) ClusterRegistered ¶
func (m *MetricsManager) ClusterRegistered(clusterVersion string)
func (*MetricsManager) InstallationStarted ¶
func (m *MetricsManager) InstallationStarted(clusterVersion string)
func (*MetricsManager) ReportHostInstallationMetrics ¶
func (m *MetricsManager) ReportHostInstallationMetrics(log logrus.FieldLogger, clusterVersion string, h *models.Host, previousProgress *models.HostProgressInfo, currentStage models.HostStage)
type MockAPI ¶
type MockAPI struct {
// contains filtered or unexported fields
}
MockAPI is a mock of API interface
func NewMockAPI ¶
func NewMockAPI(ctrl *gomock.Controller) *MockAPI
NewMockAPI creates a new mock instance
func (*MockAPI) ClusterInstallationFinished ¶
func (m *MockAPI) ClusterInstallationFinished(log logrus.FieldLogger, result, clusterVersion string, installationStratedTime strfmt.DateTime)
ClusterInstallationFinished mocks base method
func (*MockAPI) ClusterRegistered ¶
ClusterRegistered mocks base method
func (*MockAPI) EXPECT ¶
func (m *MockAPI) EXPECT() *MockAPIMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockAPI) InstallationStarted ¶
InstallationStarted mocks base method
func (*MockAPI) ReportHostInstallationMetrics ¶
func (m *MockAPI) ReportHostInstallationMetrics(log logrus.FieldLogger, clusterVersion string, h *models.Host, previousProgress *models.HostProgressInfo, currentStage models.HostStage)
ReportHostInstallationMetrics mocks base method
type MockAPIMockRecorder ¶
type MockAPIMockRecorder struct {
// contains filtered or unexported fields
}
MockAPIMockRecorder is the mock recorder for MockAPI
func (*MockAPIMockRecorder) ClusterInstallationFinished ¶
func (mr *MockAPIMockRecorder) ClusterInstallationFinished(log, result, clusterVersion, installationStratedTime interface{}) *gomock.Call
ClusterInstallationFinished indicates an expected call of ClusterInstallationFinished
func (*MockAPIMockRecorder) ClusterRegistered ¶
func (mr *MockAPIMockRecorder) ClusterRegistered(clusterVersion interface{}) *gomock.Call
ClusterRegistered indicates an expected call of ClusterRegistered
func (*MockAPIMockRecorder) InstallationStarted ¶
func (mr *MockAPIMockRecorder) InstallationStarted(clusterVersion interface{}) *gomock.Call
InstallationStarted indicates an expected call of InstallationStarted
func (*MockAPIMockRecorder) ReportHostInstallationMetrics ¶
func (mr *MockAPIMockRecorder) ReportHostInstallationMetrics(log, clusterVersion, h, previousProgress, currentStage interface{}) *gomock.Call
ReportHostInstallationMetrics indicates an expected call of ReportHostInstallationMetrics