code: def metrics_show(
      *targets: str,
      repo: Optional[str] = None,
      rev: Optional[str] = None,
      config: Optional[Dict] = None,
  ) -> Dict:
      """Get metrics tracked in `repo`.
  
      Without arguments, this function will retrieve all metrics from all tracked
      metric files, for the current working tree.
  
      See the options below to restrict the metrics retrieved.
  
      Args:
          *targets (str, optional): Names of the metric files to retrieve
          metrics from. For example, "classifier_eval.json,
          clustering_eval.json".
          If no `targets` are provided, all metric files tracked in `dvc.yaml`
          will be used.
          Note that targets don't necessarily have to be defined in `dvc.yaml`.
          repo (str, optional): Location of the DVC repository.
              Defaults to the current project (found by walking up from the
              current working directory tree).
              It can be a URL or a file system path.
              Both HTTP and SSH protocols are supported for online Git repos
              (e.g. [user@]server:project.git).
          rev (str, optional): Name of the `Git revision`_ to retrieve metrics
              from.
              Defaults to `None`.
              An example of git revision can be a branch or tag name, a commit
              hash or a dvc experiment name.
              If `repo` is not a Git repo, this option is ignored.
              If `None`, the current working tree will be used.
          config (dict, optional): config to be passed through to DVC project.
              Defaults to `None`.
  
      Returns:
          Dict: See Examples below.
  
      Examples:
  
          - No arguments.
  
          Working on https://github.com/iterative/example-get-started
  
          >>> import dvc.api
          >>> metrics = dvc.api.metrics_show()
          >>> print(json.dumps(metrics, indent=4))
          {
              "avg_prec": 0.9249974999612706,
              "roc_auc": 0.9460213440787918
          }
  
          ---
  
          - Using `rev`.
  
          Working on https://github.com/iterative/example-get-started
  
          >>> import json
          >>> import dvc.api
          >>> metrics = dvc.api.metrics_show(rev="tune-hyperparams")
          >>> print(json.dumps(metrics, indent=4))
          {
              "avg_prec": 0.9268792615819422,
              "roc_auc": 0.945093365854111
          }
  
          ---
  
          - Using `targets`.
  
          Working on https://github.com/iterative/example-get-started
  
          >>> import json
          >>> import dvc.api
          >>> metrics = dvc.api.metrics_show("evaluation.json")
          >>> print(json.dumps(metrics, indent=4))
          {
              "avg_prec": 0.9249974999612706,
              "roc_auc": 0.9460213440787918
          }
  
          ---
  
          - Git URL as `repo`.
  
          >>> import json
          >>> import dvc.api
          >>> metrics = dvc.api.metrics_show(
          ...     repo="https://github.com/iterative/demo-fashion-mnist")
          >>> print(json.dumps(metrics, indent=4))
          {
              "loss": 0.25284987688064575,
              "accuracy": 0.9071000218391418
          }
  
  
      .. _Git revision:
          https://git-scm.com/docs/revisions
      """
      from dvc.repo.metrics.show import to_relpath
  
      with Repo.open(repo, config=config) as _repo:
          metrics = _repo.metrics.show(
              targets=targets,
              revs=rev if rev is None else [rev],
              on_error="raise",
          )
          metrics = {
              k: to_relpath(_repo.fs, _repo.root_dir, v)
              for k, v in metrics.items()
          }
  
      metrics = _postprocess(metrics)
  
      if not metrics:
          return {}
  
      return metrics[first(metrics)]
  
file_path: dvc/dvc/api/show.py
imports: import typing
  from collections import Counter
  from typing import Dict, Iterable, Optional, Union
  from funcy import first
  from dvc.repo import Repo
label_desc: Use image node_id 2 for calling a global function with example usage: metrics_show() and returns: metrics, dict