code: func tryParseMetricValue(aggName string, rawVal []interface{}, targetValue *core.MetricValue, fieldIndex int, wasInt map[string]bool) error {
  	// the Influx client decodes numeric fields to json.Number (a string), so we have to deal with that --
  	// assume, starting off, that values may be either float or int.  Try int until we fail once, and always
  	// try float.  At the end, figure out which is which.
  
  	var rv string
  	if rvN, ok := rawVal[fieldIndex].(json.Number); !ok {
  		return fmt.Errorf("Value %q of metric %q was not a json.Number", rawVal[fieldIndex], aggName)
  	} else {
  		rv = rvN.String()
  	}
  
  	tryInt := false
  	isInt, triedBefore := wasInt[aggName]
  	tryInt = isInt || !triedBefore
  
  	if tryInt {
  		if err := json.Unmarshal([]byte(rv), &targetValue.IntValue); err != nil {
  			wasInt[aggName] = false
  		} else {
  			wasInt[aggName] = true
  		}
  	}
  
  	if err := json.Unmarshal([]byte(rv), &targetValue.FloatValue); err != nil {
  		return err
  	}
  
  	return nil
  }
docs: // tryParseMetricValue attempts to parse a raw metric value into the appropriate go type.