# `Otel.Metrics.Aggregation.Sum`
[🔗](https://github.com/yangbancode/otel/blob/main/lib/otel/metrics/aggregation/sum.ex#L1)

Sum aggregation. Collects the arithmetic sum of measurements.

Stores integer and float components separately for atomic updates.
ETS entry format:
`{key, int_value, float_value, start_time, reservoir_state}`.

The fifth slot holds the exemplar reservoir state
(`Otel.Metrics.Exemplar.Reservoir.SimpleFixedSize`). Reservoir
state lives alongside the aggregation cell so a single ETS row
carries everything `collect/3` needs to emit a datapoint with
exemplars — there is no separate `ExemplarsStorage` table.

Cumulative-only — `collect/3` returns the running total since
stream start. Delta temporality is not supported (minikube
hardcodes cumulative; spec `metrics/sdk.md` L1290-L1297 default).

# `aggregate`

```elixir
@spec aggregate(
  metrics_tab :: :ets.table(),
  key :: term(),
  value :: number(),
  opts :: map()
) :: :ok
```

# `collect`

```elixir
@spec collect(
  metrics_tab :: :ets.table(),
  stream_key :: String.t(),
  opts :: map()
) :: [Otel.Metrics.Aggregation.datapoint()]
```

# `offer_exemplar`

```elixir
@spec offer_exemplar(
  metrics_tab :: :ets.table(),
  key :: term(),
  value :: number(),
  time :: non_neg_integer(),
  filtered_attrs :: %{required(String.t()) =&gt; term()},
  ctx :: Otel.Ctx.t()
) :: :ok
```

---

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