If you use just
QgsDistanceArea.measureLength(feat), you get an error:
first argument of unbound method must have type 'QgsDistanceArea'. That means you need to create an object of
d = QgsDistanceArea()
Then you need to set ellipsoid. Use
QgsEllipsoidUtils::acronyms() to get a list of all known ellipsoid acronyms. If you don't set ellipsoid, calculations will be performed in plane geometry.
Then you can use
measureLength to get the length of the line on ellipsoid. Normally the measurement is in meters.
measure = d.measureLength(feat.geometry())
Or you can use
measureLine method instead of
measure = d.measureLine(feat.geometry().asPolyline())
# If geometry type is multipolyline
measure = d.measureLine(feat.geometry().asMultiPolyline())
For more information, please review QgsDistanceArea documentation.