For different routing protocols, there is a reference for measuring the path cost(metric):
The distance-vector routing protocol RIP is based on router hops;
The link-state routing protocols such as OSPF and ISIS are based on the bandwidth of interfaces.
For static routes and direct routes, the definitions of different vendors are different. Generally, the value is 0 or 1.
For a path vector protocol like BGP, each AS is identified by an AS hop regardless of how many routers it has.