Skip to content

Instantly share code, notes, and snippets.

@mschae

mschae/repo.ex Secret

Last active December 4, 2020 05:37
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mschae/945c7f11423a68010ab2 to your computer and use it in GitHub Desktop.
Save mschae/945c7f11423a68010ab2 to your computer and use it in GitHub Desktop.
defmodule Morgue.Repo do
use Ecto.Repo, otp_app: :my_awesome_app
def log(log_entry) do
:ok = :exometer.update ~w(my_awesome_webapp ecto query_exec_time)a, (log_entry.query_time + log_entry.queue_time || 0) / 1_000
:ok = :exometer.update ~w(my_awesome_webapp ecto query_queue_time)a, (log_entry.queue_time || 0) / 1_000 # Note: You will have to add this to conf/exometer.exs if you want it
:ok = :exometer.update ~w(my_awesome_webapp ecto query_count)a, 1
super log_entry
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment