# Trifle.Stats ## Content # Trifle.Stats `Trifle.Stats` is a minimal Elixir library for time-series metrics with pluggable drivers. ## What it does - Tracks counters and numeric payloads per key. - Reads back series by timeframe and granularity. - Supports Process, MongoDB, Postgres, Redis, and SQLite drivers. ## Quick example ```elixir {:ok, pid} = Trifle.Stats.Driver.Process.start_link() driver = Trifle.Stats.Driver.Process.new(pid) Trifle.Stats.configure( driver: driver, time_zone: "UTC", track_granularities: ["1h", "1d"], beginning_of_week: :monday ) Trifle.Stats.track("event::uploads", DateTime.utc_now(), %{count: 1, duration: 3}) now = DateTime.utc_now() from = DateTime.add(now, -24, :hour) series = Trifle.Stats.values("event::uploads", from, now, "1h") ``` ## What to expect - `values/5` returns `%{at: [...], values: [...]}` for the bucketed series. - Payloads can be nested maps, but every leaf value must be numeric. - Use a database driver for persistence and Trifle App dashboards. ## Next steps - [Installation](/trifle-stats-ex/installation) - [Configuration](/trifle-stats-ex/configuration) - [Getting Started](/trifle-stats-ex/getting_started) - [Usage](/trifle-stats-ex/usage) - [Drivers](/trifle-stats-ex/drivers) - [Designators](/trifle-stats-ex/designators) - [Transponders](/trifle-stats-ex/transponders) - [Aggregators](/trifle-stats-ex/aggregators) - [Formatters](/trifle-stats-ex/formatters)