code: func closestAggMethod(requested consolidation.Consolidator, available []conf.Method) consolidation.Consolidator {
  	// if there is only 1 consolidation method available, then that is all we can return.
  	if len(available) == 1 {
  		return consolidation.Consolidator(available[0])
  	}
  
  	avail := map[consolidation.Consolidator]struct{}{}
  	for _, a := range available {
  		avail[consolidation.Consolidator(a)] = struct{}{}
  	}
  	var orderOfPreference []consolidation.Consolidator
  	orderOfPreference, ok := rollupPreference[requested]
  	if !ok {
  		return consolidation.Consolidator(available[0])
  	}
  	for _, p := range orderOfPreference {
  		if _, ok := avail[p]; ok {
  			return p
  		}
  	}
  	// fall back to the default aggregation method.
  	return consolidation.Consolidator(available[0])
  }
docs: // find the best consolidation method based on what was requested and what aggregations are available.