Skip to content

Instantly share code, notes, and snippets.

@OleMchls
Forked from anonymous/server-timing-with-phoenix.markdown
Created February 14, 2018 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OleMchls/ac1c60377329471e9507b27a85dc2f21 to your computer and use it in GitHub Desktop.
Save OleMchls/ac1c60377329471e9507b27a85dc2f21 to your computer and use it in GitHub Desktop.
repo.ex
defmodule MyApp.Repo do
use Ecto.Repo, otp_app: :myapp
def log(entry) do
query_exec_time = (entry.query_time + entry.queue_time || 0) / 1000
query_queue_time (entry.queue_time || 0) / 1000
send_data_to_metrics_collecting_gen_server
super entry
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment