Category with a "metric" for arrow composition Consider a category $\mathcal C$ with a "distance" function $d:\mathcal C^2 \to \mathbb{R}_{\geq 0}$ satisfying the "triangle inequality"
$$d(x \to z)\leq d(x \to y) + d(y \to z)$$
for every pair of composable arrows $(x\to z)=(x \to y \to z)$.
Let's call $(\mathcal C,d)$ a "metric" category.
The first example is to take any category $\mathcal{C}$, and define
$$d(f)=\begin{cases} 0 & \text{ if $f$ is an isomorphism} \\\ 1 & \text{ otherwise.}\end{cases}$$
Then the triangle inequality simply translates the statement : "If $f=gh$, then $f$ is an isomorphism if $g$ and $h$ are isomorphisms."
Also, it's clear that every metric space can be made into a metric category in a canonical way.
We can define "open balls" in $\mathcal{C}$: for $c \in \mathcal{C}$, $r\geq 0$, let 
$$B(c, r) = \{d \in \mathcal{C} | \text{ there exists }f: c \to d\text{ such that }d(f) < r \}.$$
In the category of number fields and monomorphisms, we can let $d(K \hookrightarrow L)=\log ([L:K])$. Then the triangle inequality is actually an equality. It's clear that $d$ is a good measure of "how far" $L$ is from consisting of just $K$. The open ball of radius $r$ around $K$ is the set of extensions of $K$ of degree $< e^r$.
Is it possible to endow a big category like $\text{Top}$ or $\text{Grp}$ with a meaningful distance?
 A: 1)  In the category of finite sets (or finite groups or finite topological spaces....) let $d(f)$ be the cardinality of the image of $f$.  This satisfies the strong triangle condition
$$d(x\rightarrow z)\le\text{min }(d(x\rightarrow y),d(y\rightarrow z))$$
2)  In any category, for each object $x$, let $\xi(x)$ be an (arbitrarily assigned) positive real number and define 
$$d(f)=\text{min }\lbrace{\xi(c)|f \hbox{ factors through } c}\rbrace$$
This also satisfies
$$d(x\rightarrow z)\le \text{min }(d(x\rightarrow y),d(y\rightarrow z))$$
3)  Fix a formal language for describing arrows in your category, let $l(f)$ be the length of the shortest description of $f$, and let $d(f)=l(f)+5$. The triangle inequality follows because $g\circ h$ always has  a formal description just slightly longer than the sum of the shortest formal descriptions of $g$ and $h$ (say by putting each of these descriptions between parentheses and inserting a $\circ$ between them, which adds five characters).   
In case 3), you have to allow $d$ to take the value infinity, or restrict to categories in which everything has a finite description.  
Edited to add:  4)  For the category of topological spaces, you can fix a non-negative integer $r$ and let $d(f)= \hbox{rank} (H^r(f,{\mathbb Q}))$ .  This requires either allowing $d$ to take the value infinity or restricting to some subcategory where the homology groups are finite dimensional.
