From 8b8d4a574b779682d130937ab91cee5dcb5807bd Mon Sep 17 00:00:00 2001 From: Julio Lopez <1953782+julio-lopez@users.noreply.github.com> Date: Wed, 9 Aug 2023 17:40:45 -0700 Subject: [PATCH] feat(cli): save observability metric before exiting the process (#3201) Objective: to facilitate capturing metrics for relatively short-lived kopia executions. Motivation: Currently, kopia allows a. exposing metrics via a Prometheus exporter; and b. pushing metrics to a Prometheus gateway. In certain scenarios, such as short lived executions, it is not possible to reliably scrape the metrics from the exporter endpoint. And, while the pusher approach would work, it requires starting a separate push gateway. This change allows saving the metrics to a local file before kopia exists by specifying the metrics output directory. For example, `kopia --metrics-directory /tmp/kopia-metrics/ snapshot create ....` In this case, after kopia exists, the `/tmp/kopia-metrics/` directory will contain a file with a named of the form: `-