@@ -102,7 +102,7 @@ defmodule Spandex.Tracer do
102
102
def configure ( opts ) do
103
103
case config ( opts , @ otp_app ) do
104
104
:disabled ->
105
- :ok
105
+ Application . put_env ( @ otp_app , __MODULE__ , merge_config ( opts , @ otp_app ) )
106
106
107
107
config ->
108
108
Application . put_env ( @ otp_app , __MODULE__ , config )
@@ -223,14 +223,17 @@ defmodule Spandex.Tracer do
223
223
Spandex . distributed_context ( conn , config ( opts , @ otp_app ) )
224
224
end
225
225
226
+ defp merge_config ( opts , otp_app ) do
227
+ otp_app
228
+ |> Application . get_env ( __MODULE__ )
229
+ |> Kernel . || ( [ ] )
230
+ |> Keyword . merge ( opts || [ ] )
231
+ |> Optimal . validate! ( @ opts )
232
+ |> Keyword . put ( :tracer , __MODULE__ )
233
+ end
234
+
226
235
defp config ( opts , otp_app ) do
227
- config =
228
- otp_app
229
- |> Application . get_env ( __MODULE__ )
230
- |> Kernel . || ( [ ] )
231
- |> Keyword . merge ( opts || [ ] )
232
- |> Optimal . validate! ( @ opts )
233
- |> Keyword . put ( :tracer , __MODULE__ )
236
+ config = merge_config ( opts , otp_app )
234
237
235
238
if config [ :disabled? ] do
236
239
:disabled
@@ -242,7 +245,7 @@ defmodule Spandex.Tracer do
242
245
defp validate_update_config ( opts , otp_app ) do
243
246
env = Application . get_env ( otp_app , __MODULE__ )
244
247
245
- if env [ :disabled ] do
248
+ if env [ :disabled? ] do
246
249
:disabled
247
250
else
248
251
schema = % { @ opts | defaults: [ ] , required: [ ] }
0 commit comments