metering

package
v0.0.310 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppStatistic

type AppStatistic struct {
	CPUUsage            float64                          `json:"cpu_usage" description:"cpu_usage"`
	MemoryUsageWoCache  float64                          `json:"memory_usage_wo_cache" description:"memory_usage_wo_cache"`
	NetBytesTransmitted float64                          `json:"net_bytes_transmitted" description:"net_bytes_transmitted"`
	NetBytesReceived    float64                          `json:"net_bytes_received" description:"net_bytes_received"`
	PVCBytesTotal       float64                          `json:"pvc_bytes_total" description:"pvc_bytes_total"`
	Deploys             map[string]*DeploymentStatistic  `json:"deployments" description:"deployment statistic"`
	Statefulsets        map[string]*StatefulsetStatistic `json:"statefulsets" description:"statefulset statistic"`
	Daemonsets          map[string]*DaemonsetStatistic   `json:"daemonsets" description:"daemonsets statistics"`
}

func (*AppStatistic) Aggregate

func (as *AppStatistic) Aggregate()

func (*AppStatistic) GetDaemonStats

func (as *AppStatistic) GetDaemonStats(name string) *DaemonsetStatistic

func (*AppStatistic) GetDeployStats

func (as *AppStatistic) GetDeployStats(name string) *DeploymentStatistic

func (*AppStatistic) GetStatefulsetStats

func (as *AppStatistic) GetStatefulsetStats(name string) *StatefulsetStatistic

type DaemonsetStatistic

type DaemonsetStatistic struct {
	CPUUsage            float64                  `json:"cpu_usage" description:"cpu_usage"`
	MemoryUsageWoCache  float64                  `json:"memory_usage_wo_cache" description:"memory_usage_wo_cache"`
	NetBytesTransmitted float64                  `json:"net_bytes_transmitted" description:"net_bytes_transmitted"`
	NetBytesReceived    float64                  `json:"net_bytes_received" description:"net_bytes_received"`
	PVCBytesTotal       float64                  `json:"pvc_bytes_total" description:"pvc_bytes_total"`
	Pods                map[string]*PodStatistic `json:"pods" description:"pod statistic"`
}

func (*DaemonsetStatistic) Aggregate

func (ds *DaemonsetStatistic) Aggregate()

func (*DaemonsetStatistic) GetPodStats

func (ds *DaemonsetStatistic) GetPodStats(name string) *PodStatistic

func (*DaemonsetStatistic) SetPodStats

func (ds *DaemonsetStatistic) SetPodStats(name string, podStat *PodStatistic)

type DeploymentStatistic

type DeploymentStatistic struct {
	CPUUsage            float64                  `json:"cpu_usage" description:"cpu_usage"`
	MemoryUsageWoCache  float64                  `json:"memory_usage_wo_cache" description:"memory_usage_wo_cache"`
	NetBytesTransmitted float64                  `json:"net_bytes_transmitted" desciption:"net_bytes_transmitted"`
	NetBytesReceived    float64                  `json:"net_bytes_received" description:"net_bytes_received"`
	PVCBytesTotal       float64                  `json:"pvc_bytes_total" description:"pvc_bytes_total"`
	Pods                map[string]*PodStatistic `json:"pods" description:"pod statistic"`
}

func (*DeploymentStatistic) Aggregate

func (ds *DeploymentStatistic) Aggregate()

func (*DeploymentStatistic) GetPodStats

func (ds *DeploymentStatistic) GetPodStats(name string) *PodStatistic

func (*DeploymentStatistic) SetPodStats

func (ds *DeploymentStatistic) SetPodStats(name string, podStat *PodStatistic)

type OpenPitrixStatistic

type OpenPitrixStatistic struct {
	AppStatistic
}

type PodStatistic

type PodStatistic struct {
	CPUUsage            float64 `json:"cpu_usage" description:"cpu_usage"`
	MemoryUsageWoCache  float64 `json:"memory_usage_wo_cache" description:"memory_usage_wo_cache"`
	NetBytesTransmitted float64 `json:"net_bytes_transmitted" desription:"net_bytes_transmitted"`
	NetBytesReceived    float64 `json:"net_bytes_received" description:"net_bytes_received"`
	PVCBytesTotal       float64 `json:"pvc_bytes_total" description:"pvc_bytes_total"`
}

type PodsStats

type PodsStats map[string]*PodStatistic

func (*PodsStats) Set

func (ps *PodsStats) Set(podName, meterName string, value float64)

type PriceInfo

