resource_portrait

package
v0.5.12 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResourcePortraitExtendedSpecName = "ResourcePortrait"
	ResourcePortraitPluginName       = "ResourcePortraitIndicatorPlugin"
)
View Source
const (
	ResourcePortraitMethodPredict = "predict"
)

Variables

View Source
var PresetWorkloadMetricQueryMapping = map[string]string{
	"cpu_utilization_cfs_throttled_seconds": "sum(rate(container_cpu_cfs_throttled_seconds_total{namespace=\"%s\",pod=~\"%s\",container!=\"\"}[%s]))",
	"cpu_utilization_user_seconds":          "sum(rate(container_cpu_user_seconds_total{namespace=\"%s\",pod=~\"%s\",container!=\"\"}[%s]))",
	"cpu_utilization_system_seconds":        "sum(rate(container_cpu_system_seconds_total{namespace=\"%s\",pod=~\"%s\",container!=\"\"}[%s]))",
	"cpu_utilization_usage_seconds":         "sum(rate(container_cpu_usage_seconds_total{namespace=\"%s\",pod=~\"%s\",container!=\"\"}[%s]))",
	"cpu_utilization_usage_seconds_avg":     "avg(rate(container_cpu_usage_seconds_total{namespace=\"%s\",pod=~\"%s\",container!=\"\"}[%s]))",
	"cpu_utilization_usage_seconds_max":     "max(rate(container_cpu_usage_seconds_total{namespace=\"%s\",pod=~\"%s\",container!=\"\"}[%s]))",
	"cpu_utilization":                       "sum(rate(container_cpu_usage_seconds_total{namespace=\"%s\",pod=~\"%s\",container!=\"\"}[%s]))",
	"memory_utilization":                    "sum(container_memory_working_set_bytes{namespace=\"%s\",pod=~\"%s\", container!=\"\"})",
	"memory_utilization_avg":                "avg(container_memory_working_set_bytes{namespace=\"%s\",pod=~\"%s\", container!=\"\"})",
	"memory_utilization_max":                "max(container_memory_working_set_bytes{namespace=\"%s\",pod=~\"%s\", container!=\"\"})",
	"network_packets_receive_packets":       "sum(rate(container_network_receive_packets_total{namespace=\"%s\",pod=~\"%s\",container!=\"\"}[%s]))",
	"network_packets_receive_dropped":       "sum(rate(container_network_receive_packets_dropped_total{namespace=\"%s\",pod=~\"%s\",container!=\"\"}[%s]))",
	"network_packets_receive_errors":        "sum(rate(container_network_receive_errors_total{namespace=\"%s\",pod=~\"%s\",container!=\"\"}[%s]))",
	"network_packets_transmit_packets":      "sum(rate(container_network_transmit_packets_total{namespace=\"%s\",pod=~\"%s\",container!=\"\"}[%s]))",
	"network_packets_transmit_dropped":      "sum(rate(container_network_transmit_packets_dropped_total{namespace=\"%s\",pod=~\"%s\",container!=\"\"}[%s]))",
	"network_packets_transmit_errors":       "sum(rate(container_network_transmit_errors_total{namespace=\"%s\",pod=~\"%s\",container!=\"\"}[%s]))",
	"network_io_receive":                    "sum(rate(container_network_receive_bytes_total{namespace=\"%s\",pod=~\"%s\",container!=\"\"}[%s]))",
	"network_io_transmit":                   "sum(rate(container_network_transmit_bytes_total{namespace=\"%s\",pod=~\"%s\",container!=\"\"}[%s]))",
	"disk_io_read":                          "sum(rate(container_fs_reads_bytes_total{namespace=\"%s\",pod=~\"%s\",container!=\"\"}[%s]))",
	"disk_io_write":                         "sum(rate(container_fs_writes_bytes_total{namespace=\"%s\",pod=~\"%s\",container!=\"\"}[%s]))",
}

Functions

func GenerateFakeContainerName added in v0.5.6

func GenerateFakeContainerName(source, method string) string

GenerateFakeContainerName generates fake container name for resource portrait

func RegisterDataSourceClientInitFunc added in v0.5.6

func RegisterDataSourceClientInitFunc(name string, f func(conf interface{}) (DataSourceClient, error))

func ResourcePortraitIndicatorPluginInitFunc

func ResourcePortraitIndicatorPluginInitFunc(ctx context.Context, conf *controller.SPDConfig, _ interface{},
	spdWorkloadInformer map[schema.GroupVersionResource]native.DynamicInformer,
	controlCtx *katalystbase.GenericContext, updater indicatorplugin.IndicatorUpdater,
) (indicatorplugin.IndicatorPlugin, error)

Types

type AlgorithmProvider

type AlgorithmProvider interface {
	Method() string
	SetConfig(cfg map[string]string)
	SetMetrics(metrics map[string][]model.SamplePair)

	// Call is used to call an external algorithm provider and return algorithm analysis data.
	// The first return value represents time series data, the second return value is used to
	// represent unstructured data, recorded in a form similar to tag=float/int/enum.
	Call() (map[string][]timeSeriesItem, map[string]float64, error)
}

func NewAlgorithmProvider

func NewAlgorithmProvider(addr, algorithmType string) (AlgorithmProvider, error)

type DataSourceClient added in v0.5.6

type DataSourceClient interface {
	Query(workloadName, workloadNamespace string, config *apiconfig.ResourcePortraitConfig) map[string][]model.SamplePair
}

func NewDataSourceClient added in v0.5.6

func NewDataSourceClient(name string, conf interface{}) (DataSourceClient, error)

type ResourcePortraitIndicatorPlugin

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

func (*ResourcePortraitIndicatorPlugin) GetAggMetrics added in v0.5.7

func (*ResourcePortraitIndicatorPlugin) GetSupportedAggMetricsStatus

func (p *ResourcePortraitIndicatorPlugin) GetSupportedAggMetricsStatus() []string

func (*ResourcePortraitIndicatorPlugin) GetSupportedBusinessIndicatorSpec

func (p *ResourcePortraitIndicatorPlugin) GetSupportedBusinessIndicatorSpec() []apiworkload.ServiceBusinessIndicatorName

func (*ResourcePortraitIndicatorPlugin) GetSupportedBusinessIndicatorStatus

func (p *ResourcePortraitIndicatorPlugin) GetSupportedBusinessIndicatorStatus() []apiworkload.ServiceBusinessIndicatorName

func (*ResourcePortraitIndicatorPlugin) GetSupportedExtendedIndicatorSpec

func (p *ResourcePortraitIndicatorPlugin) GetSupportedExtendedIndicatorSpec() []string

func (*ResourcePortraitIndicatorPlugin) GetSupportedSystemIndicatorSpec

func (p *ResourcePortraitIndicatorPlugin) GetSupportedSystemIndicatorSpec() []apiworkload.ServiceSystemIndicatorName

func (*ResourcePortraitIndicatorPlugin) Name

func (*ResourcePortraitIndicatorPlugin) Run

Jump to

Keyboard shortcuts

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