spd

package
v0.3.9 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	PerformanceLevelUnknown PerformanceLevel = -1
	PerformanceLevelPerfect PerformanceLevel = 0
	PerformanceLevelGood    PerformanceLevel = 1
	PerformanceLevelPoor    PerformanceLevel = 2

	MaxPerformanceScore float64 = 100
	MinPerformanceScore float64 = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Cache is spd cache stores current

func NewSPDCache

func NewSPDCache(manager checkpointmanager.CheckpointManager, expiredTime time.Duration) *Cache

func (*Cache) DeleteSPD

func (s *Cache) DeleteSPD(key string) error

DeleteSPD delete target spd by namespace/name key

func (*Cache) GetLastFetchRemoteTime

func (s *Cache) GetLastFetchRemoteTime(key string) time.Time

GetLastFetchRemoteTime get last fetch remote spd timestamp

func (*Cache) GetSPD

GetSPD gets target spd by namespace/name key

func (*Cache) Run

func (s *Cache) Run(ctx context.Context)

Run to clear local unused spd

func (*Cache) SetLastFetchRemoteTime

func (s *Cache) SetLastFetchRemoteTime(key string, t time.Time)

SetLastFetchRemoteTime set last fetch remote spd timestamp

func (*Cache) SetSPD

SetSPD set target spd to cache and checkpoint

type DummyPodServiceProfile

type DummyPodServiceProfile struct {
	PerformanceLevel PerformanceLevel
	Score            float64
}

type DummyServiceProfilingManager

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

func NewDummyServiceProfilingManager

func NewDummyServiceProfilingManager(podProfiles map[types.UID]DummyPodServiceProfile) *DummyServiceProfilingManager

func (*DummyServiceProfilingManager) Run

func (*DummyServiceProfilingManager) ServiceBusinessPerformanceLevel

func (d *DummyServiceProfilingManager) ServiceBusinessPerformanceLevel(_ context.Context, pod *v1.Pod) (PerformanceLevel, error)

func (*DummyServiceProfilingManager) ServiceBusinessPerformanceScore

func (d *DummyServiceProfilingManager) ServiceBusinessPerformanceScore(_ context.Context, pod *v1.Pod) (float64, error)

func (*DummyServiceProfilingManager) ServiceSystemPerformanceTarget

func (d *DummyServiceProfilingManager) ServiceSystemPerformanceTarget(_ context.Context, _ *v1.Pod) (IndicatorTarget, error)

type GetPodSPDNameFunc

type GetPodSPDNameFunc func(pod *v1.Pod) (string, error)

type IndicatorTarget

type IndicatorTarget map[string]util.IndicatorTarget

type PerformanceLevel

type PerformanceLevel int

PerformanceLevel is an enumeration type, the smaller the positive value, the better the performance

type SPDFetcher

type SPDFetcher interface {
	// GetSPD get spd for given pod
	GetSPD(ctx context.Context, pod *v1.Pod) (*workloadapis.ServiceProfileDescriptor, error)

	// Run async loop to clear unused spd
	Run(ctx context.Context)
}

func NewSPDFetcher

func NewSPDFetcher(clientSet *client.GenericClientSet, emitter metrics.MetricEmitter,
	cncFetcher cnc.CNCFetcher, conf *pkgconfig.Configuration) (SPDFetcher, error)

NewSPDFetcher creates a spd manager to implement SPDFetcher

type ServiceProfilingManager

type ServiceProfilingManager interface {
	// ServiceBusinessPerformanceLevel returns the service business performance level for the given pod
	ServiceBusinessPerformanceLevel(ctx context.Context, pod *v1.Pod) (PerformanceLevel, error)

	// ServiceBusinessPerformanceScore returns the service business performance score for the given pod
	// The score is in range [MinPerformanceScore, MaxPerformanceScore]
	ServiceBusinessPerformanceScore(ctx context.Context, pod *v1.Pod) (float64, error)

	// ServiceSystemPerformanceTarget returns the system performance target for the given pod
	ServiceSystemPerformanceTarget(ctx context.Context, pod *v1.Pod) (IndicatorTarget, error)

	// Run starts the service profiling manager
	Run(ctx context.Context)
}

func NewServiceProfilingManager

func NewServiceProfilingManager(fetcher SPDFetcher) ServiceProfilingManager

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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