metrics

package
v1.7.6 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// AdalTokenFromMSIOperationName represents the duration of obtaining a token with MSI.
	AdalTokenFromMSIOperationName = "adal_token_msi" // #nosec

	// AdalTokenFromMSIWithUserAssignedIDOperationName represents the duration of obtaining a token with a user-assigned identity.
	AdalTokenFromMSIWithUserAssignedIDOperationName = "adal_token_msi_userassignedid" // #nosec

	// AdalTokenOperationName represents the duration of obtaining a token.
	AdalTokenOperationName = "adal_token"

	// GetVmssOperationName represents the duration of a GET request to a VMSS instance.
	GetVmssOperationName = "vmss_get"

	// UpdateVMSSOperationName represents the duration of a PATCH request to a VMSS instance.
	UpdateVMSSOperationName = "vmss_update"

	// GetVMOperationName represents the duration of a GET request to a VM instance.
	GetVMOperationName = "vm_get"

	// UpdateVMOperationName represents the duration of a PATCH request to a VM instance.
	UpdateVMOperationName = "vm_update"

	// AssignedIdentityDeletionOperationName represents the duration of an AzureAssignedIdentity deletion.
	AssignedIdentityDeletionOperationName = "assigned_identity_deletion"

	// AssignedIdentityAdditionOperationName represents the duration of an AzureAssignedIdentity addition.
	AssignedIdentityAdditionOperationName = "assigned_identity_addition"

	// AssignedIdentityUpdateOperationName represents the duration of an AzureAssignedIdentity update.
	AssignedIdentityUpdateOperationName = "assigned_identity_update"

	// UpdateAzureAssignedIdentityStatusOperationName represents the status of an AzureAssignedIdentity update operation.
	UpdateAzureAssignedIdentityStatusOperationName = "update_azure_assigned_identity_status"

	// GetPodListOperationName represents the status of a pod list operation.
	GetPodListOperationName = "get_pod_list"

	// GetSecretOperationName represents the status of a secret get operation.
	GetSecretOperationName = "get_secret"
)

This const block defines the metric names.

Variables

