Detect n+1 queries in Ecto.
Summary
Functions
Attach the telemetry handler to one or more of your Ecto repos.
Detach the telemetry handler.
Types
@type option() :: {:threshold, pos_integer()} | {:min_parameter_variants, pos_integer()} | {:application_modules, [module()]} | {:operations, :all | [atom()]} | {:ignore, (map() -> as_boolean(term()))} | {:include_params, boolean()} | {:max_samples, non_neg_integer()} | {:max_queries, pos_integer()} | {:window_ms, pos_integer()} | {:on_detect, (EctoNPlusOne.Detection.t() -> term())}
Detection options.
:threshold(pos_integer/0) - minimum matching queries The default value is5.:min_parameter_variants(pos_integer/0) - minimum distinct parameter sets The default value is1.:application_modules(a non-empty list of top-level modules) - Required. require a stacktrace frame inside an application module namespace:operations(:allor a list of SQL operation names) - SQL operations to inspect The default value is[:select].:ignore(function of arity 1) - predicate receiving a normalized query candidate:include_params(boolean/0) - retain parameter samples The default value isfalse.:max_samples(non_neg_integer/0) - maximum retained parameter lists The default value is3.:max_queries(pos_integer/0) - maximum distinct query shapes retained per process The default value is1000.:window_ms(pos_integer/0) - inactivity window for query groups The default value is2000.:on_detect(function of arity 1) - Required. handler invoked when a query group crosses the thresholds
An Ecto Repo module or a non-empty list of Repo modules.