def parent_metrics(cls, metric_node: Metric, manifest: Manifest) -> Iterator[Metric]:
        """For a given metric, yeilds all upstream metrics."""
        yield metric_node

        for parent_unique_id in metric_node.depends_on.nodes:
            node = manifest.expect(parent_unique_id)
            if isinstance(node, Metric):
                yield from cls.parent_metrics(node, manifest)
For a given metric, yeilds all upstream metrics.
core/dbt/contracts/graph/metrics.py