# `Zexbox.Metrics.ControllerSeries`
[🔗](https://github.com/Intellection/zexbox/blob/main/lib/zexbox/metrics/models/controller_series.ex#L1)

This module defines generic controller metrics.

The fields captured are:

* duration_ms - The time taken to process the request in milliseconds
* success - Whether the request was successful (1.0) or not (0.0)
* path - The path of the request
* http_referer - The referer of the request
* count - The number of requests
* request_id - The request ID of the request
* requester - An identifier for the caller (e.g. an API key description or
  upstream service name). Not populated by default — set it from a
  `Zexbox.Metrics.ControllerSeriesEnricher`.

The tags allowed are:

* controller - The name of the controller
* action - The name of the action
* method - The HTTP method of the request
* format - The format of the request
* status - The status of the request

# `t`

```elixir
@type t() :: %Zexbox.Metrics.ControllerSeries{
  fields: %Zexbox.Metrics.ControllerSeries.Fields{
    count: term(),
    duration_ms: term(),
    http_referer: term(),
    path: term(),
    request_id: term(),
    requester: term(),
    success: term(),
    trace_id: term()
  },
  tags: %Zexbox.Metrics.ControllerSeries.Tags{
    action: term(),
    controller: term(),
    format: term(),
    method: term(),
    status: term()
  },
  timestamp: non_neg_integer() | binary() | nil
}
```

# `field`

```elixir
@spec field(t(), atom(), any()) :: t()
```

Adds a field to the series

# `tag`

```elixir
@spec tag(t(), atom(), any()) :: t()
```

Adds a tag to the series

---

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