metricsconfig

package
v0.0.0-...-ac479d4 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package metricsconfig contains API Schema definitions for configurations specific to metrics controller. +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/openshift/hive/apis/hive

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DurationMetricType

type DurationMetricType string

DurationMetricType is a valid value for MetricsWithDuration.Name

const (

	// CurrentStopping corresponds to hive_cluster_deployments_stopping_seconds
	CurrentStopping DurationMetricType = "currentStopping"
	// CurrentResuming corresponds to hive_cluster_deployments_resuming_seconds
	CurrentResuming DurationMetricType = "currentResuming"
	// CurrentWaitingForCO corresponds to hive_cluster_deployments_waiting_for_cluster_operators_seconds
	CurrentWaitingForCO DurationMetricType = "currentWaitingForCO"
	// CurrentClusterSyncFailing corresponds to hive_clustersync_failing_seconds
	CurrentClusterSyncFailing DurationMetricType = "currentClusterSyncFailing"

	// CumulativeHibernated corresponds to hive_cluster_deployment_hibernation_transition_seconds
	CumulativeHibernated DurationMetricType = "cumulativeHibernated"
	// CumulativeResumed corresponds to hive_cluster_deployment_running_transition_seconds
	CumulativeResumed DurationMetricType = "cumulativeResumed"
)

type MetricsConfig

type MetricsConfig struct {
	// Optional metrics and their configurations
	// +optional
	MetricsWithDuration []MetricsWithDuration `json:"metricsWithDuration,omitempty"`
	// AdditionalClusterDeploymentLabels allows configuration of additional labels to be applied to certain metrics.
	// The keys can be any string value suitable for a metric label (see https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).
	// The values can be any ClusterDeployment label key (from metadata.labels). When observing an affected metric,
	// hive will label it with the specified metric key, and copy the value from the specified ClusterDeployment label.
	// For example, including {"ocp_major_version": "hive.openshift.io/version-major"} will cause affected metrics to
	// include a label key ocp_major_version with the value from the hive.openshift.io/version-major ClusterDeployment
	// label -- e.g. "4".
	// NOTE: Avoid ClusterDeployment labels whose values are unbounded, such as those representing cluster names or IDs,
	// as these will cause your prometheus database to grow indefinitely.
	// Affected metrics are those whose type implements the metricsWithDynamicLabels interface found in
	// pkg/controller/metrics/metrics_with_dynamic_labels.go
	// +optional
	AdditionalClusterDeploymentLabels *map[string]string `json:"additionalClusterDeploymentLabels,omitempty"`
}

func (*MetricsConfig) DeepCopy

func (in *MetricsConfig) DeepCopy() *MetricsConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricsConfig.

func (*MetricsConfig) DeepCopyInto

func (in *MetricsConfig) DeepCopyInto(out *MetricsConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MetricsWithDuration

type MetricsWithDuration struct {
	// Name of the metric. It will correspond to an optional relevant metric in hive
	// +kubebuilder:validation:Enum=currentStopping;currentResuming;currentWaitingForCO;currentClusterSyncFailing;cumulativeHibernated;cumulativeResumed
	Name DurationMetricType `json:"name"`
	// Duration is the minimum time taken - the relevant metric will be logged only if the value reported by that metric
	// is more than the time mentioned here. For example, if a user opts-in for current clusters stopping and mentions
	// 1 hour here, only the clusters stopping for more than an hour will be reported.
	// This is a Duration value; see https://pkg.go.dev/time#ParseDuration for accepted formats.
	// +kubebuilder:validation:Type=string
	// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$"
	Duration *metav1.Duration `json:"duration"`
}

MetricsWithDuration represents metrics that report time as values,like transition seconds. The purpose of these metrics should be to track outliers - ensure their duration is not set too low.

func (*MetricsWithDuration) DeepCopy

func (in *MetricsWithDuration) DeepCopy() *MetricsWithDuration

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricsWithDuration.

func (*MetricsWithDuration) DeepCopyInto

func (in *MetricsWithDuration) DeepCopyInto(out *MetricsWithDuration)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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