query

package
v0.0.0-...-faa1211 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package query metric query

Index

Constants

View Source
const (
	// PROVIDER provider
	PROVIDER = `provider="BCS_SYSTEM"`
)

Variables

This section is empty.

Functions

func GetMasterNodeMatch

func GetMasterNodeMatch(ctx context.Context, clusterID string) (string, string, error)

GetMasterNodeMatch 按集群node节点正则匹配

func GetMasterNodeMatchIgnoreErr

func GetMasterNodeMatchIgnoreErr(ctx context.Context, clusterID string) (string, string, bool)

GetMasterNodeMatchIgnoreErr 按集群node节点正则匹配

Types

type BCSMonitorHandler

type BCSMonitorHandler struct {
}

BCSMonitorHandler metric handler

func NewBCSMonitorHandler

func NewBCSMonitorHandler() *BCSMonitorHandler

NewBCSMonitorHandler new handler

func (BCSMonitorHandler) ClusterCPURequestUsage

func (BCSMonitorHandler) ClusterCPURequestUsage(c *rest.Context) (promclient.ResultData, error)

ClusterCPURequestUsage implements Handler.

func (BCSMonitorHandler) ClusterCPUUsage

func (BCSMonitorHandler) ClusterCPUUsage(c *rest.Context) (promclient.ResultData, error)

ClusterCPUUsage implements Handler.

func (BCSMonitorHandler) ClusterDiskUsage

func (BCSMonitorHandler) ClusterDiskUsage(c *rest.Context) (promclient.ResultData, error)

ClusterDiskUsage implements Handler.

func (BCSMonitorHandler) ClusterDiskioUsage

func (BCSMonitorHandler) ClusterDiskioUsage(c *rest.Context) (promclient.ResultData, error)

ClusterDiskioUsage implements Handler.

func (BCSMonitorHandler) ClusterMemoryRequestUsage

func (BCSMonitorHandler) ClusterMemoryRequestUsage(c *rest.Context) (promclient.ResultData, error)

ClusterMemoryRequestUsage implements Handler.

func (BCSMonitorHandler) ClusterMemoryUsage

func (BCSMonitorHandler) ClusterMemoryUsage(c *rest.Context) (promclient.ResultData, error)

ClusterMemoryUsage implements Handler.

func (BCSMonitorHandler) ClusterPodUsage

func (BCSMonitorHandler) ClusterPodUsage(c *rest.Context) (promclient.ResultData, error)

ClusterPodUsage implements Handler.

func (BCSMonitorHandler) GetClusterOverview

func (h BCSMonitorHandler) GetClusterOverview(c *rest.Context) (ClusterOverviewMetric, error)

GetClusterOverview 获取集群概览

type BKMonitorHandler

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

BKMonitorHandler metric handler

func NewBKMonitorHandler

func NewBKMonitorHandler(bkBizID, clusterID string) *BKMonitorHandler

NewBKMonitorHandler new handler

func (BKMonitorHandler) ClusterCPURequestUsage

func (h BKMonitorHandler) ClusterCPURequestUsage(c *rest.Context) (promclient.ResultData, error)

ClusterCPURequestUsage implements Handler. nolint

func (BKMonitorHandler) ClusterCPUUsage

func (h BKMonitorHandler) ClusterCPUUsage(c *rest.Context) (promclient.ResultData, error)

ClusterCPUUsage implements Handler. nolint

func (BKMonitorHandler) ClusterDiskUsage

func (h BKMonitorHandler) ClusterDiskUsage(c *rest.Context) (promclient.ResultData, error)

ClusterDiskUsage implements Handler. nolint

func (BKMonitorHandler) ClusterDiskioUsage

func (h BKMonitorHandler) ClusterDiskioUsage(c *rest.Context) (promclient.ResultData, error)

ClusterDiskioUsage implements Handler. nolint

func (BKMonitorHandler) ClusterMemoryRequestUsage

func (h BKMonitorHandler) ClusterMemoryRequestUsage(c *rest.Context) (promclient.ResultData, error)

ClusterMemoryRequestUsage implements Handler. nolint

func (BKMonitorHandler) ClusterMemoryUsage

func (h BKMonitorHandler) ClusterMemoryUsage(c *rest.Context) (promclient.ResultData, error)

ClusterMemoryUsage implements Handler. nolint

func (BKMonitorHandler) ClusterPodUsage

func (h BKMonitorHandler) ClusterPodUsage(c *rest.Context) (promclient.ResultData, error)

ClusterPodUsage implements Handler. nolint

func (BKMonitorHandler) GetClusterOverview

func (h BKMonitorHandler) GetClusterOverview(c *rest.Context) (ClusterOverviewMetric, error)

GetClusterOverview 获取集群概览 nolint

type ClusterOverviewMetric

type ClusterOverviewMetric struct {
	CPUUsage    *Usage     `json:"cpu_usage"`
	DiskUsage   *UsageByte `json:"disk_usage"`
	MemoryUsage *UsageByte `json:"memory_usage"`
	DiskIOUsage *Usage     `json:"diskio_usage"`
	PodUsage    *Usage     `json:"pod_usage"`
}

ClusterOverviewMetric 集群概览接口

type Config

type Config struct {
	Dispatch []clientutil.DispatchConf `yaml:"dispatch"`
}

Config 配置

type Handler

type Handler interface {
	GetClusterOverview(c *rest.Context) (ClusterOverviewMetric, error)
	ClusterPodUsage(c *rest.Context) (promclient.ResultData, error)
	ClusterCPUUsage(c *rest.Context) (promclient.ResultData, error)
	ClusterCPURequestUsage(c *rest.Context) (promclient.ResultData, error)
	ClusterMemoryUsage(c *rest.Context) (promclient.ResultData, error)
	ClusterMemoryRequestUsage(c *rest.Context) (promclient.ResultData, error)
	ClusterDiskUsage(c *rest.Context) (promclient.ResultData, error)
	ClusterDiskioUsage(c *rest.Context) (promclient.ResultData, error)
}

Handler metric handler

func HandlerFactory

func HandlerFactory(ctx context.Context, clusterID string) (Handler, error)

HandlerFactory 自动切换Prometheus/蓝鲸监控

type Usage

type Usage struct {
	Used    string `json:"used"`
	Request string `json:"request"`
	Total   string `json:"total"`
}

Usage 使用量

type UsageByte

type UsageByte struct {
	UsedByte    string `json:"used_bytes"`
	RequestByte string `json:"request_bytes"`
	TotalByte   string `json:"total_bytes"`
}

UsageByte 使用量, bytes单位

type UsageQuery

type UsageQuery struct {
	StartAt string `json:"start_at" form:"start_at"` // 必填参数`
	EndAt   string `json:"end_at" form:"end_at"`
}

UsageQuery 节点查询

func (*UsageQuery) GetQueryTime

func (q *UsageQuery) GetQueryTime() (*clientutil.PromQueryTime, error)

GetQueryTime 转换为 promql 查询时间

Jump to

Keyboard shortcuts

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