# `Instruments.RateTracker`

RateTracker will track how often you are reporting metrics that are not backed 
by a "fast" implementation.

RateTracker is designed to catch cases where you have inadvertently reported 
a metric "too" frequently, as some metrics require hitting statsd directly for 
every reported value. Doing so in hot loops can result in your 
application slowing significantly.

# `callback`

```elixir
@type callback() :: ({String.t(), Statix.options()}, non_neg_integer() -&gt; term())
```

# `t`

```elixir
@type t() :: %Instruments.RateTracker{
  callbacks: [callback()],
  last_update_time: integer(),
  table_count: non_neg_integer()
}
```

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `dump_rates`

```elixir
@spec dump_rates() :: [{{String.t(), Keyword.t()}, non_neg_integer()}]
```

Dump the currently tracked rates

# `init`

# `start_link`

# `subscribe`

```elixir
@spec subscribe(callback()) :: :ok
```

Add a callback to be notified that you are reporting a metric "too" frequently.

In order to receive notifications, you must set `:instruments` -> 
`:rate_tracker_callback_threshold` to the per-second rate that you want to be 
notified at. This value will be different for every system, and will require
experimentation to determine. You can use `dump_rates()` in a remote console
to see what values are currently tracked for your metrics.

This callback should be short-lived.

---

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