code: func extractFuncFromPath(p []Node) string {
  	if len(p) == 0 {
  		return ""
  	}
  	switch n := p[len(p)-1].(type) {
  	case *AggregateExpr:
  		return n.Op.String()
  	case *Call:
  		return n.Func.Name
  	case *BinaryExpr:
  		// If we hit a binary expression we terminate since we only care about functions
  		// or aggregations over a single metric.
  		return ""
  	}
  	return extractFuncFromPath(p[:len(p)-1])
  }
docs: // extractFuncFromPath walks up the path and searches for the first instance of
  // a function or aggregation.