Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/skbolton/vitals


https://github.com/skbolton/vitals

Last synced: 15 days ago
JSON representation

Awesome Lists containing this project

README

        

# Vitals

## Plan

```elixir
# in application.ex or root supervisor
{
Vitals.Supervisor,
handlers: [
Vitals.Handler.spec(
id: "ecto"
mod: EctoHandler,
),
Vitals.Handler.spec(
id: "ecto-readonly"
mod: EctoHandler,
),
Vitals.Handler.spec(
id: "stripe",
mod: StripeHandler,
)
]
}
```

```elixir
# getting diagnostics in router
Vitals.check_diagnostics(:http) # :http | :exit_code | :io | :pretty

# getting diagnostics in iex
Vitals.check_diagnostics(:pretty) # :http | :exit_code | :io | :pretty
```

```yaml
# getting diagnostics in kubernetes command
spec:
containers:
livenessProbe:
exec:
command:
- /app/bin/my-app
- eval
- "Vitals.check_diagnostics(:exit_code)"
```

```elixir
# writing a handler
defmodule MyApp.Vitals.Handler do
@behaviour Vitals.Handler
alias Vitals.Diagnostic

@impl Vitals.Handler
def check(las_diagnostic) do
%Diagnostic{}
end

@impl Vitals.Handler
def init(_opts) do
%Diagnostic{timer: %{every: {5, :second}}}
end
end
```

If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `vitals` to your list of dependencies in `mix.exs`:

```elixir
def deps do
[
{:vitals, "~> 0.1.0"}
]
end
```

Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at .