New Relixir v0.4.5 NewRelixir.Plug.Repo View Source
Defines a module that provides instrumented methods for a standard Ecto.Repo
.
defmodule MyApp.Repo do
use Ecto.Repo, otp_application: :my_app
defmodule NewRelic do
use NewRelixir.Plug.Repo, repo: MyApp.Repo
end
end
Anywhere that the original repository is used to make a database call, the
wrapper module can be used instead. For example, MyApp.Repo.all(User)
can
be replaced with MyApp.Repo.NewRelic.all(User)
. These database calls must
be done in the scope of an instrumented Phoenix controller or Plug endpoint.
Calls made from spawned child subprocesses are supported.