kubesphere / console

KubeSphere Console is the web-based UI for KubeSphere clusters.
https://kubesphere.io
Other
578 stars 444 forks source link

Measurement statistics of resource consumption statistics #1263

Open harrisonliu5 opened 3 years ago

harrisonliu5 commented 3 years ago

What would you like to be added:

Support to view the measurement statistics of resource consumption statistics

Why is this needed:

This function allows users to view the measurement statistics of resource consumption statistics.

Documents:

Document:

/assign @yunkunrao

yunkunrao commented 3 years ago

This feature adds reource metering service and its target resources cover following different level scopes:

  1. cluster scope: meter_cluster_cpu_usage : cluster CPU usage(unit: Core) meter_cluster_memory_usage: cluster memory usage (unit: Byte) meter_cluster_disk_size_usage: cluster total block device usage (unit: Byte) meter_cluster_net_bytes_transmitted: cluser network transmitted bytes (unit: Byte) meter_cluster_net_bytes_received: cluster network received bytes (unit: Byte)

  2. node scope

    • meter_node_cpu_usage: node CPU usage (unit: core)
    • meter_node_memory_usage_wo_cache: node memory usage (unit: Byte)
    • meter_node_disk_size_usage: node total block device usage (unit: Byte)
    • meter_node_net_bytes_transmitted: node network transmitted bytes (unit: Byte)
    • meter_node_net_bytes_received: node network received bytes (unit: Byte)
  3. workspace scope

    • meter_workspace_cpu_usage: workspace CPU usage (unit: Core)
    • meter_workspace_memory_usage: workspace memory usage (unit: Byte)
    • meter_workspace_net_bytes_transmitted: workspace network transmitted bytes (unit: Byte)
    • meter_workspace_net_bytes_received: workspace network received bytes (unit: Byte)
  4. namespace scope

    • meter_namespace_cpu_usage: namespace CPU usage (unit: Core)
    • meter_namespace_memory_usage_wo_cache: namespace memory usage (unit: Byte)
    • meter_namespace_net_bytes_transmitted: namespace network transmitted bytes (unit: Byte)
    • meter_namespace_net_bytes_received: namespace network received bytes (unit: Byte)
  5. application scope

    • meter_application_cpu_usage: application's components total CPU usage (unit: Core)
    • meter_application_memory_usage_wo_cache: application's components total memory usage (unit: Byte)
    • meter_application_net_bytes_transmitted: application's components total network transmitted bytes (unit: Byte)
    • meter_application_net_bytes_received: application's components total network received bytes (unit: Byte)
  6. workload scope

    • meter_workload_cpu_usage: workload CPU usage (unit: core)
    • meter_workload_memory_usage_wo_cache: workload memory usage (unit: Byte)
    • meter_workload_net_bytes_transmitted: workload network transmitted bytes (unit: Byte)
    • meter_workload_net_bytes_received: workload network received bytes (unit: Byte)
  7. service scope

    • meter_service_cpu_usage: pods behind the service total CPU usage (unit: Core)
    • meter_service_memory_usage_wo_cache: pods behind the service total memory usage (unit: Byte)
    • meter_service_net_bytes_transmitted: pods behind the service total transmitted bytes (unit: Byte)
    • meter_service_net_bytes_received: pods behind the service total received bytes (unit: Byte)
  8. pod scope

    • meter_pod_cpu_usage: pod CPU usage (unit: Core)
    • meter_pod_memory_usage_wo_cache: pod memory usage (unit: Byte)
    • meter_pod_net_bytes_transmitted: pod network transmitted bytes (unit: Byte)
    • meter_pod_net_bytes_received: pod network received bytes (unit: Byte)

Metering service support querying for both specified time and time range. Metering serivice fetches raw data from prometheus and caculates the minimum, maximum, average and sum within the specified time range automically.

It is worth noting that for CPU and memory usage, each sample point take maximum from resource application usage which comes from pods request value and actual usage. For most of the time, resource actual usage is below resoource application usage, and both of them should be below resource limit value. And this is expected. If resurce application usage not found, then the sample value should be equal to resource acutal usage.

About storage, metering service doesn't cover PVC usage becasue of the known issue kubesphere/kubesphere#2921. Instead, metering service provides cluster level and node level block device usage.