View Source
var (
	// AssignedIdentityAdditionDurationM is a measure that tracks the duration in seconds of assigned_identity_addition operations.
	AssignedIdentityAdditionDurationM = stats.Float64(
		assignedIdentityAdditionDurationName,
		"Duration in seconds of assigned identity addition operations",
		stats.UnitMilliseconds)

	// AssignedIdentityAdditionCountM is a measure that tracks the cumulative number of assigned identity addition operations.
	AssignedIdentityAdditionCountM = stats.Int64(
		assignedIdentityAdditionCountName,
		"Total number of assigned identity addition operations",
		stats.UnitDimensionless)

	// AssignedIdentityDeletionDurationM is a measure that tracks the duration in seconds of assigned_identity_deletion operations.
	AssignedIdentityDeletionDurationM = stats.Float64(
		assignedIdentityDeletionDurationName,
		"Duration in seconds of assigned identity deletion operations",
		stats.UnitMilliseconds)

	// AssignedIdentityDeletionCountM is a measure that tracks the cumulative number of assigned identity deletion operations.
	AssignedIdentityDeletionCountM = stats.Int64(assignedIdentityDeletionCountName,
		"Total number of assigned identity deletion operations",
		stats.UnitDimensionless)

	// NMIOperationsDurationM is a measure that tracks the duration in seconds of nmi operations.
	NMIOperationsDurationM = stats.Float64(
		nmiOperationsDurationName,
		"Duration in seconds for nmi operations",
		stats.UnitMilliseconds)

	// MICCycleDurationM is a measure that tracks the duration in seconds for single mic sync cycle.
	MICCycleDurationM = stats.Float64(
		micCycleDurationName,
		"Duration in seconds for single mic sync cycle",
		stats.UnitMilliseconds)

	// MICCycleCountM is a measure that tracks the cumulative number of cycles executed in mic.
	MICCycleCountM = stats.Int64(
		micCycleCountName,
		"Total number of cycles executed in mic",
		stats.UnitDimensionless)

	// MICNewLeaderElectionCountM is a measure that tracks the cumulative number of new leader election in mic.
	MICNewLeaderElectionCountM = stats.Int64(
		micNewLeaderElectionCountName,
		"Total number of new leader election in mic",
		stats.UnitDimensionless)

	// CloudProviderOperationsErrorsCountM is a measure that tracks the cumulative number of errors in cloud provider operations.
	CloudProviderOperationsErrorsCountM = stats.Int64(
		cloudProviderOperationsErrorsCountName,
		"Total number of errors in cloud provider operations",
		stats.UnitDimensionless)

	// CloudProviderOperationsDurationM is a measure that tracks the duration in seconds of CloudProviderOperations operations.
	CloudProviderOperationsDurationM = stats.Float64(
		cloudProviderOperationsDurationName,
		"Duration in seconds of cloudprovider operations",
		stats.UnitMilliseconds)

	// KubernetesAPIOperationsErrorsCountM is a measure that tracks the cumulative number of errors in cloud provider operations.
	KubernetesAPIOperationsErrorsCountM = stats.Int64(
		kubernetesAPIOperationsErrorsCountName,
		"Total number of errors in kubernetes api operations",
		stats.UnitDimensionless)

	// ImdsOperationsErrorsCountM is a measure that tracks the cumulative number of errors in imds operations.
	ImdsOperationsErrorsCountM = stats.Int64(
		imdsOperationsErrorsCountName,
		"Total number of errors in imds token operations",
		stats.UnitDimensionless)

	// ImdsOperationsDurationM is a measure that tracks the duration in seconds of imds operations.
	ImdsOperationsDurationM = stats.Float64(
		imdsOperationsDurationName,
		"Duration in seconds of imds token operations",
		stats.UnitMilliseconds)

	// AssignedIdentityUpdateDurationM is a measure that tracks the duration in seconds of assigned_identity_update operations.
	AssignedIdentityUpdateDurationM = stats.Float64(
		assignedIdentityUpdateDurationName,
		"Duration in seconds of assigned identity update operations",
		stats.UnitMilliseconds)

	// AssignedIdentityUpdateCountM is a measure that tracks the cumulative number of assigned identity update operations.
	AssignedIdentityUpdateCountM = stats.Int64(
		assignedIdentityUpdateCountName,
		"Total number of assigned identity update operations",
		stats.UnitDimensionless)
)

The following variables are measures

Functions

func RegisterAndExport

func RegisterAndExport(port string) error

RegisterAndExport register the views for the measures and expose via prometheus exporter

func SinceInSeconds

func SinceInSeconds(start time.Time) float64

SinceInSeconds gets the time since the specified start in seconds.

Types

type Reporter

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

Reporter is stats reporter in the context

func NewReporter

func NewReporter() (*Reporter, error)

NewReporter creates a reporter with new context

func (*Reporter) Report

func (r *Reporter) Report(ms ...stats.Measurement)

Report records the given measure

func (*Reporter) ReportCloudProviderOperationDuration

func (r *Reporter) ReportCloudProviderOperationDuration(operation string, duration time.Duration) error

ReportCloudProviderOperationDuration reports cloud provider operation duration

func (*Reporter) ReportCloudProviderOperationError

func (r *Reporter) ReportCloudProviderOperationError(operation string) error

ReportCloudProviderOperationError reports cloud provider operation error count

func (*Reporter) ReportIMDSOperationDuration

func (r *Reporter) ReportIMDSOperationDuration(operation string, duration time.Duration) error

ReportIMDSOperationDuration reports IMDS operation duration

func (*Reporter) ReportIMDSOperationError

func (r *Reporter) ReportIMDSOperationError(operation string) error

ReportIMDSOperationError reports IMDS error count

func (*Reporter) ReportKubernetesAPIOperationError

func (r *Reporter) ReportKubernetesAPIOperationError(operation string) error

ReportKubernetesAPIOperationError reports kubernetes operation error count

func (*Reporter) ReportOperation

func (r *Reporter) ReportOperation(operationType string, measurement stats.Measurement) error

ReportOperation records given measurement by operation type.

func (*Reporter) ReportOperationAndStatus

func (r *Reporter) ReportOperationAndStatus(operationType, statusCode, namespace, resource string, ms ...stats.Measurement) error

ReportOperationAndStatus records given measurements by operation type, status code for the given namespace and resource.

Jump to

Keyboard shortcuts

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