# `Instruments.StatsReporter`

A behavoiur for reporters.

Reporters emit values back to the underlying reporting system.
Out of the box, Instruments provides `Instruments.Statix`, `Instruments.StatsReporter.Logger`,
and `Instruments.StatsReporter.Null`reporters.

# `key`

```elixir
@type key() :: String.t()
```

# `stats_return`

```elixir
@type stats_return() :: :ok | {:error, term()}
```

# `connect`

```elixir
@callback connect() :: :ok
```

Connect to the reporter.
This function is called by the system prior to using the reporter,
any connections should be established in this function.

# `decrement`

```elixir
@callback decrement(key(), integer(), keyword()) :: stats_return()
```

Decrement a key by the specified value

# `gauge`

```elixir
@callback gauge(key(), integer(), keyword()) :: stats_return()
```

Set the value of the key to the specified value

# `histogram`

```elixir
@callback histogram(key(), integer(), keyword()) :: stats_return()
```

Include the value in the histogram defined by `key`

# `increment`

```elixir
@callback increment(key(), integer(), keyword()) :: stats_return()
```

Increment a key by the specified value

# `measure`

```elixir
@callback measure(key(), keyword(), (-&gt; any())) :: any()
```

Measure the execution time of the provided function and
include it in the metric defined by `key`

# `send_event`
*optional* 

```elixir
@callback send_event(title :: iodata(), text :: iodata(), keyword()) :: stats_return()
```

Send a DataDog event with the given title and text

# `set`

```elixir
@callback set(key(), integer(), keyword()) :: stats_return()
```

Write the value into the set defined by `key`

# `timing`

```elixir
@callback timing(key(), integer(), keyword()) :: stats_return()
```

Include the timing in the `key`

---

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