code: func (c *resourceMetricsClient) GetResourceMetric(resource v1.ResourceName, namespace string, selector labels.Selector) (PodMetricsInfo, time.Time, error) {
  	metrics, err := c.client.PodMetricses(namespace).List(metav1.ListOptions{LabelSelector: selector.String()})
  	if err != nil {
  		return nil, time.Time{}, fmt.Errorf("unable to fetch metrics from resource metrics API: %v", err)
  	}
  
  	if len(metrics.Items) == 0 {
  		return nil, time.Time{}, fmt.Errorf("no metrics returned from resource metrics API")
  	}
  
  	res := make(PodMetricsInfo, len(metrics.Items))
  
  	for _, m := range metrics.Items {
  		podSum := int64(0)
  		missing := len(m.Containers) == 0
  		for _, c := range m.Containers {
  			resValue, found := c.Usage[v1.ResourceName(resource)]
  			if !found {
  				missing = true
  				klog.V(2).Infof("missing resource metric %v for container %s in pod %s/%s", resource, c.Name, namespace, m.Name)
  				break // containers loop
  			}
  			podSum += resValue.MilliValue()
  		}
  
  		if !missing {
  			res[m.Name] = PodMetric{
  				Timestamp: m.Timestamp.Time,
  				Window:    m.Window.Duration,
  				Value:     int64(podSum),
  			}
  		}
  	}
  
  	timestamp := metrics.Items[0].Timestamp.Time
  
  	return res, timestamp, nil
  }
docs: // GetResourceMetric gets the given resource metric (and an associated oldest timestamp)
  // for all pods matching the specified selector in the given namespace