New Relixir v0.2.0 NewRelixir.Plug.Repo
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 by adding a Plug.Conn as the first argument. For example, MyApp.Repo.all(User) can be
replaced with MyApp.Repo.NewRelic.all(conn, User). No changes are needed for transaction()
and rollback(). The Plug.Conn that’s used with query methods must be one that was setup by
NewRelixir.Plug.Phoenix.