Met is a distributed, compacting, multidimensional, telemetry-powered time series datastore for Oban that requires no configuration. It gathers data for queues, job counts, execution metrics, active crontabs, historic metrics, and more.
Met powers the charts and runtime details shown in the Oban Web dashboard.
-
🤖 Autonomous - Supervises a collection of autonomous modules that dynamically start and stop alongside Oban instances without any code changes.
-
🎩 Distributed - Metrics are shared between all connected nodes via pubsub. Leadership is used to restrict expensive operations, such as performing counts, to a single node.
-
📼 Recorded - Telemetry events and scraped data are stored in-memory as time series data. Values are stored as either gauges or space efficient "sketches".
-
🪐 Multidimensional - Metrics are stored with labels such as
node
,queue
,worker
, etc. that can be filtered and grouped dynamically at runtime. -
🗜️ Compacting - Time series values are periodically compacted into larger windows of time to save space and optimize querying historic data. Compaction periods use safe defaults, but are configurable.
-
✏️ Estimating - In supporting systems (Postgres), count queries use optimized estimates automatically for tables with a large number of jobs.
-
🔎 Queryable - Historic metrics may be filtered and grouped by any label, sliced by arbitrary time intervals, and numeric values aggregated at dynamic percentiles (e.g. P50, P99) without pre-computed histogram buckets.
-
🤝 Handoff - Ephemeral data storage via data replication with handoff between nodes. All nodes have a shared view of the cluster's data and new nodes are caught up when they come online.
Oban Met is included with Oban Web and manual installation is only necessary in hybrid environments (separate Web and Worker nodes).
To receive metrics from non-web nodes in a system with separate "web" and "worker" applications
you must explicitly include oban_met
as a dependency for "workers".
{:oban_met, "~> 1.0"}
No configuration is necessary and Oban Met will start automatically in a typical application. A variety of options are provided for more complex or nuanced usage.
Supervised Met instances start automatically along with Oban instances unless Oban is in testing mode. You can disable auto-starting globally with application configuration:
config :oban_met, auto_start: false
Then, start instances as a child directly within your Oban app's plugins:
plugins: [
Oban.Met,
...
]
Options for internal Oban.Met
processes can be overridden from the plugin specification. Most
options are internal and not meant to be overridden, but one particularly useful option to tune is
the estimate_limit
. The estimate_limit
determines at which point state/queue counts switch
from using an accurate count(*)
call to a much more efficient, but less accurate, estiamte
function.
The default limit is a conservative 50k, which may be too low for systems with insert spikes. This declares an override to set the limit to 200k:
{Oban.Met, reporter: [estimate_limit: 200_000]}
Met will create the necessary estimate function automatically when possible. The migration isn't necessary under normal circumstances, but is provided to avoid permission issues or allow full control over database changes.
mix ecto.gen.migration add_oban_met
Open the generated migration and delegate the up/0
and down/0
functions to
Oban.Met.Migration
:
defmodule MyApp.Repo.Migrations.AddObanMet do
use Ecto.Migration
def up, do: Oban.Met.Migration.up()
def down, do: Oban.Met.Migration.down()
end
Then, after disabling auto-start, configure the reporter not to auto-migrate if you run the explicit migration:
{Oban.Met, reporter: [auto_migrate: false]}
To run the test suite you must have PostgreSQL 12+. Once dependencies are installed, setup the databases and run necessary migrations:
mix test.setup
There are a few places to connect and communicate with other Oban users:
- Ask questions and discuss #oban on the Elixir Forum
- Request an invitation and join the #oban channel on Slack
- Learn about bug reports and upcoming features in the issue tracker