code: func (collector *volumeStatsCollector) Collect(ch chan<- prometheus.Metric) {
  	podStats, err := collector.statsProvider.ListPodStats()
  	if err != nil {
  		return
  	}
  	addGauge := func(desc *prometheus.Desc, pvcRef *stats.PVCReference, v float64, lv ...string) {
  		lv = append([]string{pvcRef.Namespace, pvcRef.Name}, lv...)
  		metric, err := prometheus.NewConstMetric(desc, prometheus.GaugeValue, v, lv...)
  		if err != nil {
  			klog.Warningf("Failed to generate metric: %v", err)
  			return
  		}
  		ch <- metric
  	}
  	allPVCs := sets.String{}
  	for _, podStat := range podStats {
  		if podStat.VolumeStats == nil {
  			continue
  		}
  		for _, volumeStat := range podStat.VolumeStats {
  			pvcRef := volumeStat.PVCRef
  			if pvcRef == nil {
  				// ignore if no PVC reference
  				continue
  			}
  			pvcUniqStr := pvcRef.Namespace + "/" + pvcRef.Name
  			if allPVCs.Has(pvcUniqStr) {
  				// ignore if already collected
  				continue
  			}
  			addGauge(volumeStatsCapacityBytesDesc, pvcRef, float64(*volumeStat.CapacityBytes))
  			addGauge(volumeStatsAvailableBytesDesc, pvcRef, float64(*volumeStat.AvailableBytes))
  			addGauge(volumeStatsUsedBytesDesc, pvcRef, float64(*volumeStat.UsedBytes))
  			addGauge(volumeStatsInodesDesc, pvcRef, float64(*volumeStat.Inodes))
  			addGauge(volumeStatsInodesFreeDesc, pvcRef, float64(*volumeStat.InodesFree))
  			addGauge(volumeStatsInodesUsedDesc, pvcRef, float64(*volumeStat.InodesUsed))
  			allPVCs.Insert(pvcUniqStr)
  		}
  	}
  }
docs: // Collect implements the prometheus.Collector interface.