Skip to content

Instantly share code, notes, and snippets.

@romul
Created June 29, 2015 11:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romul/4a67f4710d6507f78556 to your computer and use it in GitHub Desktop.
Save romul/4a67f4710d6507f78556 to your computer and use it in GitHub Desktop.
defmodule Morgue.Repo do
use Ecto.Repo, otp_app: :my_awesome_app
def log(entry) do
result = super(entry)
time = (entry.query_time + entry.queue_time) / 1_000
:ok = :exometer.update ~w(tracker ecto query_exec_time)a, time
:ok = :exometer.update ~w(tracker ecto query_count)a, 1
result
end
end
@mschae
Copy link

mschae commented Jul 11, 2015

Thanks @romul - I adjusted mine accordingly.

https://gist.github.com/mschae/945c7f11423a68010ab2

No need to save the result in a variable - might actually be worse re: memory usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment