Hey All! I recently inherited a phoenix project and had to add datadog tracing to it(using Spandex). Everything was added and working properly following the Spandex docs, however when I try to build my docker image I always get this error on the mix release
phase:
(CompileError) lib/my_service/vouchers/vouchers.ex:1: module nil is not loaded and could not be found
(stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
/lib/my_service/vouchers/vouchers.ex:1: Decorator.Decorate.before_compile/1
The vouchers.ex module is literally:
defmodule MyService.Vouchers do
# Use this module to decorate all the methods here
use ModuleTracer
end
And the ModuleTracer is a custom module within my tracer to include in all the modules where I want all the functions to be “spanned”
defmodule ModuleTracer do
defmacro __using__(_opts) do
quote do
use Spandex.Decorators
@decorate_all span()
end
end
end
If I “use” this module anywhere in the application mix release
fails with the above mentioned error, if I don’t use it the build succeeds. The error is always in the module, which “uses” ModuleTracer. Am I missing something really simple or am I trying to achieve the impossible?
System:
Erlang/OTP 22 [erts-10.7] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1]
Elixir 1.9.4 (compiled with Erlang/OTP 22)