Created
June 7, 2018 19:11
-
-
Save rozap/1d47dc0cbfc13473a595ada02b0d15e1 to your computer and use it in GitHub Desktop.
This file contains 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 Store do | |
def get(ptr) do | |
Metrics.count() | |
Metrics.timed do | |
ptr.store.get(ptr) | |
end | |
end | |
end | |
defmodule Macro do | |
defmacro count() do | |
path = gen_path(__CALLER__, :counter) | |
# How can i build up a compile time list of {:count, path} | |
# and then access it at runtime? | |
IO.inspect {:count, path} | |
quote do | |
Metrics.update_counter(unquote(path)) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment