slo

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PVCScheduleDelay         = "PVCScheduleDelay"         // PVC调度导致的调度延迟
	PreemptionDelay          = "PreemptionDelay"          // 抢占调度
	ScheduleDelay            = "ScheduleDelay"            // 调度延迟
	ResourceNotEnough        = "ResourceNotEnough"        // 因为资源不足导致的调度耗时过长
	PullImageTooMuchTime     = "PullImageTooMuchTime"     // 拉取镜像超时或者耗时过长
	KMPullImageTooMuchTime   = "KMPullImageTooMuchTime"   // kubemaker 拉取镜像超时或者耗时过长
	DMPullImageTooMuchTime   = "DMPullImageTooMuchTime"   // 采用device mapper 导致镜像拉取超时或者耗时过长
	PostStartHookTooMuchTime = "PostStartHookTooMuchTime" // PostStartHook 耗时过长
	InvalidMountConfig       = "InvalidMountConfig"       // 挂载配置非法,用户侧错误
	CREATE_RESULT_SUCCESS    = "success"                  // 创建成功

	NoEvent             = "NoEvent" // 没有event,分析不出原因
	FailedPostStartHook = "FailedPostStartHook"
	KubeletDelay        = "KubeletDelay" //kubelet节点处理慢

	SERVICE_POD_TIMEOUT_TIME = 480 * time.Second // 在线服务类Pod超时时间
	JOB_POD_TIMEOUT_TIME     = 90 * time.Second  // Job类Pod超时时间
)
View Source
const (
	TIMEOUT        = "timeout"
	SUCCESS        = "success"
	CNIALLOC       = "cnialloc"
	FINISH         = "finish"
	KUBEKILLINGPOD = "killingpod"

	DeleteMileStoneType              = "delete"
	StaleDeletionMileStoneType       = "stale" // stale means pod deletion duration in 10min to 24h
	TerminatingDeletionMileStoneType = "terminating"

	PodDeleteTimeoutPeriod      = time.Minute * 10
	PodStaleTimeoutPeriod       = time.Hour * 1  // an hour
	PodTerminatingTimeoutPeriud = time.Hour * 24 // a day
)
View Source
const (
	UPGRADE_TIMEOUT             = "timeout"
	UPGRADE_SUCCESS             = "success"
	UPGRADE_BEFOREFINISH        = "beforeFinish"
	UPGRADE_FAILED              = "failed"
	UPGRADE_RUN_CONTAINER_ERROR = "RunContainerError"
)
View Source
const (
	PVC_CREATE_TIMEOUT = "timeout"
	PVC_CREATE_SUCCESS = "success"
)
View Source
const (

	//action type
	RequestCreate  = "RequestCreate"
	RequestUpgrade = "RequestUpgrade"
	RequestStart   = "RequestStart"
	RequestStop    = "RequestStop"
	RequestDelete  = "RequestDelete"
)
View Source
const (
	POD_UPGRADE = "pod_upgrade"
	POD_DELETE  = "pod_delete"
	POD_CREATE  = "pod_create"
	PVC_CREATE  = "pvc_create"
)

Variables

View Source
var (
	Queue       *queue.BoundedQueue
	ClusterName string
)
View Source
var (
	PodDeleteMileStoneMap *utils.SafeMap // podKey -> podDeleteMileStone

)

Functions

func DeliveryTimeCalc

func DeliveryTimeCalc(podSpans SpanSlice, currentTime time.Time) time.Duration

func DeliveryTimeCalcNew

func DeliveryTimeCalcNew(podSpans SpanSlicePtr, currentTime time.Time, uid types.UID) time.Duration

func ReorgSpansNew

func ReorgSpansNew(podSpans SpanSlicePtr, currentTime time.Time) (SpanSlicePtr, SpanSlicePtr, time.Duration)

Types

type ESReader

type ESReader interface {
	// eareader read k8s audit event, then send to consumer queue
	SetConsumer(int, *queue.BoundedQueue)
	// starts to read audit events from es
	Run(<-chan struct{})
	// return a chan implies whether reader has done its job
	WaitChan() <-chan struct{}
	// get total processed item
	GetProcessed() int64
}

es reader for unit test

func NewESReader

func NewESReader() (ESReader, error)

type PersistentVolumeClaimMileStone

type PersistentVolumeClaimMileStone struct {
	Type            string
	Cluster         string
	Namespace       string
	PVCName         string
	PVCUID          string
	TriggerAuditLog string
	CreateResult    string
	CreatedTime     time.Time
	TimeoutTime     time.Time
	// contains filtered or unexported fields
}

type PodCache

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

func (*PodCache) RecordPod

func (c *PodCache) RecordPod(ms *xsearch.PodDeleteMileStone, tm time.Time)

func (*PodCache) SeenPod

func (c *PodCache) SeenPod(ms *xsearch.PodDeleteMileStone) bool

true if pod has processed, false if pod is the first time seen

type PodEvent

type PodEvent struct {
	Pod   *v1.Pod
	Event *shares.AuditEvent
}

PodEvent is Pod and Event struct

type PodStartupMilestones

type PodStartupMilestones struct {
	Cluster                       string
	InitImage                     string
	Namespace                     string
	PodName                       string
	PodUID                        string
	Type                          string
	NodeIP                        string
	NodeName                      string // in some cases, when a pod is scheduled to a specified node, but kubelet doesn't post any pod status to apiserver, nodeIP is empty, but we do want know which node is not working properly.
	DebugUrl                      string
	OwnerRefStr                   string
	SchedulingStrategy            string
	StartUpResultFromCreate       string
	StartUpResultFromSchedule     string
	IsJob                         bool
	Cores                         int64
	WrittenToZsearch              bool
	Finished                      bool
	StopInterEvents               bool      //停止接受新的event
	Created                       time.Time //创建开始时间
	CreatedTime                   time.Time //创建开始时间
	FinishTime                    time.Time
	ActualFinishTimeAfterSchedule time.Time
	ActualFinishTimeAfterCreate   time.Time
	Scheduled                     time.Time //调度时间
	PodInitializedTime            time.Time
	ContainersReady               time.Time
	RunningAt                     time.Time
	SucceedAt                     time.Time
	FailedAt                      time.Time
	ReadyAt                       time.Time
	DeletedTime                   time.Time
	InitStartTime                 time.Time
	ImageNameToPullTime           map[string]float64 //每个镜像拉取的时间
	PossibleReason                *string            //创建失败或超时时针对未知原因附加说明(timeout_unknown和kubeletDelay)
	// SLO 越界推理
	SLOViolationReason  string
	PodSLO              int64
	DeliverySLO         int64
	DeliverySLOAdjusted bool
	DeliveryDuration    time.Duration
	DeliveryStatus      string
	DeliveryStatusOrig  string
	SloHint             string // why current slo class
	// contains filtered or unexported fields
}

PodStartupMilestones keeps all milestone timestamps from Pod creation.

func (*PodStartupMilestones) GetFinishTime

func (data *PodStartupMilestones) GetFinishTime() time.Time

func (*PodStartupMilestones) IsComplete

func (data *PodStartupMilestones) IsComplete() bool

IsComplete returns true is data is complete (ready to be included in the metric) and if it haven't been included in the metric yet.

type PodUpgradeMileStone

type PodUpgradeMileStone struct {
	Cluster              string
	Namespace            string
	PodName              string
	PodUID               string
	Type                 string
	TriggerAuditLog      string
	UpgradeResult        string
	UpgradeContainerName string
	UpdateStatus         string
	NodeIP               string
	CreatedTime          time.Time //开始升级时间
	UpgradeEndTime       time.Time
	UpgradeTimeoutTime   time.Time
	DebugUrl             string
	// contains filtered or unexported fields
}

pod升级SLO相关

type RequestAction

type RequestAction struct {
	ActionType string   `json:"action-type,omitempty"`
	Containers []string `json:"containers,omitempty"`
	Timestamp  string   `json:"timestamp,omitempty"`
}

type SimpleZSearchReader

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

SimpleZSearchReader read from readonly index, and produce audit events to target queue.

func (*SimpleZSearchReader) GetProcessed

func (r *SimpleZSearchReader) GetProcessed() int64

func (*SimpleZSearchReader) Run

func (r *SimpleZSearchReader) Run(stop <-chan struct{})

func (*SimpleZSearchReader) SetConsumer

func (r *SimpleZSearchReader) SetConsumer(num int, cq *queue.BoundedQueue)

func (*SimpleZSearchReader) WaitChan

func (r *SimpleZSearchReader) WaitChan() <-chan struct{}

type SpanSlice

type SpanSlice []spans.Span

func ReorgSpans

func ReorgSpans(podSpans SpanSlice) (open, customopen bool, lastclose, firstopenspanbeg time.Time, dspans SpanSlice)

func (SpanSlice) Len

func (s SpanSlice) Len() int

func (SpanSlice) Less

func (s SpanSlice) Less(i, j int) bool

func (SpanSlice) Swap

func (s SpanSlice) Swap(i, j int)

type SpanSlicePtr

type SpanSlicePtr []*spans.Span

func (SpanSlicePtr) Len

func (s SpanSlicePtr) Len() int

func (SpanSlicePtr) Less

func (s SpanSlicePtr) Less(i, j int) bool

func (SpanSlicePtr) Swap

func (s SpanSlicePtr) Swap(i, j int)

Jump to

Keyboard shortcuts

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