metrics

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MetricsPort is the port where metrics are exposed
	MetricsPort = ":8675"
	// OtelDeployment is name of the otel-collector deployment
	OtelDeployment = "deployment/otel-collector"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigSyncMetrics

type ConfigSyncMetrics map[string][]Measurement

ConfigSyncMetrics is a map from metric names to its measurements.

func ParseMetrics

func ParseMetrics(port int) (ConfigSyncMetrics, error)

ParseMetrics connects to the local port where metrics are being forwarded to and parses the output into a map of metrics and measurements.

func (ConfigSyncMetrics) ValidateDeclaredResources

func (csm ConfigSyncMetrics) ValidateDeclaredResources(reconciler string, value int) error

ValidateDeclaredResources checks that the declared_resources metric is recorded and has the expected value.

func (ConfigSyncMetrics) ValidateErrorMetrics

func (csm ConfigSyncMetrics) ValidateErrorMetrics(reconciler string) error

ValidateErrorMetrics checks for the absence of all the error metrics except for the `reconciler_errors` metric. This metric is aggregated as a LastValue, so we check that the values are 0 instead.

func (ConfigSyncMetrics) ValidateGVKMetrics

func (csm ConfigSyncMetrics) ValidateGVKMetrics(reconciler string, gvkMetric GVKMetric) error

ValidateGVKMetrics validates all the metrics that have a GVK "type" tag key.

func (ConfigSyncMetrics) ValidateGitSyncDepthOverrideCount

func (csm ConfigSyncMetrics) ValidateGitSyncDepthOverrideCount(count int) error

ValidateGitSyncDepthOverrideCount checks that the `git_sync_depth_override_count` metric has the correct value.

func (ConfigSyncMetrics) ValidateMetricsCommitApplied

func (csm ConfigSyncMetrics) ValidateMetricsCommitApplied(commitHash string) error

ValidateMetricsCommitApplied checks that the `last_apply_timestamp` metric has been recorded for a particular commit hash.

func (ConfigSyncMetrics) ValidateNoSSLVerifyCount

func (csm ConfigSyncMetrics) ValidateNoSSLVerifyCount(count int) error

ValidateNoSSLVerifyCount checks that the `no_ssl_verify_count` metric has the correct value.

func (ConfigSyncMetrics) ValidateReconcilerErrors

func (csm ConfigSyncMetrics) ValidateReconcilerErrors(reconciler string, sourceValue, syncValue int) error

ValidateReconcilerErrors checks that the `reconciler_errors` metric is recorded for the correct reconciler with the expected values for each of its component tags.

func (ConfigSyncMetrics) ValidateReconcilerManagerMetrics

func (csm ConfigSyncMetrics) ValidateReconcilerManagerMetrics() error

ValidateReconcilerManagerMetrics validates the `reconcile_duration_seconds` metric from the reconciler manager.

func (ConfigSyncMetrics) ValidateReconcilerMetrics

func (csm ConfigSyncMetrics) ValidateReconcilerMetrics(reconciler string, numResources int) error

ValidateReconcilerMetrics validates the non-error and non-GVK metrics produced by the reconcilers.

func (ConfigSyncMetrics) ValidateResourceOverrideCount

func (csm ConfigSyncMetrics) ValidateResourceOverrideCount(reconciler, containerName, resourceType string, count int) error

ValidateResourceOverrideCount checks that the `resource_override_count` metric is recorded for the correct reconciler, container name, and resource type, and checks the metric value is correct.

func (ConfigSyncMetrics) ValidateResourceOverrideCountMissingTags

func (csm ConfigSyncMetrics) ValidateResourceOverrideCountMissingTags(tags []tag.Tag) error

ValidateResourceOverrideCountMissingTags checks that the `resource_override_count` metric misses the specific the tags.

type GVKMetric

type GVKMetric struct {
	GVK      string
	APIOp    string
	ApplyOps []Operation
	Watches  string
}

GVKMetric is used for validating the count aggregated metrics that have a GVK type tag (`api_duration_seconds`, `apply_operations`, and `watches`).

func ResourceCreated

func ResourceCreated(gvk string) GVKMetric

ResourceCreated encapsulates the expected metric data when a new resource is created in Config Sync.

func ResourceDeleted

func ResourceDeleted(gvk string) GVKMetric

ResourceDeleted encapsulates the expected metric data when a resource is deleted in Config Sync.

func ResourcePatched

func ResourcePatched(gvk string, count int) GVKMetric

ResourcePatched encapsulates the expected metric data when an existing resource is patched in Config Sync.

type Measurement

type Measurement struct {
	Tags  []tag.Tag
	Value string
}

Measurement is a recorded data point with a list of tags and a value.

type Operation

type Operation struct {
	Name  string
	Count int
}

Operation encapsulates an operation in the applier (create, update, delete) with its count value.

type Validation

type Validation func(metric Measurement) error

Validation evaluates a Measurement, returning an error if it fails validation.

Jump to

Keyboard shortcuts

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