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?