containerinsight

package module
v0.80.0 Latest Latest
Warning

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

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

Documentation

Overview

Copyright The OpenTelemetry Authors SPDX-License-Identifier: Apache-2.0

Copyright The OpenTelemetry Authors SPDX-License-Identifier: Apache-2.0

Copyright The OpenTelemetry Authors SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	GoPSUtilProcDirEnv = "HOST_PROC"

	// We assume 50 micro-seconds is the minimal gap between two collected data sample to be valid to calculate delta
	MinTimeDiff = 50 * time.Microsecond

	// Attribute names
	InstanceID              = "InstanceId"
	InstanceType            = "InstanceType"
	ClusterNameKey          = "ClusterName"
	AutoScalingGroupNameKey = "AutoScalingGroupName"
	NodeNameKey             = "NodeName"
	Version                 = "Version"
	DiskDev                 = "device"
	EbsVolumeID             = "ebs_volume_id" // used by kubernetes cluster as persistent volume
	HostEbsVolumeID         = "EBSVolumeId"   // used by host filesystem
	FSType                  = "fstype"
	MetricType              = "Type"
	SourcesKey              = "Sources"
	Timestamp               = "Timestamp"

	// The following constants are used for metric name construction
	CPUTotal                   = "cpu_usage_total"
	CPUUser                    = "cpu_usage_user"
	CPUSystem                  = "cpu_usage_system"
	CPULimit                   = "cpu_limit"
	CPUUtilization             = "cpu_utilization"
	CPURequest                 = "cpu_request"
	CPUReservedCapacity        = "cpu_reserved_capacity"
	CPUUtilizationOverPodLimit = "cpu_utilization_over_pod_limit"

	MemUsage                   = "memory_usage"
	MemCache                   = "memory_cache"
	MemRss                     = "memory_rss"
	MemMaxusage                = "memory_max_usage"
	MemSwap                    = "memory_swap"
	MemFailcnt                 = "memory_failcnt"
	MemMappedfile              = "memory_mapped_file"
	MemWorkingset              = "memory_working_set"
	MemPgfault                 = "memory_pgfault"
	MemPgmajfault              = "memory_pgmajfault"
	MemHierarchicalPgfault     = "memory_hierarchical_pgfault"
	MemHierarchicalPgmajfault  = "memory_hierarchical_pgmajfault"
	MemLimit                   = "memory_limit"
	MemRequest                 = "memory_request"
	MemUtilization             = "memory_utilization"
	MemReservedCapacity        = "memory_reserved_capacity"
	MemUtilizationOverPodLimit = "memory_utilization_over_pod_limit"

	NetIfce       = "interface"
	NetRxBytes    = "network_rx_bytes"
	NetRxPackets  = "network_rx_packets"
	NetRxDropped  = "network_rx_dropped"
	NetRxErrors   = "network_rx_errors"
	NetTxBytes    = "network_tx_bytes"
	NetTxPackets  = "network_tx_packets"
	NetTxDropped  = "network_tx_dropped"
	NetTxErrors   = "network_tx_errors"
	NetTotalBytes = "network_total_bytes"

	FSUsage       = "filesystem_usage"
	FSCapacity    = "filesystem_capacity"
	FSAvailable   = "filesystem_available"
	FSInodes      = "filesystem_inodes"
	FSInodesfree  = "filesystem_inodes_free"
	FSUtilization = "filesystem_utilization"

	RunningPodCount       = "number_of_running_pods"
	RunningContainerCount = "number_of_running_containers"
	ContainerCount        = "number_of_containers"
	NodeCount             = "node_count"
	FailedNodeCount       = "failed_node_count"
	ContainerRestartCount = "number_of_container_restarts"
	RunningTaskCount      = "number_of_running_tasks"

	DiskIOServiceBytesPrefix = "diskio_io_service_bytes_"
	DiskIOServicedPrefix     = "diskio_io_serviced_"
	DiskIOAsync              = "Async"
	DiskIORead               = "Read"
	DiskIOSync               = "Sync"
	DiskIOWrite              = "Write"
	DiskIOTotal              = "Total"

	// Define the metric types
	TypeCluster          = "Cluster"
	TypeClusterService   = "ClusterService"
	TypeClusterNamespace = "ClusterNamespace"
	TypeService          = "Service"
	TypeInstance         = "Instance" // mean EC2 Instance in ECS
	TypeNode             = "Node"     // mean EC2 Instance in EKS
	TypeInstanceFS       = "InstanceFS"
	TypeNodeFS           = "NodeFS"
	TypeInstanceNet      = "InstanceNet"
	TypeNodeNet          = "NodeNet"
	TypeInstanceDiskIO   = "InstanceDiskIO"
	TypeNodeDiskIO       = "NodeDiskIO"
	TypePod              = "Pod"
	TypePodNet           = "PodNet"
	TypeContainer        = "Container"
	TypeContainerFS      = "ContainerFS"
	TypeContainerDiskIO  = "ContainerDiskIO"
	// Special type for pause container
	// because containerd does not set container name pause container name to POD like docker does.
	TypeInfraContainer = "InfraContainer"

	// unit
	UnitBytes       = "Bytes"
	UnitMegaBytes   = "Megabytes"
	UnitNanoSecond  = "Nanoseconds"
	UnitBytesPerSec = "Bytes/Second"
	UnitCount       = "Count"
	UnitCountPerSec = "Count/Second"
	UnitVCPU        = "vCPU"
	UnitPercent     = "Percent"
)

