metrics

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Metric Names
	MetricNameConnectionStatusReady = "dbaas_connection_status_ready"

	// Resource label values
	LabelResourceValueConnection = "dbaas_connection"

	// Error Code Values
	LabelErrorCdValueDevTopologyModified           = "dbaas_connection_dev_topology_modified"
	LabelErrorCdValueErrReconcilingWithDevTopology = "dbaas_connection_err_reconciling_with_dev_topology"
	LabelErrorCdValueInvalidNameSpace              = "dbaas_connection_err_invalid_name_space"
	LabelErrorCdCannotReadInstance                 = "dbaas_connection_cannot_read_instance"
	LabelErrorCdValueErrorDeletingConnection       = "error_deleting_connection"

	// Label Names
	MetricLabelConnectionName = "name"
)
View Source
const (

	// Resource label values
	LabelResourceValueInstance = "dbaas_instance"

	// Error Code Values
	LabelErrorCdValueErrorFetchingDBaaSInstance     = "error_fetching_dbaas_instance_resources"
	LabelErrorCdValueErrorCheckingInstanceInventory = "error_checking_dbaas_instance_inventory"
	LabelErrorCdValueErrorDeletingInstance          = "error_deleting_dbaas_instance"
)
View Source
const (
	// Metric Names
	MetricNameInventoryStatusReady = "dbaas_inventory_status_ready"

	// Resource label values
	LabelResourceValueInventory = "dbaas_inventory"

	// Error Code Values
	LabelErrorCdValueErrorFetchingDBaaSInventoryResources = "error_fetching_dbaas_inventory_resources"
	LabelErrorCdValueErrorUpdatingInventoryStatus         = "error_updating_inventory_status"
	LabelErrorCdValueErrorDeletingInventory               = "error_deleting_inventory"
	LabelErrorCdValueErrCheckingInventory                 = "error_checking_inventory"
)
View Source
const (
	// Resource label values
	LabelResourceValuePlatform = "dbaas_platform"

	// Metrics names.
	MetricNameDBaaSPlatformInstallationStatus = "dbaas_platform_installation_status"

	// Metrics labels.
	MetricLabelPlatformName = "cloud_platform_name"

	// Error Code label values
	LabelErrorCdValueErrorFetchingDBaaSPlatformResources = "error_fetching_dbaas_platform_resource"
	LabelErrorCdValueErrorGettingOpenShiftURL            = "error_getting_openshift_url"
	LabelErrorCdValueErrorDeletingPlatform               = "error_deleting_dbaas_platform"
)
View Source
const (
	// Resource label values
	LabelResourceValuePolicy = "dbaas_policy"

	// Error Code label values
	LabelErrorCdValueErrorFetchingDBaaSPolicyResources = "error_fetching_dbaas_policy_resource"
	LabelErrorCdValueErrorResourceQuotaModified        = "error_resource_quota_modified"
	LabelErrorCdValueErrUpdatingResourceQuota          = "error_updating_resource_quota"
	LabelErrorCdValueErrorDeletingPolicy               = "error_deleting_dbaas_policy"
)
View Source
const (
	// Resource label values
	LabelResourceValueProvider = "dbaas_provider"

	// Error Code Values
	LabelErrorCdValueErrorFetchingDBaaSProviderResources = "error_fetching_dbaas_provider_resource"
	LabelErrorCdValueErrorWatchingInventoryCR            = "error_watching_inventory_cr"
	LabelErrorCdValueErrorWatchingConnectionCR           = "error_watching_connection_cr"
	LabelErrorCdValueErrorWatchingInstanceCR             = "error_watching_instance_cr"
	LabelErrorCdValueErrorDeletingProvider               = "error_deleting_dbaas_provider"
)
View Source
const (
	// Metrics names.
	MetricNameDBaaSStackInstallationTotalDuration = "dbaas_stack_installation_total_duration_seconds"
	MetricNameOperatorVersion                     = "dbaas_version_info"
	MetricNameDBaaSRequestsDurationSeconds        = "dbaas_requests_duration_seconds"
	MetricNameDBaaSRequestsErrorCount             = "dbaas_requests_error_count"

	// Metrics labels.
	MetricLabelName              = "name"
	MetricLabelStatus            = "status"
	MetricLabelVersion           = "version"
	MetricLabelProvider          = "provider"
	MetricLabelAccountName       = "account"
	MetricLabelNameSpace         = "namespace"
	MetricLabelInstanceID        = "instance_id"
	MetricLabelReason            = "reason"
	MetricLabelInstanceName      = "instance_name"
	MetricLabelCreationTimestamp = "creation_timestamp"
	MetricLabelConsoleULR        = "openshift_url"
	MetricLabelResource          = "resource"
	MetricLabelEvent             = "event"
	MetricLabelErrorCd           = "error_cd"
	ClusterVersionLabel          = "cluster_version"

	// Event label values
	LabelEventValueCreate = "create"
	LabelEventValueDelete = "delete"

	// Lavel value none
	LabelValueNone = "none"

	// Error Code label values
	LabelErrorCdValueResourceNotFound     = "resource_not_found"
	LabelErrorCdValueUnableToListPolicies = "unable_to_list_policies"
)

