metrics

package
v0.0.0-...-dd9793c Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package metrics defines metrics and monitoring functionality used throughout operator.

Index

Constants

This section is empty.

Variables

View Source
var (
	// OperatorVersionLabel describes version of running binary.
	OperatorVersionLabel = monitoring.CreateLabel("version")

	// MergeErrorLabel describes the type of merge error.
	MergeErrorLabel = monitoring.CreateLabel("error_type")

	// RenderErrorLabel describes the type of the error while rendering.
	RenderErrorLabel = monitoring.CreateLabel("render_error")

	// CRFetchErrorReasonLabel describes the reason/HTTP code
	// for failing to fetch CR.
	CRFetchErrorReasonLabel = monitoring.CreateLabel("reason")

	// ComponentNameLabel represents istio component name - like
	// core, pilot, istio-cni etc.
	ComponentNameLabel = monitoring.CreateLabel("component")

	// ResourceKindLabel indicates the kind of resource owned
	// or created or updated or deleted or pruned by operator.
	ResourceKindLabel = monitoring.CreateLabel("kind")

	// ReconcileRequestReasonLabel describes reason of reconcile request.
	ReconcileRequestReasonLabel = monitoring.CreateLabel("reason")
)
View Source
var (
	// Version is the version of the operator binary running currently.
	Version = monitoring.NewGauge(
		"version",
		"Version of operator binary",
	)

	ReconcileRequestTotal = monitoring.NewSum(
		"reconcile_request_total",
		"Number of times requesting Reconcile",
	)

	// GetCRErrorTotal counts the number of times fetching
	// CR fails from API server.
	GetCRErrorTotal = monitoring.NewSum(
		"get_cr_error_total",
		"Number of times fetching CR from apiserver failed",
	)

	// CRMergeFailureTotal counts number of CR merge failures.
	CRMergeFailureTotal = monitoring.NewSum(
		"cr_merge_failure_total",
		"Number of IstioOperator CR merge failures",
	)

	// CRDeletionTotal counts the number of times
	// IstioOperator CR was deleted.
	CRDeletionTotal = monitoring.NewSum(
		"cr_deletion_total",
		"Number of IstioOperator CR deleted",
	)

	// CRValidationErrorTotal counts the number of CR
	// validation failures.
	CRValidationErrorTotal = monitoring.NewSum(
		"cr_validation_error_total",
		"Number of IstioOperator CR validation failures",
	)

	// RenderManifestTotal counts the number of manifest
	// renders at each component level.
	RenderManifestTotal = monitoring.NewSum(
		"render_manifest_total",
		"Number of component manifests rendered",
	)

	// OwnedResourceTotal indicates the number of resources
	// currently owned by the CR with given name and revision.
	OwnedResourceTotal = monitoring.NewGauge(
		"owned_resource_total",
		"Number of resources currently owned by the operator",
	)

	// ResourceCreationTotal indicates the number of resources
	// created by the operator for a CR and revision.
	ResourceCreationTotal = monitoring.NewSum(
		"resource_creation_total",
		"Number of resources created by the operator",
	)

	// ResourceUpdateTotal indicates the number of resources updated by
	// the operator in response to CR updates for a revision.
	ResourceUpdateTotal = monitoring.NewSum(
		"resource_update_total",
		"Number of resources updated by the operator",
	)

	// ResourceDeletionTotal indicates the number of resources deleted
	// by the operator in response to CR update or delete operation (like
	// ingress-gateway which was enabled could be disabled and this requires
	// deleting ingress-gateway deployment).
	ResourceDeletionTotal = monitoring.NewSum(
		"resource_deletion_total",
		"Number of resources deleted by the operator",
	)

	// ResourcePruneTotal indicates the resources pruned as a result of update.
	ResourcePruneTotal = monitoring.NewSum(
		"resource_prune_total",
		"Number of resources pruned by the operator",
	)

	// ManifestPatchErrorTotal counts the total number of K8S patch errors.
	ManifestPatchErrorTotal = monitoring.NewSum(
		"manifest_patch_error_total",
		"Number of times K8S patch overlays failed",
	)

	// ManifestRenderErrorTotal counts errors occurred while rendering manifest.
	ManifestRenderErrorTotal = monitoring.NewSum(
		"manifest_render_error_total",
		"Number of times error occurred during rendering output manifest",
	)

	// LegacyPathTranslationTotal counts the translations from legacy API to new one.
	LegacyPathTranslationTotal = monitoring.NewSum(
		"legacy_path_translation_total",
		"Number of times a legacy API path is translated",
	)

	// CacheFlushTotal counts number of cache flushes.
	CacheFlushTotal = monitoring.NewSum(
		"cache_flush_total",
		"number of times operator cache was flushed",
	)
)

