Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateNodeAllKey(cluster string) string
- func GenerateNodeallAllKey(orgName string) string
- func GeneratePodAllKey(cluster string) string
- func GetAllCache(key string) map[string]*MetricsData
- func SetCache(k string, d interface{})
- type Basic
- type Interface
- type Key
- type Metric
- func (m *Metric) NodeAllMetrics(ctx context.Context, req *MetricsRequest) (map[string]*MetricsData, error)
- func (m *Metric) NodeMetrics(ctx context.Context, req *MetricsRequest) (map[string]*MetricsData, error)
- func (m *Metric) PodMetrics(ctx context.Context, req *MetricsRequest) (map[string]*MetricsData, error)
- func (m *Metric) Store(response *pb.QueryWithInfluxFormatResponse, metricsRequest *MetricsReq) map[string]*MetricsData
- func (m *Metric) ToInfluxReq(request *MetricsRequest, reqKind string) ([]*MetricsReq, map[string]*MetricsData, error)
- type MetricsAllRequest
- func (m *MetricsAllRequest) CacheKey() string
- func (m *MetricsAllRequest) ClusterName() string
- func (m *MetricsAllRequest) IP() string
- func (m *MetricsAllRequest) Namespace() string
- func (m *MetricsAllRequest) OrgName() string
- func (m *MetricsAllRequest) PodName() string
- func (m *MetricsAllRequest) ResourceKind() string
- func (m *MetricsAllRequest) ResourceType() string
- func (m *MetricsAllRequest) UserID() string
- type MetricsData
- type MetricsNodeRequest
- func (m *MetricsNodeRequest) CacheKey() string
- func (m *MetricsNodeRequest) ClusterName() string
- func (m *MetricsNodeRequest) IP() string
- func (m *MetricsNodeRequest) Namespace() string
- func (m *MetricsNodeRequest) OrgName() string
- func (m *MetricsNodeRequest) PodName() string
- func (m *MetricsNodeRequest) ResourceKind() string
- func (m *MetricsNodeRequest) ResourceType() string
- func (m *MetricsNodeRequest) UserID() string
- type MetricsPodRequest
- func (m MetricsPodRequest) CacheKey() string
- func (m *MetricsPodRequest) ClusterName() string
- func (m MetricsPodRequest) IP() string
- func (m *MetricsPodRequest) Namespace() string
- func (m *MetricsPodRequest) PodName() string
- func (m *MetricsPodRequest) ResourceKind() string
- func (m *MetricsPodRequest) ResourceType() string
- type MetricsReq
- type MetricsReqInterface
- type MetricsRequest
- type NodeMetrics
- type PodMetrics
- type ResourceType
Constants ¶
View Source
const ( // SELECT host_ip::tag, mem_used::field FROM host_summary WHERE cluster_name::tag=$cluster_name // usage rate , distribution rate , usage percent of distribution //NodeCpuUsageSelectStatement = `SELECT last(cpu_cores_usage::field) FROM host_summary WHERE cluster_name::tag=$cluster_name AND host_ip::tag=$host_ip ` NodeResourceUsageSelectStatement = `` /* 187-byte string literal not displayed */ //NodeResourceUsageSelectStatement = `SELECT mem_usage::field ,cpu_cores_usage::field, host_ip FROM host_summary WHERE cluster_name::tag=$cluster_name GROUP BY host_ip::tag` //PodCpuUsageSelectStatement = `SELECT SUM(cpu_allocation::field) * 100 / SUM(cpu_limit::field) as cpuRate, pod_name FROM docker_container_summary WHERE pod_namespace::tag=$pod_namespace and podsandbox != true GROUP BY pod_name::tag` PodResourceUsageSelectStatement = `` /* 359-byte string literal not displayed */ DiskResourceUsageSelectStatement = `` /* 138-byte string literal not displayed */ Memory = "memory" Cpu = "cpu" Disk = "disk" NodeAll = "nodeall" // cpu + disk + memory Pod = "pod" Node = "node" )
Variables ¶
Functions ¶
func GenerateNodeAllKey ¶
func GenerateNodeallAllKey ¶
func GeneratePodAllKey ¶
func GetAllCache ¶
func GetAllCache(key string) map[string]*MetricsData
Types ¶
type Interface ¶
type Interface interface { NodeMetrics(ctx context.Context, req *MetricsRequest) (map[string]*MetricsData, error) PodMetrics(ctx context.Context, req *MetricsRequest) (map[string]*MetricsData, error) NodeAllMetrics(ctx context.Context, req *MetricsRequest) (map[string]*MetricsData, error) }
type Metric ¶
type Metric struct { Metricq pb.MetricServiceServer // contains filtered or unexported fields }
func (*Metric) NodeAllMetrics ¶
func (m *Metric) NodeAllMetrics(ctx context.Context, req *MetricsRequest) (map[string]*MetricsData, error)
func (*Metric) NodeMetrics ¶
func (m *Metric) NodeMetrics(ctx context.Context, req *MetricsRequest) (map[string]*MetricsData, error)
NodeMetrics query cpu and memory metrics from es database, return immediately if cache hit.
func (*Metric) PodMetrics ¶
func (m *Metric) PodMetrics(ctx context.Context, req *MetricsRequest) (map[string]*MetricsData, error)
func (*Metric) Store ¶
func (m *Metric) Store(response *pb.QueryWithInfluxFormatResponse, metricsRequest *MetricsReq) map[string]*MetricsData
func (*Metric) ToInfluxReq ¶
func (m *Metric) ToInfluxReq(request *MetricsRequest, reqKind string) ([]*MetricsReq, map[string]*MetricsData, error)
type MetricsAllRequest ¶
type MetricsAllRequest struct {
*MetricsRequest
}
func (*MetricsAllRequest) CacheKey ¶
func (m *MetricsAllRequest) CacheKey() string
func (*MetricsAllRequest) ClusterName ¶
func (m *MetricsAllRequest) ClusterName() string
func (*MetricsAllRequest) IP ¶
func (m *MetricsAllRequest) IP() string
func (*MetricsAllRequest) Namespace ¶
func (m *MetricsAllRequest) Namespace() string
func (*MetricsAllRequest) OrgName ¶
func (m *MetricsAllRequest) OrgName() string
func (*MetricsAllRequest) PodName ¶
func (m *MetricsAllRequest) PodName() string
func (*MetricsAllRequest) ResourceKind ¶
func (m *MetricsAllRequest) ResourceKind() string
func (*MetricsAllRequest) ResourceType ¶
func (m *MetricsAllRequest) ResourceType() string
func (*MetricsAllRequest) UserID ¶
func (m *MetricsAllRequest) UserID() string
type MetricsData ¶
type MetricsData struct { // if qurey pod resource, used means usedPercent. request and total are useless. Used float64 `json:"used"` Unallocate float64 `json:"unallocate"` Left float64 `json:"left"` }
func GetCache ¶
func GetCache(key string) *MetricsData
type MetricsNodeRequest ¶
type MetricsNodeRequest struct { *MetricsRequest Ip string }
func (*MetricsNodeRequest) CacheKey ¶
func (m *MetricsNodeRequest) CacheKey() string
func (*MetricsNodeRequest) ClusterName ¶
func (m *MetricsNodeRequest) ClusterName() string
func (*MetricsNodeRequest) IP ¶
func (m *MetricsNodeRequest) IP() string
func (*MetricsNodeRequest) Namespace ¶
func (m *MetricsNodeRequest) Namespace() string
func (*MetricsNodeRequest) OrgName ¶
func (m *MetricsNodeRequest) OrgName() string
func (*MetricsNodeRequest) PodName ¶
func (m *MetricsNodeRequest) PodName() string
func (*MetricsNodeRequest) ResourceKind ¶
func (m *MetricsNodeRequest) ResourceKind() string
func (*MetricsNodeRequest) ResourceType ¶
func (m *MetricsNodeRequest) ResourceType() string
func (*MetricsNodeRequest) UserID ¶
func (m *MetricsNodeRequest) UserID() string
type MetricsPodRequest ¶
type MetricsPodRequest struct { *MetricsRequest Name string PodNamespace string }
func (MetricsPodRequest) CacheKey ¶
func (m MetricsPodRequest) CacheKey() string
func (*MetricsPodRequest) ClusterName ¶
func (m *MetricsPodRequest) ClusterName() string
func (MetricsPodRequest) IP ¶
func (m MetricsPodRequest) IP() string
func (*MetricsPodRequest) Namespace ¶
func (m *MetricsPodRequest) Namespace() string
func (*MetricsPodRequest) PodName ¶
func (m *MetricsPodRequest) PodName() string
func (*MetricsPodRequest) ResourceKind ¶
func (m *MetricsPodRequest) ResourceKind() string
func (*MetricsPodRequest) ResourceType ¶
func (m *MetricsPodRequest) ResourceType() string
type MetricsReq ¶
type MetricsReq struct {
// contains filtered or unexported fields
}
type MetricsReqInterface ¶
type MetricsReqInterface interface { Key PodMetrics NodeMetrics }
type MetricsRequest ¶
type MetricsRequest struct { UserId string OrgId string OrganizationName string Cluster string Type string Kind string PodRequests []MetricsReqInterface NodeRequests []MetricsReqInterface AllRequests []MetricsReqInterface }
func (MetricsRequest) ClusterName ¶
func (m MetricsRequest) ClusterName() string
func (MetricsRequest) OrgName ¶
func (m MetricsRequest) OrgName() string
func (MetricsRequest) ResourceKind ¶
func (m MetricsRequest) ResourceKind() string
func (MetricsRequest) ResourceType ¶
func (m MetricsRequest) ResourceType() string
func (MetricsRequest) UserID ¶
func (m MetricsRequest) UserID() string
type NodeMetrics ¶
type PodMetrics ¶
type ResourceType ¶
type ResourceType string
Click to show internal directories.
Click to hide internal directories.