metrics

package
v1.14.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: Apache-2.0 Imports: 9 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) Filter

func (csm ConfigSyncMetrics) Filter(predicate NamedValidation) ConfigSyncMetrics

Filter returns a new ConfigSyncMetrics with only the metrics that pass the specified filter.

func (ConfigSyncMetrics) FilterByComponent

func (csm ConfigSyncMetrics) FilterByComponent(component string) ConfigSyncMetrics

FilterByComponent returns a new ConfigSyncMetrics with only the metrics from the specified component, filtered using tag values.

func (ConfigSyncMetrics) FilterByPodName

func (csm ConfigSyncMetrics) FilterByPodName(podName string) ConfigSyncMetrics

FilterByPodName returns a new ConfigSyncMetrics with only the metrics from the specified pod, filtered using tag values.

func (ConfigSyncMetrics) FilterByReconciler

func (csm ConfigSyncMetrics) FilterByReconciler(reconcilerName string) ConfigSyncMetrics

FilterByReconciler returns a new ConfigSyncMetrics with only the metrics from the specified reconciler, filtered using tag values.

func (ConfigSyncMetrics) ValidateDeclaredResources

func (csm ConfigSyncMetrics) ValidateDeclaredResources(value int) error

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

func (ConfigSyncMetrics) ValidateErrorMetrics

func (csm ConfigSyncMetrics) ValidateErrorMetrics(podName 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(reconcilerName 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) ValidateMetricsCommitSynced

func (csm ConfigSyncMetrics) ValidateMetricsCommitSynced(reconcilerName, commitHash string) error

ValidateMetricsCommitSynced checks that the `last_sync_timestamp` metric has been recorded for a particular commit hash.

func (ConfigSyncMetrics) ValidateMetricsCommitSyncedWithSuccess

func (csm ConfigSyncMetrics) ValidateMetricsCommitSyncedWithSuccess(reconcilerName, commitHash string) error

ValidateMetricsCommitSyncedWithSuccess checks that the `last_sync_timestamp` metric has been recorded for a particular commit hash with status=success.

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(podName 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(reconcilerName string, numResources int) error

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

func (ConfigSyncMetrics) ValidateResourceOverrideCount

func (csm ConfigSyncMetrics) ValidateResourceOverrideCount(reconcilerType, 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) 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
	Value string
}

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

func (Measurement) TagMap

func (m Measurement) TagMap() map[string]string

TagMap returns a new map of tag keys to values.

type NamedValidation

type NamedValidation func(metricName string) Validation

NamedValidation returns a Validation function for the specified metirc.

type Operation

type Operation struct {
	Name  string
	Count int
}

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

type Tag

type Tag struct {
	Key   string
	Value string
}

Tag is a replacement for OpenCensus Tag, which has a private name field, which makes it hard to test and print.

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