metrics

package
v0.0.0-...-17ef94a Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Namespace = "upgradeoperator"
	Subsystem = "upgrade"

	StateLabel            = "state"
	VersionLabel          = "version"
	PrecedingVersionLabel = "preceding_version"
	StreamLabel           = "stream"

	ScheduledStateValue             = "scheduled"
	StartedStateValue               = "started"
	FinishedStateValue              = "finished"
	ControlPlaneStartedStateValue   = "control_plane_started"
	ControlPlaneCompletedStateValue = "control_plane_completed"
	WorkersStartedStateValue        = "workers_started"
	WorkersCompletedStateValue      = "workers_completed"

	MonitoringNS              = "openshift-monitoring"
	MonitoringCAConfigMapName = "serving-certs-ca-bundle"
	MonitoringConfigField     = "service-ca.crt"

	MetricsQueryFailed               = "healthcheck_query_failed"
	CriticalAlertsFiring             = "critical_alerts_firing"
	ClusterOperatorsDegraded         = "cluster_operators_degraded"
	ClusterOperatorsStatusFailed     = "cluster_operator_status_failed"
	DefaultWorkerMachinepoolNotFound = "default_worker_machinepool_not_found"
	ClusterNodeQueryFailed           = "cluster_node_query_failed"
	ClusterNodesManuallyCordoned     = "cluster_node_manually_cordoned"
	ClusterNodesTaintedUnschedulable = "cluster_node_taint_unschedulable"
	ClusterInvalidPDB                = "cluster_invalid_pdb"
	ClusterInvalidPDBConf            = "cluster_invalid_pdb_configuration"
	PDBQueryFailed                   = "pdb_query_failed"
	DvoClientCreationFailed          = "dvo_client_creation_failed"
	DvoMetricsQueryFailed            = "dvo_metrics_query_failed"
)

Variables

This section is empty.

Functions

func GetService

func GetService(c client.Client, namespace, svcName, portName string) (string, error)

GetService accepts a client,namespace,svcName and portName and attempts to retrieve the services endpoint in the form of resolveable.service:portnumber.

func MonitoringTLSConfig

func MonitoringTLSConfig(c client.Client) (*tls.Config, error)

MonitoringTLSConfig accepts a client.Client and returns a *tls.Config for monitoring services using the monitoring services CA.

func NetworkTarget

func NetworkTarget(c client.Client, namespace, appName, portName string) (string, error)

NetworkTarget returns a host:port address that represents either a kubernetes route or service depending on the runtime conditions.

func RequestPrometheusServiceAccountAPIToken

func RequestPrometheusServiceAccountAPIToken(c client.Client) (string, error)

RequestPrometheusServiceAccountAPIToken returns a time-bound (24hr) API token for the prometheus service account.

Types

type AlertData

type AlertData struct {
	Result []AlertResult `json:"result"`
}

type AlertResponse

type AlertResponse struct {
	Status string    `json:"status"`
	Data   AlertData `json:"data"`
}

type AlertResult

type AlertResult struct {
	Metric map[string]string `json:"metric"`
	Value  []interface{}     `json:"value"`
}

type Counter

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

func (*Counter) AlertsFromUpgrade

func (c *Counter) AlertsFromUpgrade(upgradeStart time.Time, upgradeEnd time.Time) ([]string, error)

AlertsFromUpgrade reports any primary-paging critical alerts that were fired from managed-upgrade-operator during the last upgrade.

func (*Counter) IsAlertFiring

func (c *Counter) IsAlertFiring(alert string, checkedNS, ignoredNS []string) (bool, error)

func (*Counter) IsClusterVersionAtVersion

func (c *Counter) IsClusterVersionAtVersion(version string) (bool, error)

func (*Counter) IsMetricNotificationEventSentSet

func (c *Counter) IsMetricNotificationEventSentSet(upgradeConfigName string, event string, version string) (bool, error)

func (*Counter) Query

func (c *Counter) Query(query string) (*AlertResponse, error)

func (*Counter) ResetAllMetricNodeDrainFailed

func (c *Counter) ResetAllMetricNodeDrainFailed()

func (*Counter) ResetEphemeralMetrics

func (c *Counter) ResetEphemeralMetrics()

ResetEphemeralMetrics will reset all ephemeral metrics

func (*Counter) ResetFailureMetrics

func (c *Counter) ResetFailureMetrics()

ResetFailureMetrics will reset the metric which indicates the upgrade failed

func (*Counter) ResetMetricNodeDrainFailed

