metric

package
v6.7.3-0...-1f455d7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFailedToEmit = errors.New("failed to emit metric")
View Source
var Metrics = NewMonitor()

Functions

func CountQueries

func CountQueries(conn db.Conn) db.Conn

func LogLockAcquired

func LogLockAcquired(logger lager.Logger, lockID lock.LockID)

func LogLockReleased

func LogLockReleased(logger lager.Logger, lockID lock.LockID)

func PeriodicallyEmit

func PeriodicallyEmit(logger lager.Logger, m *Monitor, interval time.Duration) ifrit.Runner

func WrapHandler

func WrapHandler(
	logger lager.Logger,
	monitor *Monitor,
	route string,
	handler http.Handler,
) http.Handler

Types

type ArtifactCollectorDuration

type ArtifactCollectorDuration struct {
	Duration time.Duration
}

func (ArtifactCollectorDuration) Emit

func (event ArtifactCollectorDuration) Emit(logger lager.Logger)

type BuildCollectorDuration

type BuildCollectorDuration struct {
	Duration time.Duration
}

func (BuildCollectorDuration) Emit

func (event BuildCollectorDuration) Emit(logger lager.Logger)

type BuildFinished

type BuildFinished struct {
	Build db.Build
}

func (BuildFinished) Emit

func (event BuildFinished) Emit(logger lager.Logger)

type BuildStarted

type BuildStarted struct {
	Build db.Build
}

func (BuildStarted) Emit

func (event BuildStarted) Emit(logger lager.Logger)

type ContainerCollectorDuration

type ContainerCollectorDuration struct {
	Duration time.Duration
}

func (ContainerCollectorDuration) Emit

func (event ContainerCollectorDuration) Emit(logger lager.Logger)

type Counter

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

func (*Counter) Delta

func (m *Counter) Delta() float64

func (*Counter) Inc

func (m *Counter) Inc()

func (*Counter) IncDelta

func (m *Counter) IncDelta(delta int)

type CreatedContainersToBeGarbageCollected

type CreatedContainersToBeGarbageCollected struct {
	Containers int
}

func (CreatedContainersToBeGarbageCollected) Emit

type CreatedVolumesToBeGarbageCollected

type CreatedVolumesToBeGarbageCollected struct {
	Volumes int
}

func (CreatedVolumesToBeGarbageCollected) Emit

func (event CreatedVolumesToBeGarbageCollected) Emit(logger lager.Logger)

type CreatingContainersToBeGarbageCollected

type CreatingContainersToBeGarbageCollected struct {
	Containers int
}

func (CreatingContainersToBeGarbageCollected) Emit

type DestroyingContainersToBeGarbageCollected

type DestroyingContainersToBeGarbageCollected struct {
	Containers int
}

func (DestroyingContainersToBeGarbageCollected) Emit

type DestroyingVolumesToBeGarbageCollected

type DestroyingVolumesToBeGarbageCollected struct {
	Volumes int
}

func (DestroyingVolumesToBeGarbageCollected) Emit

type Emitter

type Emitter interface {
	Emit(lager.Logger, Event)
}

type EmitterFactory

type EmitterFactory interface {
	Description() string
	IsConfigured() bool
	NewEmitter() (Emitter, error)
}

type ErrorLog

type ErrorLog struct {
	Message string
	Value   int
}

func (ErrorLog) Emit

func (e ErrorLog) Emit(logger lager.Logger, m *Monitor)

type ErrorSinkCollector

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

func NewErrorSinkCollector

func NewErrorSinkCollector(logger lager.Logger, m *Monitor) ErrorSinkCollector

func (*ErrorSinkCollector) Log

type Event

type Event struct {
	Name       string
	Value      float64
	Attributes map[string]string
	Host       string
	Time       time.Time
}

type FailedContainersToBeGarbageCollected

type FailedContainersToBeGarbageCollected struct {
	Containers int
}

func (FailedContainersToBeGarbageCollected) Emit

type FailedVolumesToBeGarbageCollected

type FailedVolumesToBeGarbageCollected struct {
	Volumes int
}

func (FailedVolumesToBeGarbageCollected) Emit

func (event FailedVolumesToBeGarbageCollected) Emit(logger lager.Logger)

type GarbageCollectionContainerCollectorJobDropped

type GarbageCollectionContainerCollectorJobDropped struct {
	WorkerName string
}

func (GarbageCollectionContainerCollectorJobDropped) Emit

type Gauge

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

func (*Gauge) Dec

func (c *Gauge) Dec()

func (*Gauge) Inc

func (c *Gauge) Inc()

func (*Gauge) Max

func (c *Gauge) Max() float64

func (*Gauge) Set

func (c *Gauge) Set(val int64)

type HTTPResponseTime

type HTTPResponseTime struct {
	Route      string
	Path       string
	Method     string
	StatusCode int
	Duration   time.Duration
}

func (HTTPResponseTime) Emit

func (event HTTPResponseTime) Emit(logger lager.Logger, m *Monitor)

type LockAcquired

type LockAcquired struct {
	LockType string
}

func (LockAcquired) Emit

func (event LockAcquired) Emit(logger lager.Logger)

type LockReleased

type LockReleased struct {
	LockType string
}

func (LockReleased) Emit

func (event LockReleased) Emit(logger lager.Logger)

