metrics

package
v0.0.0-...-c68fe67 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricClusterAddonsExpected = "cluster/addons_expected"
	MetricClusterNodeAvailable  = "cluster/node_available"
	MetricClusterNodeCondition  = "cluster/node_condition"
	MetricClusterAddonCondition = "cluster/probe/addons_condition"
	MetricAddonAvailable        = "addon/available"
	MetricAddonCPAvailable      = "addon/control_plane_available"
	MetricAddonRestart          = "addon/restart"
	MetricNodeAvailable         = "node/available"
	MetricNodeCondition         = "node/condition"
)
View Source
const (
	// MetricNamespace is the name of the namespace used by opentelemetry.
	MetricNamespace = "dummy.net/gke-prober"
)

Variables

This section is empty.

Functions

func StartGCM

func StartGCM(ctx context.Context, cfg common.Config) (*gcmProvider, error)

StartGCM returns a Cloud Monitoring metrics provider

func StartOTel

func StartOTel(ctx context.Context, cfg common.Config) (*otelProvider, error)

getPusher returns a Cloud Monitoring metrics pusher or a stdout pusher if the DEBUG env var is set to "true"

Types

type ClusterRecorder

type ClusterRecorder interface {
	// cluster/addons_expected
	// Entity: k8s_cluster
	// Label: name / Value: (name of addon)
	// Label: version / Value: (version of addon)
	// Label: controller / Value: (DaemonSet or Deployment)
	// Value: count of addons
	RecordAddonCounts(ctx context.Context, counts []LabelCount)

	// cluster/node_available (SLI)
	// Entity: k8s_cluster
	// Label: nodepool / Values: (set of nodepools)
	// Label: zone / Values: (set of zones)
	// Label: available / Value (True/False)
	// Label: ready / Value (True/False)
	// Label: schedulable / Value (True/False)
	// Label: done_warming / Value (True/False)
	// Value: count of available nodes
	RecordNodeAvailabilities(ctx context.Context, counts []LabelCount)

	// cluster/node_condition
	// Entity: k8s_cluster
	// Label: nodepool / Values: (set of nodepools)
	// Label: zone / Values: (set of zones)
	// Label: type / Values: (set of conditions)
	// Label: status / Values: (True/False/Unknown)
	// Value: count of nodes reflecting condition
	RecordNodeConditions(ctx context.Context, counts []LabelCount)
}

type LabelCount

type LabelCount struct {
	Labels map[string]string
	Count  int
}

type NodeRecorder

type NodeRecorder interface {
	// addon/available
	// Entity: k8s_node
	// Label: nodepool / Value (name of nodepool)
	// Label: zone / Value (name of zone)
	// Label: name / Value: (name of addon)
	// Label: version / Value: (version of addon)
	// Label: controller / Value: (DaemonSet or Deployment)
	// Label: available / Value (True/False)
	// Label: node_available / Value (True/False)
	// Label: running / Value: (True/False)
	// Label: stable / Value: (True/False)
	// Label: healthy / Value: (True/False/Unknown/Error)
	// Value: 1
	RecordAddonAvailabilies(ctx context.Context, counts []LabelCount)

	// addon/restart
	// Entity: k8s_node
	// Label: nodepool / Value (name of nodepool)
	// Label: zone / Value (name of zone)
	// Label: name / Value: (name of addon)
	// Label: version / Value: (version of addon)
	// Label: controller / Value: (DaemonSet or Deployment)
	// Label: container_name / Value: (name of container in pod)
	// Label: reason / Value: (reason for restart)
	// Label: exit_code / Value: (exit code)
	// Value: 1
	RecordContainerRestart(ctx context.Context, labels map[string]string)

	// addon/control_plane_available
	// Entity: k8s_node
	// Label: nodepool / Value (name of nodepool)
	// Label: zone / Value (name of zone)
	// Label: available / Value (True/False)
	// Value: 1
	RecordAddonControlPlaneAvailability(ctx context.Context, labels map[string]string)

	// node/node_condition
	// Entity: k8s_node
	// Label: nodepool / Value (name of nodepool)
	// Label: zone / Value (name of zone)
	// Label: type / Values: (set of conditions)
	// Label: status / Values: (True/False/Unknown)
	// Value: 1
	RecordNodeConditions(ctx context.Context, labels []map[string]string)

	// node/available
	// Entity: k8s_node
	// Label: nodepool / Value (name of nodepool)
	// Label: zone / Value (name of zone)
	// Label: available / Value (True/False)
	// Label: ready / Value (True/False)
	// Label: scheduleable / Value (True/False)
	// Label: done_warming / Value (True/False)
	// Value: 1
	RecordNodeAvailability(ctx context.Context, labels map[string]string)
}

type ProbeRecorder

type ProbeRecorder interface {
	RecordDNSLookupLatency(elapsed time.Duration)
	RecordHTTPGetLatency(statusCode int, elapsed time.Duration)

	// cluster/probe/addon
	// Entity: k8s_cluster
	// Label: name / Value: (name of addon)
	// Label: condition / Value: (Healthy/Unhealthy)
	// Label: reason / Value: Err messages
	// Value: 1
	RecordAddonHealth(ctx context.Context, labels []map[string]string)
}

type Provider

type Provider interface {
	ClusterRecorder() ClusterRecorder
	NodeRecorder() NodeRecorder
	ProbeRecorder() ProbeRecorder
	Close() error
}

Jump to

Keyboard shortcuts

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