# `mix chronicle.discover`
[🔗](https://github.com/Cratis/Chronicle.Elixir/blob/main/lib/mix/tasks/chronicle.discover.ex#L4)

Prints the artifacts `Chronicle.Artifacts.discover/1` finds in an OTP application, and
optionally compares them with a running kernel for artifact identity drift (see
`Chronicle.Discovery.DriftDetector`).

## Usage

    mix chronicle.discover --otp-app my_app
    mix chronicle.discover --otp-app my_app \
      --connection-string "chronicle://localhost:35000" --fail-on-drift

## Options

  * `--otp-app` — **(required)** the OTP application to discover Chronicle artifacts from.
  * `--connection-string` — a Chronicle connection string. When given, the task also
    fetches the kernel's current event types and observers (event store `"default"`,
    namespace `"Default"` — the same defaults `Chronicle.Client` uses) and reports any
    artifact identity drift.
  * `--fail-on-drift` — exit `1` when a `:warning`-severity drift finding exists. Has no
    effect without `--connection-string`.

## Exit codes

  * `0` — printed cleanly; no drift found, or none was requested.
  * `1` — drift was requested and a `:warning`-severity finding exists, with `--fail-on-drift`.
  * `2` — could not run: `--otp-app` missing, or the kernel couldn't be reached.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
