Welcome to Trifle Documentation

A collection of small, focused libraries for solving everyday problems — time-series metrics, execution tracing, structured logging, and more. Available for Ruby, Elixir, and Go.

Born out of frustration with bloated tools that do too much and none of it well. Each library does one thing, keeps a small footprint, and stays out of your way.

All libraries are released under the MIT license.


Applications

Apps you can run to make your use of below plugins easier.

Trifle App

Dashboards + API

Visual and automation layer for Trifle Stats. Dashboards, monitors, API, and tokens.

trifle metrics push \
  --key event::signup \
  --values '{"count":1}'

Trifle CLI

API + SQLite

Command-line tooling for Trifle metrics with API or local SQLite drivers, plus MCP server mode.

trifle metrics setup --driver sqlite --db ./stats.db
trifle metrics get --driver sqlite --db ./stats.db --key event::signup --granularity 1h

Skills

Agent skills that teach AI coding agents (Claude Code, Codex, Cursor, and others) how to use Trifle effectively. Install a skill and your agent knows how to structure metrics payloads, trace execution flow, and run CLI analytics — following best practices out of the box. Available at github.com/trifle-io/skills. Read more.


Plugins

These are gems and plugins you can plug into your app to start building.

Trifle::Stats

Ruby · Time-series metrics

Track counters and numeric payloads, then read back series by granularity.

Trifle::Stats.configure do |c|
  c.driver = Trifle::Stats::Driver::Redis.new(Redis.new)
  c.granularities = ["1h"]
end

Trifle::Stats.track(
  key: "event::signup",
  at: Time.now.utc,
  values: { count: 1 }
)

Trifle.Stats

Elixir · Time-series metrics

Minimal Elixir API for tracking counters and reading series.

{:ok, pid} = Trifle.Stats.Driver.Process.start_link()
driver = Trifle.Stats.Driver.Process.new(pid)

Trifle.Stats.configure(driver: driver, track_granularities: ["1h"])
Trifle.Stats.track("event::signup", DateTime.utc_now(), %{count: 1})

TrifleStats

Go · Time-series metrics

Go library for tracking counters and reading series with SQLite, Postgres, MySQL, Redis, or MongoDB.

import TrifleStats "github.com/trifle-io/trifle_stats_go"

db, _ := sql.Open("sqlite", "file:stats.db?cache=shared&mode=rwc")
driver := TrifleStats.NewSQLiteDriver(db, "trifle_stats", TrifleStats.JoinedFull)
_ = driver.Setup()

cfg := TrifleStats.DefaultConfig()
cfg.Driver = driver
TrifleStats.Track(cfg, "event::signup", time.Now().UTC(), map[string]any{"count": 1})

Trifle::Traces

Ruby · Execution tracing

Capture messages, return values, and metadata from code blocks.

Trifle::Traces.tracer = Trifle::Traces::Tracer::Hash.new(
  key: "jobs/invoice_charge"
)

Trifle::Traces.trace("Charge invoice") { charge_invoice(42) }
Trifle::Traces.tracer.wrapup

Trifle::Docs

Ruby · Static docs router

Map a folder of Markdown/textile/static files to URLs and render them in-app.

Trifle::Docs.configure do |c|
  c.path = Rails.root.join("docs")
  c.register_harvester(Trifle::Docs::Harvester::Markdown)
end

Trifle::Docs.content(url: "getting_started")

Trifle::Logs

Ruby · File-backed logs

Dump logs to disk and search them locally with fast paging.

Trifle::Logs.configure do |c|
  c.driver = Trifle::Logs::Driver::File.new(path: "/var/logs/trifle")
end

Trifle::Logs.dump("billing", { event: "invoice_charged" })