code: func (c *memoryCollector) Update(ch chan<- prometheus.Metric) error {
  	for _, m := range c.sysctls {
  		v, err := m.Value()
  		if err != nil {
  			return fmt.Errorf("couldn't get memory: %s", err)
  		}
  
  		// Most are gauges.
  		if m.valueType == 0 {
  			m.valueType = prometheus.GaugeValue
  		}
  
  		ch <- prometheus.MustNewConstMetric(
  			prometheus.NewDesc(
  				prometheus.BuildFQName(namespace, memorySubsystem, m.name),
  				m.description,
  				nil, nil,
  			), m.valueType, v)
  	}
  
  	swapUsed, err := c.kvm.SwapUsedPages()
  	if err != nil {
  		return fmt.Errorf("couldn't get kvm: %s", err)
  	}
  
  	ch <- prometheus.MustNewConstMetric(
  		prometheus.NewDesc(
  			prometheus.BuildFQName(namespace, memorySubsystem, "swap_used_bytes"),
  			"Currently allocated swap",
  			nil, nil,
  		), prometheus.GaugeValue, float64(swapUsed*c.pageSize))
  
  	return nil
  }
docs: // Update checks relevant sysctls for current memory usage, and kvm for swap
  // usage.