Variables

DBaaSConnectionStatusGauge defines a gauge for DBaaSConnectionStatus

View Source
var DBaaSInstancePhaseGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
	Name: metricNameInstancePhase,
	Help: "Current status phase of the Instance currently managed by RHODA values ( Pending=-1, Creating=0, Ready=1, Unknown=2, Failed=3, Error=4, Deleting=5 ).",
}, []string{MetricLabelProvider, MetricLabelAccountName, metricLabelInstanceName, MetricLabelNameSpace})

DBaaSInstancePhaseGauge defines a gauge for DBaaSInstancePhase

View Source
var DBaaSInstanceStatusGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
	Name: metricNameInstanceStatusReady,
	Help: "The status of DBaaS instance, values ( ready=1, error / not ready=0 )",
}, []string{MetricLabelProvider, MetricLabelAccountName, metricLabelInstanceName, MetricLabelNameSpace, MetricLabelStatus, MetricLabelReason, MetricLabelCreationTimestamp})

DBaaSInstanceStatusGauge defines a gauge for DBaaSInstanceStatus

View Source
var DBaaSInventoryStatusGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
	Name: MetricNameInventoryStatusReady,
	Help: "The status of DBaaS Provider Account, values ( ready=1, error / not ready=0 )",
}, []string{MetricLabelProvider, MetricLabelName, MetricLabelNameSpace, MetricLabelStatus, MetricLabelReason, MetricLabelCreationTimestamp})

DBaaSInventoryStatusGauge defines a gauge for DBaaSInventoryStatus

View Source
var DBaaSRequestsDurationHistogram = prometheus.NewHistogramVec(
	prometheus.HistogramOpts{
		Name: MetricNameDBaaSRequestsDurationSeconds,
		Help: "Request durations histogram for given resource(e.g. inventory) and for a given event(e.g. create or delete)",
	},
	[]string{MetricLabelProvider, MetricLabelAccountName, MetricLabelNameSpace, MetricLabelResource, MetricLabelEvent})

DBaaSRequestsDurationHistogram DBaaS Requests Duration Histogram for all DBaaS Resources

View Source
var DBaaSRequestsErrorsCounter = prometheus.NewCounterVec(
	prometheus.CounterOpts{
		Name: MetricNameDBaaSRequestsErrorCount,
		Help: "Total requests for a given resource(e.g. DBaaS Inventory), for a given event(e.g. create or delete), with a given error code (e.g. resource exists, resource not there)",
	},
	[]string{MetricLabelProvider, MetricLabelAccountName, MetricLabelNameSpace, MetricLabelResource, MetricLabelEvent, MetricLabelErrorCd})

DBaaSRequestsErrorsCounter Total errors encountered counter

