metrics

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KindPod is the cost reference to the Kubernetes Pod object.
	KindPod = "Pod"
	// KindDeployment is the cost reference to the Kubernetes Deployment object.
	KindDeployment = "Deployment"
	// KindReplicaSet is the cost reference to the Kubernetes ReplicaSet object.
	KindReplicaSet = "ReplicaSet"
	// KindStatefulSet is the cost reference to the Kubernetes StatefulSet object.
	KindStatefulSet = "StatefulSet"
	// KindCronJob is the cost reference to the Kubernetes CronJob object.
	KindCronJob = "CronJob"
	// KindJob is the cost reference to the Kubernetes Job object.
	KindJob = "Job"

	// StateReady is the const representing the state for an object being Ready
	StateReady = string(corev1.PodReady)
	// StateNotReady is the const representing the state for an object not being Ready
	StateNotReady = string(corev1.PodPending)
	// StateSuspended is the const representing the state for a CronJob being Suspended
	StateSuspended = string(batchv1.JobSuspended)
	// StateActive is the const representing the state for a CronJob being not Suspended
	StateActive = string(corev1.PodRunning)
	// StateFailed is the const representing the state for an object having been Failed
	StateFailed = string(batchv1.JobFailed)
	// StateSucceeded is the const representing the state for an object having been completed successfully
	StateSucceeded = string(batchv1.JobComplete)
)

Variables

This section is empty.

Functions

func CollectCronJobs added in v0.0.11

func CollectCronJobs(cronjobs []batchv1.CronJob) (*MetricSet, StateSet)

CollectCronJobs will collect ze metrics for cronjobs.

func CollectDeployments added in v0.0.11

func CollectDeployments(deployments []appsv1.Deployment) (*MetricSet, StateSet)

CollectDeployments will collect ze metrics for deployments.

func CollectJobs added in v0.0.11

func CollectJobs(jobs []batchv1.Job) (*MetricSet, StateSet)

CollectJobs will collect ze metrics for jobs.

func CollectPods added in v0.0.11

func CollectPods(pods []corev1.Pod) (*MetricSet, StateSet)

CollectPods will collect ze metrics for pods.

func CollectReplicaSets added in v0.0.11

func CollectReplicaSets(replicasets []appsv1.ReplicaSet) (*MetricSet, StateSet)

CollectReplicaSets will collect ze metrics for replicasets.

func CollectStatefulSets added in v0.0.11

func CollectStatefulSets(statefulsets []appsv1.StatefulSet) (*MetricSet, StateSet)

CollectStatefulSets will collect ze metrics for statefulsets.

func ConvertToMetricData added in v0.0.10

func ConvertToMetricData(timestamp time.Time, cluster string, states StateSet) []awstypes.MetricDatum

ConvertToMetricData converts our metrics to aws metric data.

func Log added in v0.0.8

func Log(writer io.Writer, metrics *MetricSet) error

Log logs the metrics to the writer.

Types

type Metric

type Metric struct {
	Name   string            `json:"name"`
	Value  int               `json:"value"`
	Type   string            `json:"type"`
	Labels map[string]string `json:"labels"`
}

Metric represents an individual metric.

type MetricSet

type MetricSet struct {
	Items map[string]*Metric
}

MetricSet is the metric set.

func CombineRecords added in v0.0.11

func CombineRecords(recordsInput *MetricSet, recordsAppend *MetricSet) *MetricSet

CombineRecords will combine two metric sets.

func NewMetricSet

func NewMetricSet() *MetricSet

NewMetricSet creates a new metric set.

func (*MetricSet) Increment

func (s *MetricSet) Increment(kind, namespace string, phase string)

Increment the metric.

type Pusher added in v0.0.10

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

Pusher the metrics pusher.

func NewPusher added in v0.0.10

func NewPusher(cloudwatchClient types.CloudwatchInterface) *Pusher

NewPusher creates a new metrics pusher.

func (*Pusher) Push added in v0.0.10

func (p *Pusher) Push(ctx context.Context, namespace string, metricData []awstypes.MetricDatum) error

Push the metrics.

type StateSet added in v0.0.11

type StateSet map[string]map[string]int

StateSet is the state of the metrics. ie Pod Phase, Deployment Status or CronJob Suspended state.

func CombineStates added in v0.0.11

func CombineStates(input *StateSet, og *StateSet) StateSet

CombineStates will combine two state sets.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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