Let $(\Omega,\mathcal A, P)$ be a probability space. Let $(Y,\Sigma)$ be a measurable space. Let $X:(\Omega,\mathcal A) \to (Y, \Sigma)$ be a random variable. Then $X$ has probability measure $\mu_X = P \circ X^{-1}$, also called the distribution of $X$, in the probability space, also called the distribution space, $(Y, \Sigma, \mu_X)$.
In Wikipedia and other Google search, the concept of a distribution function $F_X: Y \to [0,1]$ in measure theory and probability theory seems to be limited to the case where $Y = \Re$, where
$$F_X(t) = P(\{\omega \in \Omega : X(\omega) \leq t\})$$
For example this Wikipedia definition of distribution function is limited to $Y= \Re$:
Let $ \mu $ be a measure on the real numbers, equipped with the Borel $\sigma$-algebra. Then the function $$ F_\mu \colon \Re \to \Re \cup \{ +\infty, - \infty \} $$ defined by $$ F_\mu(t)= \begin{cases} \mu((0,t]) & \text{if } t\geq 0 \\ -\mu((t,0]) & \text{if } t < 0\end{cases}$$ is called the (right continuous) distribution function of the measure $ \mu $.
Similarly, in these lecture notes on measure theory, the concept of a distribution function $F: Y \to [0,1]$ is limited to domain $\Re$:
Definition 4. A map $F:\Re\to[0,1]$ is said to be a distribution function if it is increasing, right continuous and $F(-\infty) = 0 = 1-F(\infty)$.
even though the concept of a distribution $\mu: \Sigma \to [0,1]$ is stated more generally:
Definition 7. Let $Y$ be a metric space. A $Y$-valued random variable on a probability space $(X,\Sigma,p)$ induces a Borel probability measure on $Y$ as follows: $$p_x(S) = p(x^{-1}(S))$$ for every $S \in B(Y)$. This is the distribution of $x$. If $Y =\Re$, then we call this the distribution function of $x$.
Q. Can the restriction of $Y$ to $\Re$ be lifted in case $Y$ has a total or partial order? This is exactly the point I am trying to generalize. In place of "If $Y=\Re$" I want to say "If $Y$ is totally ordered" or "If $Y$ is partially ordered" or something of this nature which indicates that $Y$ has enough order to define a distribution function as opposed to a distribution. This is the essence of the question, no more no less. The above definition seems to work fine for any totally ordered $Y$. Actually, since only $\leq$ is involved, it seems that we really only need $Y$ to be partially ordered.
Straw man answer. This question isn't attracting answers, so I'll do the best I can. If you downvote this answer, please give your rationale in the comments or provide a better answer.
Let
Clearly $F_V(E)$ is well defined for any metric space $(Y,d)$ provided with a relation $a \leq b$ for all $a,b \in Y$.
From this question:
So in the strict sense that all metric spaces can be totally ordered, the distribution function always exists, but it may be "uninteresting".
So to be "obviously useful", it is only necessary to stipulate that the metric space $(Y,d)$ is an "obviously useful" ordered metric space. Here we have range of possible more or less useful orderings:
Following this discussion in Zulip, for random variable whose codomain is a a measurable space with a preorder, the generalized distribution function can be constructed in Lean as follows: