Skip to content

Instantly share code, notes, and snippets.

@rozap
Created June 7, 2018 19:11
Show Gist options
  • Save rozap/1d47dc0cbfc13473a595ada02b0d15e1 to your computer and use it in GitHub Desktop.
Save rozap/1d47dc0cbfc13473a595ada02b0d15e1 to your computer and use it in GitHub Desktop.
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