type PriceInfo struct {
	// currency unit, currently support CNY and USD
	Currency string `json:"currency" description:"currency"`
	// cpu cost with above currency unit for per core per hour
	CpuPerCorePerHour float64 `json:"cpu_per_core_per_hour,omitempty" description:"cpu price"`
	// mem cost with above currency unit for per GB per hour
	MemPerGigabytesPerHour float64 `json:"mem_per_gigabytes_per_hour,omitempty" description:"mem price"`
	// ingress network traffic cost with above currency unit for per MB per hour
	IngressNetworkTrafficPerMegabytesPerHour float64 `json:"ingress_network_traffic_per_megabytes_per_hour,omitempty" description:"ingress price"`
	// egress network traffice cost with above currency unit for per MB per hour
	EgressNetworkTrafficPerMegabytesPerHour float64 `json:"egress_network_traffic_per_megabytes_per_hour,omitempty" description:"egress price"`
	// pvc cost with above currency unit for per GB per hour
	PvcPerGigabytesPerHour float64 `json:"pvc_per_gigabytes_per_hour,omitempty" description:"pvc price"`
}

type PriceResponse

type PriceResponse struct {
	RetentionDay string `json:"retention_day"`
	PriceInfo    `json:",inline"`
}

type ResourceStatistic

type ResourceStatistic struct {
	// openpitrix statistic
	OpenPitrixs map[string]*OpenPitrixStatistic `json:"openpitrixs" description:"openpitrix statistic"`

	// app crd statistic
	Apps map[string]*AppStatistic `json:"apps" description:"app statistic"`

	// k8s workload only which exclude app and op
	Deploys      map[string]*DeploymentStatistic  `json:"deployments" description:"deployment statistic"`
	Statefulsets map[string]*StatefulsetStatistic `json:"statefulsets" description:"statefulset statistic"`
	Daemonsets   map[string]*DaemonsetStatistic   `json:"daemonsets" description:"daemonsets statistics"`
}

func (*ResourceStatistic) GetAppStats

func (rs *ResourceStatistic) GetAppStats(name string) *AppStatistic

func (*ResourceStatistic) GetDaemonsetStats

func (rs *ResourceStatistic) GetDaemonsetStats(name string) *DaemonsetStatistic

func (*ResourceStatistic) GetDeployStats

func (rs *ResourceStatistic) GetDeployStats(name string) *DeploymentStatistic

func (*ResourceStatistic) GetOpenPitrixStats

func (rs *ResourceStatistic) GetOpenPitrixStats(name string) *OpenPitrixStatistic

func (*ResourceStatistic) GetStatefulsetStats

func (rs *ResourceStatistic) GetStatefulsetStats(name string) *StatefulsetStatistic

type ServiceStatistic

type ServiceStatistic struct {
	CPUUsage            float64                  `json:"cpu_usage" description:"cpu_usage"`
	MemoryUsageWoCache  float64                  `json:"memory_usage_wo_cache" desription:"memory_usage_wo_cache"`
	NetBytesTransmitted float64                  `json:"net_bytes_transmitted" description:"net_bytes_transmitted"`
	NetBytesReceived    float64                  `json:"net_bytes_received" description:"net_bytes_received"`
	Pods                map[string]*PodStatistic `json:"pods" description:"pod statistic"`
}

func (*ServiceStatistic) Aggregate

func (ss *ServiceStatistic) Aggregate()

func (*ServiceStatistic) GetPodStats

func (ss *ServiceStatistic) GetPodStats(name string) *PodStatistic

func (*ServiceStatistic) SetPodStats

func (ss *ServiceStatistic) SetPodStats(name string, podStat *PodStatistic)

type StatefulsetStatistic

type StatefulsetStatistic struct {
	CPUUsage            float64                  `json:"cpu_usage" description:"cpu_usage"`
	MemoryUsageWoCache  float64                  `json:"memory_usage_wo_cache" description:"memory_usage_wo_cache"`
	NetBytesTransmitted float64                  `json:"net_bytes_transmitted" description:"net_bytes_transmitted"`
	NetBytesReceived    float64                  `json:"net_bytes_received" description:"net_bytes_received"`
	PVCBytesTotal       float64                  `json:"pvc_bytes_total" description:"pvc_bytes_total"`
	Pods                map[string]*PodStatistic `json:"pods" description:"pod statistic"`
}

func (*StatefulsetStatistic) Aggregate

func (ss *StatefulsetStatistic) Aggregate()

func (*StatefulsetStatistic) GetPodStats

func (ss *StatefulsetStatistic) GetPodStats(name string) *PodStatistic

func (*StatefulsetStatistic) SetPodStats

func (ss *StatefulsetStatistic) SetPodStats(name string, podStat *PodStatistic)

Jump to

Keyboard shortcuts

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