func (c *Counter) ResetMetricNodeDrainFailed(nodeName string)

func (*Counter) ResetMetricUpgradeControlPlaneTimeout

func (c *Counter) ResetMetricUpgradeControlPlaneTimeout(upgradeConfigName, version string)

func (*Counter) ResetMetricUpgradeWorkerTimeout

func (c *Counter) ResetMetricUpgradeWorkerTimeout(upgradeConfigName, version string)

func (*Counter) UpdateMetricHealthcheckFailed

func (c *Counter) UpdateMetricHealthcheckFailed(upgradeConfigName, reason string, version string, state string)

func (*Counter) UpdateMetricHealthcheckSucceeded

func (c *Counter) UpdateMetricHealthcheckSucceeded(upgradeConfigName string, reason string, version string, state string)

func (*Counter) UpdateMetricNodeDrainFailed

func (c *Counter) UpdateMetricNodeDrainFailed(nodeName string)

func (*Counter) UpdateMetricNotificationEventSent

func (c *Counter) UpdateMetricNotificationEventSent(upgradeConfigName string, event string, version string)

func (*Counter) UpdateMetricScalingFailed

func (c *Counter) UpdateMetricScalingFailed(upgradeConfigName string)

func (*Counter) UpdateMetricScalingSucceeded

func (c *Counter) UpdateMetricScalingSucceeded(upgradeConfigName string)

func (*Counter) UpdateMetricUpgradeConfigSyncTimestamp

func (c *Counter) UpdateMetricUpgradeConfigSyncTimestamp(name string, time time.Time)

func (*Counter) UpdateMetricUpgradeControlPlaneTimeout

func (c *Counter) UpdateMetricUpgradeControlPlaneTimeout(upgradeConfigName, version string)

func (*Counter) UpdateMetricUpgradeResult

func (c *Counter) UpdateMetricUpgradeResult(name string, precedingVersion string, version string, stream string, alerts []string)

func (*Counter) UpdateMetricUpgradeWindowBreached

func (c *Counter) UpdateMetricUpgradeWindowBreached(upgradeConfigName string)

func (*Counter) UpdateMetricUpgradeWindowNotBreached

func (c *Counter) UpdateMetricUpgradeWindowNotBreached(upgradeConfigName string)

func (*Counter) UpdateMetricUpgradeWorkerTimeout

func (c *Counter) UpdateMetricUpgradeWorkerTimeout(upgradeConfigName, version string)

func (*Counter) UpdateMetricValidationFailed

func (c *Counter) UpdateMetricValidationFailed(upgradeConfigName string)

func (*Counter) UpdateMetricValidationSucceeded

func (c *Counter) UpdateMetricValidationSucceeded(upgradeConfigName string)

type Metrics

type Metrics interface {
	UpdateMetricValidationFailed(string)
	UpdateMetricValidationSucceeded(string)
	UpdateMetricHealthcheckSucceeded(string, string, string, string)
	UpdateMetricScalingFailed(string)
	UpdateMetricScalingSucceeded(string)
	UpdateMetricUpgradeWindowNotBreached(string)
	UpdateMetricUpgradeConfigSyncTimestamp(string, time.Time)
	UpdateMetricUpgradeWindowBreached(string)
	UpdateMetricUpgradeControlPlaneTimeout(string, string)
	ResetMetricUpgradeControlPlaneTimeout(string, string)
	UpdateMetricHealthcheckFailed(string, string, string, string)
	UpdateMetricUpgradeWorkerTimeout(string, string)
	ResetMetricUpgradeWorkerTimeout(string, string)
	UpdateMetricNodeDrainFailed(string)
	ResetMetricNodeDrainFailed(string)
	ResetAllMetricNodeDrainFailed()
	ResetFailureMetrics()
	ResetEphemeralMetrics()
	UpdateMetricNotificationEventSent(string, string, string)
	UpdateMetricUpgradeResult(string, string, string, string, []string)
	AlertsFromUpgrade(time.Time, time.Time) ([]string, error)
	IsAlertFiring(alert string, checkedNS, ignoredNS []string) (bool, error)
	IsMetricNotificationEventSentSet(upgradeConfigName string, event string, version string) (bool, error)
	IsClusterVersionAtVersion(version string) (bool, error)
	Query(query string) (*AlertResponse, error)
}

type MetricsBuilder

type MetricsBuilder interface {
	NewClient(c client.Client) (Metrics, error)
}

func NewBuilder

func NewBuilder() MetricsBuilder

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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