metrics

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: Apache-2.0 Imports: 19 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// MetricsPath is the endpoint to collect rollout metrics
	MetricsPath = "/metrics"
)

Variables

View Source
var (
	MetricRolloutReconcile = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "rollout_reconcile",
			Help:    "Rollout reconciliation performance.",
			Buckets: []float64{0.01, 0.15, .25, .5, 1},
		},
		namespaceNameLabels,
	)

	MetricRolloutReconcileError = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "rollout_reconcile_error",
			Help: "Error occurring during the rollout",
		},
		namespaceNameLabels,
	)

	MetricRolloutInfo = prometheus.NewDesc(
		"rollout_info",
		"Information about rollout.",
		append(namespaceNameLabels, "strategy", "traffic_router", "phase"),
		nil,
	)

	MetricRolloutInfoReplicasAvailable = prometheus.NewDesc(
		"rollout_info_replicas_available",
		"The number of available replicas per rollout.",
		namespaceNameLabels,
		nil,
	)

	MetricRolloutInfoReplicasUnavailable = prometheus.NewDesc(
		"rollout_info_replicas_unavailable",
		"The number of unavailable replicas per rollout.",
		namespaceNameLabels,
		nil,
	)

	MetricRolloutInfoReplicasDesired = prometheus.NewDesc(
		"rollout_info_replicas_desired",
		"The number of desired replicas per rollout.",
		namespaceNameLabels,
		nil,
	)

	MetricRolloutInfoReplicasUpdated = prometheus.NewDesc(
		"rollout_info_replicas_updated",
		"The number of updated replicas per rollout.",
		namespaceNameLabels,
		nil,
	)

	MetricRolloutEventsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "rollout_events_total",
			Help: "Count of rollout events",
		},
		append(namespaceNameLabels, "type", "reason"),
	)

	// DEPRECATED in favor of rollout_info
	MetricRolloutPhase = prometheus.NewDesc(
		"rollout_phase",
		"Information on the state of the rollout (DEPRECATED - use rollout_info)",
		append(namespaceNameLabels, "strategy", "phase"),
		nil,
	)
)

Rollout metrics

View Source
var (
	MetricAnalysisRunReconcile = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "analysis_run_reconcile",
			Help:    "Analysis Run reconciliation performance.",
			Buckets: []float64{0.01, 0.15, .25, .5, 1},
		},
		namespaceNameLabels,
	)

	MetricAnalysisRunReconcileError = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "analysis_run_reconcile_error",
			Help: "Error occurring during the analysis run",
		},
		namespaceNameLabels,
	)
	MetricAnalysisRunInfo = prometheus.NewDesc(
		"analysis_run_info",
		"Information about analysis run.",
		append(namespaceNameLabels, "phase"),
		nil,
	)

	// DEPRECATED in favor of analysis_run_info
	MetricAnalysisRunPhase = prometheus.NewDesc(
		"analysis_run_phase",
		"Information on the state of the Analysis Run (DEPRECATED - use analysis_run_info)",
		append(namespaceNameLabels, "phase"),
		nil,
	)

	MetricAnalysisRunMetricType = prometheus.NewDesc(
		"analysis_run_metric_type",
		"Information on the type of a specific metric in the Analysis Runs",
		append(namespaceNameLabels, "metric", "type"),
		nil,
	)

	MetricAnalysisRunMetricPhase = prometheus.NewDesc(
		"analysis_run_metric_phase",
		"Information on the duration of a specific metric in the Analysis Run",
		append(namespaceNameLabels, "metric", "type", "dry_run", "phase"),
		nil,
	)
)

AnalysisRun metrics

View Source
var (
	MetricAnalysisTemplateInfo = prometheus.NewDesc(
		"analysis_template_info",
		"Information about analysis templates.",
		append(namespaceNameLabels),
		nil,
	)

	MetricAnalysisTemplateMetricInfo = prometheus.NewDesc(
		"analysis_template_metric_info",
		"Information on metrics in analysis templates.",
		append(namespaceNameLabels, "type", "metric"),
		nil,
	)
)

AnalysisTemplate metrics

View Source
var (
	MetricExperimentReconcile = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "experiment_reconcile",
			Help:    "Experiments reconciliation performance.",
			Buckets: []float64{0.01, 0.15, .25, .5, 1},
		},
		namespaceNameLabels,
	)

	MetricExperimentReconcileError = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "experiment_reconcile_error",
			Help: "Error occurring during the experiment",
		},
		namespaceNameLabels,
	)

	MetricExperimentInfo = prometheus.NewDesc(
		"experiment_info",
		"Information about Experiment.",
		append(namespaceNameLabels, "phase"),
		nil,
	)

	// DEPRECATED in favor of experiment_info
	MetricExperimentPhase = prometheus.NewDesc(
		"experiment_phase",
		"Information on the state of the experiment (DEPRECATED - use experiment_info)",
		append(namespaceNameLabels, "phase"),
		nil,
	)
)

Experiment metrics

View Source
var (
	MetricNotificationSuccessTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "notification_send_success",
			Help: "Notification send success.",
		},
		append(namespaceNameLabels, "type", "reason"),
	)

	MetricNotificationFailedTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "notification_send_error",
			Help: "Error sending the notification",
		},
		append(namespaceNameLabels, "type", "reason"),
	)

	MetricNotificationSend = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "notification_send",
			Help:    "Notification send performance.",
			Buckets: []float64{0.01, 0.15, .25, .5, 1},
		},
		namespaceNameLabels,
	)
)