Functions

func AddResource

func AddResource(name string, gk schema.GroupKind)

AddResource adds the resource of given kind to the set of owned objects

func CountCRFetchFail

func CountCRFetchFail(reason metav1.StatusReason)

CountCRFetchFail increments the count of CR fetch failure for a given name and the error status.

func CountCRMergeFail

func CountCRMergeFail(reason MergeErrorType)

CountCRMergeFail increments the count of CR merge failure for the given merge error type.

func CountManifestRender

func CountManifestRender(name name.ComponentName)

CountManifestRender increments the count of rendered manifest from IstioOperator CR by component name.

func CountManifestRenderError

func CountManifestRenderError(cn name.ComponentName, reason RenderErrorType)

CountManifestRenderError increments the count of manifest render errors.

func IncrementReconcileRequest

func IncrementReconcileRequest(reason string)

func RemoveResource

func RemoveResource(name string, gk schema.GroupKind)

RemoveResource removes the resource of given kind to the set of owned objects

func ReportOwnedResourceCounts

func ReportOwnedResourceCounts()

ReportOwnedResourceCounts reports the owned resource count metric by Group and Kind.

Types

type MergeErrorType

type MergeErrorType string

MergeErrorType describes the class of errors that could occur while merging profile, user supplied YAML, values overridden by --set and so on.

const (
	// CannotFetchProfileError occurs when profile cannot be found.
	CannotFetchProfileError MergeErrorType = "cannot_fetch_profile"

	// OverlayError overlaying YAMLs to combine profile, user
	// defined settings in CR, Hub-tag etc. fails.
	OverlayError MergeErrorType = "overlay"

	// IOPFormatError occurs when supplied CR cannot be marshaled
	// or unmarshaled to/from YAML.
	IOPFormatError MergeErrorType = "iop_format"

	// TranslateValuesError occurs when translating from legacy API fails.
	TranslateValuesError MergeErrorType = "translate_values"

	// InternalYAMLParseError occurs when spec section in merged CR
	// cannot be accessed for some reason (either missing or multiple).
	InternalYAMLParseError MergeErrorType = "internal_yaml_parse"
)

type RenderErrorType

type RenderErrorType string

RenderErrorType describes the class of errors that could occur while rendering Kubernetes manifest from given CR.

const (
	RenderNotStartedError RenderErrorType = "render_not_started"

	// HelmTranslateIOPToValuesError describes render error where renderer for
	// a component cannot create values.yaml tree from given CR.
	HelmTranslateIOPToValuesError RenderErrorType = "helm_translate_iop_to_values"

	// HelmChartRenderError describes error where Helm charts cannot be rendered
	// for the generated values.yaml tree.
	HelmChartRenderError RenderErrorType = "helm_chart_render"

	// K8SSettingsOverlayError describes the K8s overlay error after
	// rendering Helm charts successfully.
	K8SSettingsOverlayError RenderErrorType = "k8s_settings_overlay"

	// K8SManifestPatchError describes errors while patching generated manifest.
	K8SManifestPatchError RenderErrorType = "k8s_manifest_patch"
)

Jump to

Keyboard shortcuts

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