metrics

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package metrics is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func 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

func NewRecorder(cfg Config) metrics.Recorder

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 added in v1.0.7

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 added in v1.0.7

type MetricsManager struct {
	// contains filtered or unexported fields
}

func NewMetricsManager added in v1.0.7

func NewMetricsManager(registry prometheus.Registerer) *MetricsManager

func (*MetricsManager) ClusterInstallationFinished added in v1.0.7

func (m *MetricsManager) ClusterInstallationFinished(log logrus.FieldLogger, result, clusterVersion string, installationStratedTime strfmt.DateTime)

func (*MetricsManager) ClusterRegistered added in v1.0.7

func (m *MetricsManager) ClusterRegistered(clusterVersion string)

func (*MetricsManager) InstallationStarted added in v1.0.7

func (m *MetricsManager) InstallationStarted(clusterVersion string)

func (*MetricsManager) ReportHostInstallationMetrics added in v1.0.7

func (m *MetricsManager) ReportHostInstallationMetrics(log logrus.FieldLogger, clusterVersion string, h *models.Host,
	previousProgress *models.HostProgressInfo, currentStage models.HostStage)

type MockAPI added in v1.0.7

type MockAPI struct {
	// contains filtered or unexported fields
}

MockAPI is a mock of API interface

func NewMockAPI added in v1.0.7

func NewMockAPI(ctrl *gomock.Controller) *MockAPI

NewMockAPI creates a new mock instance

func (*MockAPI) ClusterInstallationFinished added in v1.0.7

func (m *MockAPI) ClusterInstallationFinished(log logrus.FieldLogger, result, clusterVersion string, installationStratedTime strfmt.DateTime)

ClusterInstallationFinished mocks base method

func (*MockAPI) ClusterRegistered added in v1.0.7

func (m *MockAPI) ClusterRegistered(clusterVersion string)

ClusterRegistered mocks base method

func (*MockAPI) EXPECT added in v1.0.7

func (m *MockAPI) EXPECT() *MockAPIMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockAPI) InstallationStarted added in v1.0.7

func (m *MockAPI) InstallationStarted(clusterVersion string)

InstallationStarted mocks base method

func (*MockAPI) ReportHostInstallationMetrics added in v1.0.7

func (m *MockAPI) ReportHostInstallationMetrics(log logrus.FieldLogger, clusterVersion string, h *models.Host, previousProgress *models.HostProgressInfo, currentStage models.HostStage)

ReportHostInstallationMetrics mocks base method

type MockAPIMockRecorder added in v1.0.7

type MockAPIMockRecorder struct {
	// contains filtered or unexported fields
}

MockAPIMockRecorder is the mock recorder for MockAPI

func (*MockAPIMockRecorder) ClusterInstallationFinished added in v1.0.7

func (mr *MockAPIMockRecorder) ClusterInstallationFinished(log, result, clusterVersion, installationStratedTime interface{}) *gomock.Call

ClusterInstallationFinished indicates an expected call of ClusterInstallationFinished

func (*MockAPIMockRecorder) ClusterRegistered added in v1.0.7

func (mr *MockAPIMockRecorder) ClusterRegistered(clusterVersion interface{}) *gomock.Call

ClusterRegistered indicates an expected call of ClusterRegistered

func (*MockAPIMockRecorder) InstallationStarted added in v1.0.7

func (mr *MockAPIMockRecorder) InstallationStarted(clusterVersion interface{}) *gomock.Call

InstallationStarted indicates an expected call of InstallationStarted

func (*MockAPIMockRecorder) ReportHostInstallationMetrics added in v1.0.7

func (mr *MockAPIMockRecorder) ReportHostInstallationMetrics(log, clusterVersion, h, previousProgress, currentStage interface{}) *gomock.Call

ReportHostInstallationMetrics indicates an expected call of ReportHostInstallationMetrics

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL