metrics

package
v1.15.3 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RootSyncKind is the kind of the RootSync resource
	RootSyncKind = SyncKind(configsync.RootSyncKind)

	// RepoSyncKind is the kind of the RepoSync resource
	RepoSyncKind = SyncKind(configsync.RepoSyncKind)
)

Variables

This section is empty.

Functions

func IsObjectApplyable added in v1.15.1

func IsObjectApplyable(obj client.Object) bool

IsObjectApplyable returns true if the object will be applied by Config Sync when included in the source.

func IsObjectDeclarable added in v1.15.1

func IsObjectDeclarable(_ client.Object) bool

IsObjectDeclarable returns true if the object should be included in the declared resources passed to the applier.

Types

type ErrorSummary added in v1.15.1

type ErrorSummary struct {
	// Fights is the expected value of the resource_fights_view metric.
	Fights int
	// Conflicts is the expected value of the resource_conflicts_view metric.
	Conflicts int
	// Internal is the expected value of the internal_errors_view metric.
	Internal int
	// Rendering is the expected value of the reconciler_errors_view metric,
	// when component=rendering.
	Rendering int
	// Source is the expected value of the reconciler_errors_view metric, when
	// component=source.
	Source int
	// Sync is the expected value of the reconciler_errors_view metric, when
	// component=sync.
	Sync int
}

ErrorSummary describes the expected state of a set of standard error metrics.

type NamespacedNameSlice added in v1.15.1

type NamespacedNameSlice []types.NamespacedName

NamespacedNameSlice attaches the methods of sort.Interface to []types.NamespacedName, sorting in increasing order, namespace > name.

func (NamespacedNameSlice) Len added in v1.15.1

func (x NamespacedNameSlice) Len() int

Len returns the size of the slice

func (NamespacedNameSlice) Less added in v1.15.1

func (x NamespacedNameSlice) Less(i, j int) bool

Less returns true if the value at index i is less than the value at index j.

func (NamespacedNameSlice) Sort added in v1.15.1

func (x NamespacedNameSlice) Sort()

Sort is a convenience method: x.Sort() calls sort.Sort(x).

func (NamespacedNameSlice) Swap added in v1.15.1

func (x NamespacedNameSlice) Swap(i, j int)

Sort is a convenience method: x.Sort() calls sort.Sort(x).

type ObjectIDSlice added in v1.15.1

type ObjectIDSlice []core.ID

ObjectIDSlice attaches the methods of sort.Interface to []core.ID, sorting in increasing order, group > kind > namespace > name.

func (ObjectIDSlice) Len added in v1.15.1

func (x ObjectIDSlice) Len() int

Len returns the size of the slice

func (ObjectIDSlice) Less added in v1.15.1

func (x ObjectIDSlice) Less(i, j int) bool

Less returns true if the value at index i is less than the value at index j.

func (ObjectIDSlice) Sort added in v1.15.1

func (x ObjectIDSlice) Sort()

Sort is a convenience method: x.Sort() calls sort.Sort(x).

func (ObjectIDSlice) Swap added in v1.15.1

func (x ObjectIDSlice) Swap(i, j int)

Swap the values at index i and j.

type ObjectOperation added in v1.15.1

type ObjectOperation struct {
	// Kind of the object
	Kind string
	// Operation performed on the object
	Operation Operation
	// Count of the times the operation was performed on objects of the
	// specified kind
	Count int
}

ObjectOperation is used for validating count aggregated metrics that have a "type" tag (ex: `api_duration_seconds` & `apply_operations`).

func AppendOperations added in v1.15.1

func AppendOperations(to []ObjectOperation, from ...ObjectOperation) []ObjectOperation

AppendOperations updates a list of ObjectOperations to add the specified operation

type ObjectSetExpectations added in v1.15.1

type ObjectSetExpectations map[core.ID]Operation

ObjectSetExpectations is a map of object IDs to expected operations.

type Operation

type Operation string

Operation is an enum of possible values for the "operation" metric tag.

const (
	// UpdateOperation is the value expected for the "operation" metric tag for
	// objects that have been included in the source and applied/updated/patched.
	UpdateOperation Operation = "update"

	// DeleteOperation is the value expected for the "operation" metric tag for
	// objects that have been removed from source and deleted.
	DeleteOperation Operation = "delete"

	// SkipOperation is used to filter out objects that are declared in source,
	// but not updated/deleted
	SkipOperation Operation = "skip"

	// OtelCollectorMetricsPort is the port where prometheus metrics are exposed
	OtelCollectorMetricsPort = 8675
)

type Summary added in v1.15.1

type Summary struct {
	// Sync is the name and namespace of the RootSync or RepoSync
	Sync types.NamespacedName
	// ObjectCount is the expected value of the declared_resources_view metric
	ObjectCount int
	// Operations is a list of operations expected to be represented by the
	// operations metrics: api_cal_duration_view, apply_operations_view, &
	// remediate_duration_view
	Operations []ObjectOperation
	// Errors describes the expected state of a set of standard error metrics.
	Errors ErrorSummary
	// Absolute indicates that the ObjectCount and Operations should not be
	// added to the values specified in the ExpectedObjects struct.
	Absolute bool
}

Summary describes the expected state for a set of standard metrics.

type SyncExpectations added in v1.15.1

type SyncExpectations map[types.NamespacedName]ObjectSetExpectations

SyncExpectations is a map of sync name & namespace to ObjectExpectations.

type SyncKind added in v1.15.1

type SyncKind string

SyncKind is an enum representing the Kind of Sync resources.

type SyncSetExpectations added in v1.15.1

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

SyncSetExpectations tracks metrics expectations for a set of RootSyncs and RepoSyncs.

func NewSyncSetExpectations added in v1.15.1

func NewSyncSetExpectations(t testing.NTB, scheme *runtime.Scheme) *SyncSetExpectations

NewSyncSetExpectations constructs a new map of operations expected to be performed by a set of syncs (specifically, the reconciler appliers, not the remediators).

func (*SyncSetExpectations) AddObjectApply added in v1.15.1

func (ae *SyncSetExpectations) AddObjectApply(syncKind SyncKind, syncNN types.NamespacedName, obj client.Object)

AddObjectApply specifies that an object is expected to be declared in the source of truth for the specified RSync.

func (*SyncSetExpectations) AddObjectDelete added in v1.15.1

func (ae *SyncSetExpectations) AddObjectDelete(syncKind SyncKind, syncNN types.NamespacedName, obj client.Object)

AddObjectDelete specifies that an object is expected to be deleted and removed from the source of truth for the specified RSync.

func (*SyncSetExpectations) AddObjectOperation added in v1.15.1

func (ae *SyncSetExpectations) AddObjectOperation(syncKind SyncKind, syncNN types.NamespacedName, obj client.Object, operation Operation)

AddObjectOperation specifies that an object is expected to be updated or deleted from the source of truth for the specified RSync.

func (*SyncSetExpectations) ExpectedObjectCount added in v1.15.1

func (ae *SyncSetExpectations) ExpectedObjectCount(syncKind SyncKind, syncNN types.NamespacedName) int

ExpectedObjectCount returns the expected number of declared resource objects for the specified sync.

func (*SyncSetExpectations) ExpectedObjectOperations added in v1.15.1

func (ae *SyncSetExpectations) ExpectedObjectOperations(syncKind SyncKind, syncNN types.NamespacedName) []ObjectOperation

ExpectedObjectOperations returns the expected operations to be performed by the reconciler for the specified sync.

func (*SyncSetExpectations) ExpectedRepoSyncObjectCount added in v1.15.1

func (ae *SyncSetExpectations) ExpectedRepoSyncObjectCount(syncNN types.NamespacedName) int

ExpectedRepoSyncObjectCount returns the expected number of declared resource objects in the specified RepoSync.

func (*SyncSetExpectations) ExpectedRepoSyncObjectOperations added in v1.15.1

func (ae *SyncSetExpectations) ExpectedRepoSyncObjectOperations(syncNN types.NamespacedName) []ObjectOperation

ExpectedRepoSyncObjectOperations returns the expected operations to be performed by the reconciler for the specified RepoSync.

func (*SyncSetExpectations) ExpectedRootSyncObjectCount added in v1.15.1

func (ae *SyncSetExpectations) ExpectedRootSyncObjectCount(syncName string) int

ExpectedRootSyncObjectCount returns the expected number of declared resource objects in the specified RootSync.

func (*SyncSetExpectations) ExpectedRootSyncObjectOperations added in v1.15.1

func (ae *SyncSetExpectations) ExpectedRootSyncObjectOperations(syncName string) []ObjectOperation

ExpectedRootSyncObjectOperations returns the expected operations to be performed by the reconciler for the specified RootSync.

func (*SyncSetExpectations) RemoveObject added in v1.15.1

func (ae *SyncSetExpectations) RemoveObject(syncKind SyncKind, syncNN types.NamespacedName, obj client.Object)

RemoveObject removes an object from the set of objects expected to be declared in the source of truth for the specified RSync.

func (*SyncSetExpectations) Reset added in v1.15.1

func (ae *SyncSetExpectations) Reset()

Reset the expected operations

func (*SyncSetExpectations) ResetRepoSync added in v1.15.1

func (ae *SyncSetExpectations) ResetRepoSync(syncNN types.NamespacedName)

ResetRepoSync resets the expected operations for the specified RepoSync

func (*SyncSetExpectations) ResetRootSync added in v1.15.1

func (ae *SyncSetExpectations) ResetRootSync(syncName string)

ResetRootSync resets the expected operations for the specified RootSync

func (*SyncSetExpectations) String added in v1.15.1

func (ae *SyncSetExpectations) String() string

String returns the operations in json format, for logging.

Jump to

Keyboard shortcuts

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