type MetricsHandler

type MetricsHandler struct {
	Logger  lager.Logger
	Route   string
	Handler http.Handler
	Monitor *Monitor
}

func (MetricsHandler) ServeHTTP

func (handler MetricsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Monitor

type Monitor struct {
	Databases       []db.Conn
	DatabaseQueries Counter

	ContainersCreated Counter
	VolumesCreated    Counter

	FailedContainers Counter
	FailedVolumes    Counter

	ContainersDeleted Counter
	VolumesDeleted    Counter
	ChecksDeleted     Counter

	JobsScheduled  Counter
	JobsScheduling Gauge

	BuildsStarted Counter
	BuildsRunning Gauge

	TasksWaiting map[TasksWaitingLabels]*Gauge

	ChecksFinishedWithError   Counter
	ChecksFinishedWithSuccess Counter
	ChecksStarted             Counter
	ChecksEnqueued            Counter

	ConcurrentRequests         map[string]*Gauge
	ConcurrentRequestsLimitHit map[string]*Counter

	VolumesStreamed Counter
	// contains filtered or unexported fields
}

func NewMonitor

func NewMonitor() *Monitor

func (*Monitor) Initialize

func (m *Monitor) Initialize(logger lager.Logger, host string, attributes map[string]string, bufferSize uint32) error

func (*Monitor) RegisterEmitter

func (m *Monitor) RegisterEmitter(factory EmitterFactory)

func (*Monitor) WireEmitters

func (m *Monitor) WireEmitters(group *flags.Group)

type ResourceCacheCollectorDuration

type ResourceCacheCollectorDuration struct {
	Duration time.Duration
}

func (ResourceCacheCollectorDuration) Emit

func (event ResourceCacheCollectorDuration) Emit(logger lager.Logger)

type ResourceCacheUseCollectorDuration

type ResourceCacheUseCollectorDuration struct {
	Duration time.Duration
}

func (ResourceCacheUseCollectorDuration) Emit

func (event ResourceCacheUseCollectorDuration) Emit(logger lager.Logger)

type ResourceConfigCheckSessionCollectorDuration

type ResourceConfigCheckSessionCollectorDuration struct {
	Duration time.Duration
}

func (ResourceConfigCheckSessionCollectorDuration) Emit

type ResourceConfigCollectorDuration

type ResourceConfigCollectorDuration struct {
	Duration time.Duration
}

func (ResourceConfigCollectorDuration) Emit

func (event ResourceConfigCollectorDuration) Emit(logger lager.Logger)

type SchedulingJobDuration

type SchedulingJobDuration struct {
	PipelineName string
	JobName      string
	JobID        int
	Duration     time.Duration
}

func (SchedulingJobDuration) Emit

func (event SchedulingJobDuration) Emit(logger lager.Logger)

type TasksWaitingDuration

type TasksWaitingDuration struct {
	Labels   TasksWaitingLabels
	Duration time.Duration
}

func (TasksWaitingDuration) Emit

func (event TasksWaitingDuration) Emit(logger lager.Logger)

type TasksWaitingLabels

type TasksWaitingLabels struct {
	TeamId     string
	WorkerTags string
	Platform   string
}

type VolumeCollectorDuration

type VolumeCollectorDuration struct {
	Duration time.Duration
}

func (VolumeCollectorDuration) Emit

func (event VolumeCollectorDuration) Emit(logger lager.Logger)

type VolumesToBeGarbageCollected

type VolumesToBeGarbageCollected struct {
	Volumes int
}

func (VolumesToBeGarbageCollected) Emit

func (event VolumesToBeGarbageCollected) Emit(logger lager.Logger)

type WorkerCollectorDuration

type WorkerCollectorDuration struct {
	Duration time.Duration
}

func (WorkerCollectorDuration) Emit

func (event WorkerCollectorDuration) Emit(logger lager.Logger)

type WorkerContainers

type WorkerContainers struct {
	WorkerName string
	Platform   string
	Containers int
	TeamName   string
	Tags       []string
}

func (WorkerContainers) Emit

func (event WorkerContainers) Emit(logger lager.Logger)

type WorkerTasks

type WorkerTasks struct {
	WorkerName string
	Platform   string
	Tasks      int
}

func (WorkerTasks) Emit

func (event WorkerTasks) Emit(logger lager.Logger)

type WorkerUnknownContainers

type WorkerUnknownContainers struct {
	WorkerName string
	Containers int
}

func (WorkerUnknownContainers) Emit

func (event WorkerUnknownContainers) Emit(logger lager.Logger)

type WorkerUnknownVolumes

type WorkerUnknownVolumes struct {
	WorkerName string
	Volumes    int
}

func (WorkerUnknownVolumes) Emit

func (event WorkerUnknownVolumes) Emit(logger lager.Logger)

type WorkerVolumes

type WorkerVolumes struct {
	WorkerName string
	Platform   string
	Volumes    int
	TeamName   string
	Tags       []string
}

func (WorkerVolumes) Emit

func (event WorkerVolumes) Emit(logger lager.Logger)

type WorkersState

type WorkersState struct {
	WorkerStateByName map[string]db.WorkerState
}

func (WorkersState) Emit

func (event WorkersState) Emit(logger lager.Logger, m *Monitor)

Directories

Path Synopsis
emitterfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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