Created
June 29, 2015 11:09
-
-
Save romul/4a67f4710d6507f78556 to your computer and use it in GitHub Desktop.
Update for brilliant article https://medium.com/@mschae/measuring-your-phoenix-app-d63a77b13bda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.