monitors

package
v0.0.0-...-6eb52ac Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PodE2EStartupLatencyKey is a key for pod startup latency monitoring metric.
	PodE2EStartupLatencyKey = "slomonitor_pod_e2e_startup_latency_seconds"
	// PodFullStartupLatencyKey is a key for pod startup latency monitoring metric including pull times.
	PodFullStartupLatencyKey = "slomonitor_pod_full_startup_latency_seconds"
)

Variables

View Source
var (
	// StartupLatencyBuckets represents the histogram bucket boundaries for pod
	// startup latency metrics, measured in seconds. These are hand-picked so
	// as to be roughly exponential but still round numbers in everyday units.
	// This is to minimise the number of buckets while allowing accurate
	// measurement of thresholds which might be used in SLOs e.g. x% of pods
	// start up within 30 seconds, or 15 minutes, etc.
	StartupLatencyBuckets = []float64{0.5, 1, 2, 3, 4, 5, 6, 8, 10, 20, 30, 45, 60, 120, 180, 240, 300, 360, 480, 600, 900, 1200, 1800, 2700, 3600}

	// PodE2EStartupLatency is a prometheus metric for monitoring pod startup latency.
	PodE2EStartupLatency = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:    PodE2EStartupLatencyKey,
			Help:    "Pod e2e startup latencies in seconds, without image pull times",
			Buckets: StartupLatencyBuckets,
		},
	)

	// PodFullStartupLatency is a prometheus metric for monitoring pod startup latency including image pull times.
	PodFullStartupLatency = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:    PodFullStartupLatencyKey,
			Help:    "Pod e2e startup latencies in seconds, with image pull times",
			Buckets: StartupLatencyBuckets,
		},
	)
)

Functions

func NewWatcherWithHandler

func NewWatcherWithHandler(lw cache.ListerWatcher, objType runtime.Object, setHandler, deleteHandler func(obj interface{}) error) cache.Controller

NewWatcherWithHandler creates a simple watcher that will call `h` for all coming objects

func PodRunningReadyOrSucceeded

func PodRunningReadyOrSucceeded(p *v1.Pod) (bool, error)

PodRunningReadyOrSucceeded checks whether pod p's phase is running and it has a ready condition of status true or wheather the Pod already succeeded.

func Register

func Register()

Register registers all prometheus metrics.

Types

type NoStoreQueue

type NoStoreQueue struct {
	sync.Mutex
	// contains filtered or unexported fields
}

NoStoreQueue implements k8s.io/client-go/tools/cache Store and Queue interfaces

func NewNoStoreQueue

func NewNoStoreQueue() *NoStoreQueue

NewNoStoreQueue returns newly created NoStoreQueue

func (*NoStoreQueue) Add

func (q *NoStoreQueue) Add(obj interface{}) error

Add implements Add function from Store interface

func (*NoStoreQueue) AddIfNotPresent

func (q *NoStoreQueue) AddIfNotPresent(obj interface{}) error

AddIfNotPresent implements AddIfNotPresent function from Queue interface

func (*NoStoreQueue) Close

func (q *NoStoreQueue) Close()

Close implements Close function from Queue interface

func (*NoStoreQueue) Delete

func (q *NoStoreQueue) Delete(obj interface{}) error

Delete implements Delete function from Store interface

func (*NoStoreQueue) Get

func (q *NoStoreQueue) Get(obj interface{}) (item interface{}, exists bool, err error)

Get implements Get function from Store interface

func (*NoStoreQueue) GetByKey

func (q *NoStoreQueue) GetByKey(key string) (item interface{}, exists bool, err error)

GetByKey implements GetByKey function from Store interface

func (*NoStoreQueue) HasSynced

func (q *NoStoreQueue) HasSynced() bool

HasSynced implements HasSynced function from Queue interface

func (*NoStoreQueue) List

func (q *NoStoreQueue) List() []interface{}

List implements List function from Store interface

func (*NoStoreQueue) ListKeys

func (q *NoStoreQueue) ListKeys() []string

ListKeys implements ListKeys function from Store interface

func (*NoStoreQueue) Pop

func (q *NoStoreQueue) Pop(process cache.PopProcessFunc) (interface{}, error)

Pop implements Pop function from Queue interface

func (*NoStoreQueue) Replace

func (q *NoStoreQueue) Replace(list []interface{}, rv string) error

Replace implements Replace function from Store interface

func (*NoStoreQueue) Resync

func (q *NoStoreQueue) Resync() error

Resync implements Resync function from Store interface

func (*NoStoreQueue) Update

func (q *NoStoreQueue) Update(obj interface{}) error

Update implements Update function from Store interface

type PodStartupLatencyDataMonitor

type PodStartupLatencyDataMonitor struct {
	sync.Mutex

	PodStartupData map[string]PodStartupMilestones
	// contains filtered or unexported fields
}

PodStartupLatencyDataMonitor monitors pod startup latency and exposes prometheus metric.

func NewPodStartupLatencyDataMonitor

func NewPodStartupLatencyDataMonitor(c clientset.Interface, purgeAfter time.Duration) *PodStartupLatencyDataMonitor

NewPodStartupLatencyDataMonitor creates a new PodStartupLatencyDataMonitor from a given client.

func (*PodStartupLatencyDataMonitor) Run

func (pm *PodStartupLatencyDataMonitor) Run(stopCh chan struct{}) error

Run starts a PodStartupLatencyDataMonitor: it creates all watches, populates PodStartupData and updates PodE2EStartupLatency and PodFullStartupLatency metrics

type PodStartupMilestones

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

PodStartupMilestones keeps all milestone timestamps from Pod creation.

func (*PodStartupMilestones) IsComplete

func (data *PodStartupMilestones) IsComplete() bool

IsComplete returns true is data is complete (ready to be included in the metric) and if it haven't been included in the metric yet.

Jump to

Keyboard shortcuts

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