metrics

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ConditionDeleted is a value for the "achilles_resource_readiness" metric's "type" label, indicating that the object
	// is in terminating state.
	ConditionDeleted = "Deleted"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

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

func MustMakeMetrics

func MustMakeMetrics(scheme *runtime.Scheme, registrar prometheus.Registerer) *Metrics

MustMakeMetrics creates a new Metrics with a new metrics Sink, and the Metrics.Scheme set to that of the given manager.

func (*Metrics) DeleteCondition

func (m *Metrics) DeleteCondition(obj conditionedObject, conditionType api.ConditionType)

DeleteCondition deletes the status of the given conditionType for the given obj.

func (*Metrics) DeleteReadiness

func (m *Metrics) DeleteReadiness(obj conditionedObject)

DeleteReadiness deletes the meta.ReadyCondition status metric for the given obj.

func (*Metrics) DeleteTrigger

func (m *Metrics) DeleteTrigger(
	requestObjKey client.ObjectKey,
	controllerName string,
)

DeleteTrigger deletes an event trigger for the given triggered object and controller name.

func (*Metrics) RecordCondition

func (m *Metrics) RecordCondition(obj conditionedObject, conditionType api.ConditionType)

RecordCondition records the status of the given conditionType for the given obj.

func (*Metrics) RecordReadiness

func (m *Metrics) RecordReadiness(obj conditionedObject)

RecordReadiness records the meta.ReadyCondition status for the given obj.

func (*Metrics) RecordStateDuration

func (m *Metrics) RecordStateDuration(gvk schema.GroupVersionKind, state string, duration time.Duration)

RecordStateDuration records the duration of the state for the given GVK.

func (*Metrics) RecordSuspend

func (m *Metrics) RecordSuspend(obj client.Object, suspend bool)

RecordSuspend records status of the object to be 1 if suspended and 0 if unsuspended

func (*Metrics) RecordTrigger

func (m *Metrics) RecordTrigger(
	triggerGVK schema.GroupVersionKind,
	requestObjKey client.ObjectKey,
	event string,
	triggerType string,
	controllerName string,
)

RecordTrigger records an event trigger for the given triggering object and triggered object.

func (*Metrics) Reset

func (m *Metrics) Reset()

Reset resets all metrics.

type Sink

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

Sink is a prometheus metrics sink for standard achilles metrics.

func NewSink

func NewSink() *Sink

NewSink returns a new achilles metrics Sink.

func (*Sink) Collectors

func (r *Sink) Collectors() []prometheus.Collector

Collectors returns a slice of Prometheus collectors, which can be used to register them in a metrics registry.

func (*Sink) DeleteCondition

func (r *Sink) DeleteCondition(
	ref client.ObjectKey,
	gvk schema.GroupVersionKind,
	condition api.Condition,
) int

DeleteCondition deletes the status condition for the types True, False, and Deleted, for the specified object and condition. Returns the number of metrics deleted.

func (*Sink) DeleteTrigger

func (r *Sink) DeleteTrigger(
	requestObjKey client.ObjectKey,
	controllerName string,
) int

DeleteTrigger deletes the trigger metric for the specified requested object and controller name, and ALL triggering GVKs, event types, and trigger types.

func (*Sink) RecordCondition

func (r *Sink) RecordCondition(
	ref client.ObjectKey,
	gvk schema.GroupVersionKind,
	condition api.Condition,
	deleted bool,
)

RecordCondition records the status condition for the types True, False, and Deleted, for the specified object and condition.

func (*Sink) RecordStateDuration

func (r *Sink) RecordStateDuration(
	gvk schema.GroupVersionKind,
	state string,
	duration time.Duration,
)

RecordStateDuration records the duration taken to execute a state in the FSM reconciler.

func (*Sink) RecordSuspend

func (r *Sink) RecordSuspend(
	ref client.ObjectKey,
	gvk schema.GroupVersionKind,
	suspended bool,
)

RecordSuspend records whether the object is suspended or not

func (*Sink) RecordTrigger

func (r *Sink) RecordTrigger(
	triggerGVK schema.GroupVersionKind,
	requestObjKey client.ObjectKey,
	event string,
	triggerType string,
	controllerName string,
)

RecordTrigger increments the counter for the given controller, qualified by the triggering object GVK and object ref and reconciled object ref.

func (*Sink) Reset

func (r *Sink) Reset()

Reset resets all metrics.

Jump to

Keyboard shortcuts

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