define metric names, attribute names, metric types, and units for both EKS and ECS Container Insights

View Source
const (
	ContainerInstanceIDKey = "ContainerInstanceId"
	ECS                    = "ecs"
)

define constants that are used for ECS Container Insights only

View Source
const (
	EKS            = "eks"
	KubeSecurePort = "10250"

	// attribute names
	Kubernetes       = "kubernetes"
	K8sNamespace     = "Namespace"
	PodIDKey         = "PodId"
	PodNameKey       = "PodName"
	FullPodNameKey   = "FullPodName"
	K8sPodNameKey    = "K8sPodName"
	ContainerNamekey = "ContainerName"
	ContainerIDkey   = "ContainerId"

	PodStatus       = "pod_status"
	ContainerStatus = "container_status"

	ContainerStatusReason          = "container_status_reason"
	ContainerLastTerminationReason = "container_last_termination_reason"

	// Pod Owners
	ReplicaSet            = "ReplicaSet"
	ReplicationController = "ReplicationController"
	StatefulSet           = "StatefulSet"
	DaemonSet             = "DaemonSet"
	Deployment            = "Deployment"
	Job                   = "Job"
	CronJob               = "CronJob"
)

define constants that are used for EKS Container Insights only

Variables

This section is empty.

Functions

func ConvertToOTLPMetrics

func ConvertToOTLPMetrics(fields map[string]interface{}, tags map[string]string, logger *zap.Logger) pmetric.Metrics

ConvertToOTLPMetrics converts a field containing metric values and a tag containing the relevant labels to OTLP metrics

func GetUnitForMetric

func GetUnitForMetric(metric string) string

GetUnitForMetric returns unit for a given metric

func IsContainer

func IsContainer(mType string) bool

IsContainer checks if a type belongs to container level metrics

func IsInstance

func IsInstance(mType string) bool

IsInstance checks if a type belongs to instance level metrics (for ECS)

func IsNode

func IsNode(mType string) bool

IsNode checks if a type belongs to node level metrics (for EKS)

func IsPod

func IsPod(mType string) bool

IsPod checks if a type belongs to container level metrics

func MetricName

func MetricName(mType string, measurement string) string

MetricName returns the metric name based on metric type and measurement name For example, a type "node" and a measurement "cpu_utilization" gives "node_cpu_utilization"

func RemovePrefix

func RemovePrefix(mType string, metricName string) string

RemovePrefix removes the prefix (e.g. "node_", "pod_") from the metric name

func SumFields

func SumFields(fields []map[string]interface{}) map[string]float64

SumFields takes an array of type map[string]interface{} and do the summation on the values corresponding to the same keys. It is assumed that the underlying type of interface{} to be float64.

Types

This section is empty.

Jump to

Keyboard shortcuts

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