metrics

package
v1.30.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package metrics provides Ginkgo/Gomega assertions over the metrics scraped from instance pods: presence/absence checks and contents of custom metric ConfigMaps/Secrets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertCustomMetricsResourcesExist

func AssertCustomMetricsResourcesExist(
	env *environment.TestingEnvironment,
	namespace, sampleFile string,
	configMapsCount, secretsCount int,
)

AssertCustomMetricsResourcesExist creates the resources defined in the given sample file and verifies they produce the expected number of ConfigMaps and Secrets tagged with e2e=metrics.

func AssertExcludesMetrics

func AssertExcludesMetrics(g Gomega, rawMetricsOutput string, nonCollected []string)

AssertExcludesMetrics asserts that every entry in nonCollected is absent from rawMetricsOutput.

func AssertIncludesMetrics

func AssertIncludesMetrics(g Gomega, rawMetricsOutput string, expectedMetrics map[string]*regexp.Regexp)

AssertIncludesMetrics asserts that every expected metric name appears in rawMetricsOutput and that its value matches the supplied regexp.

func AssertMetricsData

func AssertMetricsData(
	env *environment.TestingEnvironment,
	testTimeouts map[timeouts.Timeout]int,
	namespace, targetOne, targetTwo, targetSecret string,
	cluster *apiv1.Cluster,
)

AssertMetricsData scrapes each pod and verifies the target-database custom metrics are present. On the primary pod, it also expects the backup timestamp metrics to be exposed.

func CollectAndAssertCollectorMetricsPresentOnEachPod

func CollectAndAssertCollectorMetricsPresentOnEachPod(
	env *environment.TestingEnvironment,
	testTimeouts map[timeouts.Timeout]int,
	cluster *apiv1.Cluster,
)

CollectAndAssertCollectorMetricsPresentOnEachPod verifies the cnpg collector metrics (collection_duration, fencing, wal stats, …) are exposed on every pod of the cluster.

func CollectAndAssertDefaultMetricsPresentOnEachPod

func CollectAndAssertDefaultMetricsPresentOnEachPod(
	env *environment.TestingEnvironment,
	testTimeouts map[timeouts.Timeout]int,
	namespace, clusterName string,
	tlsEnabled bool,
	expectPresent bool,
)

CollectAndAssertDefaultMetricsPresentOnEachPod verifies the default set of cnpg_* metrics is present (or absent) on every pod of the cluster.

Types

This section is empty.

Jump to

Keyboard shortcuts

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