Notification metrics

View Source
var (
	// Custom events metric
	MetricK8sRequestTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: clientsetMetricsNamespace,
			Name:      "k8s_request_total",
			Help:      "Number of kubernetes requests executed during application reconciliation.",
		},
		[]string{"kind", "namespace", "name", "verb", "status_code"},
	)
)

K8s Client metrics

View Source
var (
	MetricVersionGauge = prometheus.NewGaugeFunc(
		prometheus.GaugeOpts{
			Name:        "argo_rollouts_controller_info",
			Help:        "Running Argo-rollouts version",
			ConstLabels: prometheus.Labels{"version": version.GetVersion().Version},
		},
		func() float64 {
			return float64(1)
		},
	)
)

MetricVersionGauge version info

Functions

func NewAnalysisRunCollector added in v0.8.0

func NewAnalysisRunCollector(
	analysisRunLister rolloutlister.AnalysisRunLister,
	analysisTemplateLister rolloutlister.AnalysisTemplateLister,
	clusterAnalysisTemplateLister rolloutlister.ClusterAnalysisTemplateLister,
) prometheus.Collector

NewAnalysisRunCollector returns a prometheus collector for AnalysisRun metrics

func NewExperimentCollector added in v0.8.0

func NewExperimentCollector(experimentLister rolloutlister.ExperimentLister) prometheus.Collector

NewExperimentCollector returns a prometheus collector for experiment metrics

func NewRolloutCollector

func NewRolloutCollector(rolloutLister rolloutlister.RolloutLister) prometheus.Collector

NewRolloutCollector returns a prometheus collector for rollout metrics

Types

type K8sRequestsCountProvider added in v0.8.0

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

func (*K8sRequestsCountProvider) IncKubernetesRequest added in v0.8.0

func (m *K8sRequestsCountProvider) IncKubernetesRequest(resourceInfo kubeclientmetrics.ResourceInfo) error

IncKubernetesRequest increments the kubernetes client counter

func (*K8sRequestsCountProvider) MustRegister added in v0.8.0

func (f *K8sRequestsCountProvider) MustRegister(registerer prometheus.Registerer)

type MetricsServer

type MetricsServer struct {
	*http.Server
	// contains filtered or unexported fields
}

func NewMetricsServer

func NewMetricsServer(cfg ServerConfig) *MetricsServer

NewMetricsServer returns a new prometheus server which collects rollout metrics

func (*MetricsServer) IncAnalysisRunReconcile added in v0.8.0

func (m *MetricsServer) IncAnalysisRunReconcile(ar *v1alpha1.AnalysisRun, duration time.Duration)

IncAnalysisRunReconcile increments the reconcile counter for an AnalysisRun

func (*MetricsServer) IncError

func (m *MetricsServer) IncError(namespace, name string, kind string)

IncError increments the reconcile counter for an rollout

func (*MetricsServer) IncExperimentReconcile added in v0.8.0

func (m *MetricsServer) IncExperimentReconcile(ex *v1alpha1.Experiment, duration time.Duration)

IncExperimentReconcile increments the reconcile counter for an Experiment

func (*MetricsServer) IncRolloutReconcile added in v0.8.0

func (m *MetricsServer) IncRolloutReconcile(rollout *v1alpha1.Rollout, duration time.Duration)

IncRolloutReconcile increments the reconcile counter for a Rollout

func (*MetricsServer) Remove added in v1.3.0

func (m *MetricsServer) Remove(namespace string, name string, kind string)

Remove removes the metrics server from the registry

type RolloutPhase

type RolloutPhase string

RolloutPhase the phases of a reconcile can have

const (

	// RolloutInvalidSpec means the rollout had an invalid spec during reconciliation
	RolloutInvalidSpec RolloutPhase = "InvalidSpec"
	// RolloutCompleted means the rollout finished the reconciliation with no remaining work
	RolloutCompleted RolloutPhase = "Completed"
	// RolloutProgressing means the rollout finished the reconciliation with remaining work
	RolloutProgressing RolloutPhase = "Progressing"
	// RolloutPaused means the rollout finished the reconciliation with a paused status
	RolloutPaused RolloutPhase = "Paused"
	// RolloutTimeout means the rollout finished the reconciliation with an timeout message
	RolloutTimeout RolloutPhase = "Timeout"
	// RolloutError means the rollout finished the reconciliation with an error
	RolloutError RolloutPhase = "Error"
	// RolloutAbort means the rollout finished the reconciliation in an aborted state
	RolloutAbort RolloutPhase = "Abort"
)

type ServerConfig added in v0.8.0

type ServerConfig struct {
	Addr                          string
	RolloutLister                 rolloutlister.RolloutLister
	AnalysisRunLister             rolloutlister.AnalysisRunLister
	AnalysisTemplateLister        rolloutlister.AnalysisTemplateLister
	ClusterAnalysisTemplateLister rolloutlister.ClusterAnalysisTemplateLister
	ExperimentLister              rolloutlister.ExperimentLister
	K8SRequestProvider            *K8sRequestsCountProvider
}

Jump to

Keyboard shortcuts

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