View Source
var DBaasOperatorVersionInfo = prometheus.NewGaugeVec(prometheus.GaugeOpts{
	Name: MetricNameOperatorVersion,
	Help: "The current version of DBaaS Operator installed in the cluster",
}, []string{MetricLabelVersion, MetricLabelConsoleULR, MetricLabelPlatformName, MetricLabelCreationTimestamp, ClusterVersionLabel})

DBaasOperatorVersionInfo defines a gauge for DBaaS Operator version

View Source
var DBaasPlatformInstallationGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
	Name: MetricNameDBaaSPlatformInstallationStatus,
	Help: "The status of an installation of components and provider operators. values ( success=1, failed=0, in progress=2 ) ",
}, []string{MetricLabelName, MetricLabelStatus, MetricLabelVersion})

DBaasPlatformInstallationGauge defines a gauge for DBaaSPlatformInstallationStatus

View Source
var DBaasStackInstallationHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{
	Name: MetricNameDBaaSStackInstallationTotalDuration,
	Help: "Time in seconds installation of a DBaaS stack takes.",
	Buckets: prometheus.LinearBuckets(
		installationTimeStart,
		installationTimeWidth,
		installationTimeBuckets),
}, []string{MetricLabelVersion, MetricLabelCreationTimestamp})

DBaasStackInstallationHistogram defines a histogram for DBaasStackInstallation

Functions

func PlatformStackInstallationMetric

func PlatformStackInstallationMetric(platform *dbaasv1beta1.DBaaSPlatform, version string, e Execution)

PlatformStackInstallationMetric is used to log duration and success/failure

func SetConnectionMetrics

func SetConnectionMetrics(provider string, account string, connection dbaasv1beta1.DBaaSConnection, execution Execution, event string, errCd string)

SetConnectionMetrics set the Metrics for a connection

func SetInstanceMetrics

func SetInstanceMetrics(provider string, account string, instance dbaasv1beta1.DBaaSInstance, execution Execution, event string, errCd string)

SetInstanceMetrics set the metrics for an instance

func SetInventoryMetrics

func SetInventoryMetrics(inventory dbaasv1beta1.DBaaSInventory, execution Execution, event string, errCd string)

SetInventoryMetrics set the Metrics for inventory

func SetOpenShiftInstallationInfoMetric

func SetOpenShiftInstallationInfoMetric(operatorVersion string, consoleURL string, platformType string, creationTime string, clusterVersion string)

SetOpenShiftInstallationInfoMetric set the Metrics for openshift info

func SetPlatformMetrics

func SetPlatformMetrics(platform dbaasv1beta1.DBaaSPlatform, account string, execution Execution, event string, errCd string)

SetPlatformMetrics set the metrics for a platform

func SetPlatformStatusMetric

func SetPlatformStatusMetric(platformName dbaasv1beta1.PlatformName, status dbaasv1beta1.PlatformInstlnStatus, version string)

SetPlatformStatusMetric exposes dbaas_platform_status Metric for each platform

func SetPolicyMetrics

func SetPolicyMetrics(policy dbaasv1beta1.DBaaSPolicy, execution Execution, event string, errCd string)

SetPolicyMetrics set the Metrics for policy

func SetProviderMetrics

func SetProviderMetrics(provider dbaasv1beta1.DBaaSProvider, account string, execution Execution, event string, errCd string)

SetProviderMetrics set the metrics for a provider

func UpdateErrorsTotal

func UpdateErrorsTotal(provider string, account string, namespace string, resource string, event string, errCd string)

UpdateErrorsTotal Utility function to update errors total

func UpdateRequestsDurationHistogram

func UpdateRequestsDurationHistogram(provider string, account string, namespace string, resource string, event string, duration float64)

UpdateRequestsDurationHistogram Utility function to update request duration histogram

Types

type Execution

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

Execution tracks state for an API execution for emitting Metrics

func PlatformInstallStart

func PlatformInstallStart() Execution

PlatformInstallStart creates an Execution instance and starts the timer

Jump to

Keyboard shortcuts

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