Skip to content

Commit

Permalink
Use Utils.compile_env in Appsignal.Phoenix (#44)
Browse files Browse the repository at this point in the history
to avoid warnings on Elixir 1.14+
  • Loading branch information
michallepicki authored and jeffkreeftmeijer committed Mar 28, 2022
1 parent e203a91 commit 42b2cdd
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bump: "patch"
type: "fix"
---

Fix application environment warnings on Elixir 1.14
5 changes: 3 additions & 2 deletions lib/appsignal_phoenix/channel.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ defmodule Appsignal.Phoenix.Channel do
"""

@tracer Application.get_env(:appsignal, :appsignal_tracer, Appsignal.Tracer)
@span Application.get_env(:appsignal, :appsignal_span, Appsignal.Span)
require Appsignal.Utils
@tracer Appsignal.Utils.compile_env(:appsignal, :appsignal_tracer, Appsignal.Tracer)
@span Appsignal.Utils.compile_env(:appsignal, :appsignal_span, Appsignal.Span)

def instrument(module, name, socket, fun) do
instrument(module, name, %{}, socket, fun)
Expand Down
5 changes: 3 additions & 2 deletions lib/appsignal_phoenix/event_handler.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defmodule Appsignal.Phoenix.EventHandler do
@tracer Application.get_env(:appsignal, :appsignal_tracer, Appsignal.Tracer)
@span Application.get_env(:appsignal, :appsignal_span, Appsignal.Span)
require Appsignal.Utils
@tracer Appsignal.Utils.compile_env(:appsignal, :appsignal_tracer, Appsignal.Tracer)
@span Appsignal.Utils.compile_env(:appsignal, :appsignal_span, Appsignal.Span)
@moduledoc false

require Logger
Expand Down
5 changes: 3 additions & 2 deletions lib/appsignal_phoenix/live_view.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defmodule Appsignal.Phoenix.LiveView do
@tracer Application.get_env(:appsignal, :appsignal_tracer, Appsignal.Tracer)
@span Application.get_env(:appsignal, :appsignal_span, Appsignal.Span)
require Appsignal.Utils
@tracer Appsignal.Utils.compile_env(:appsignal, :appsignal_tracer, Appsignal.Tracer)
@span Appsignal.Utils.compile_env(:appsignal, :appsignal_span, Appsignal.Span)

def instrument(module, name, socket, fun) do
instrument(module, name, %{}, socket, fun)
Expand Down
3 changes: 2 additions & 1 deletion lib/appsignal_phoenix/template.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defmodule Appsignal.Phoenix.Template do
@span Application.get_env(:appsignal, :appsignal_span, Appsignal.Span)
require Appsignal.Utils
@span Appsignal.Utils.compile_env(:appsignal, :appsignal_span, Appsignal.Span)
@moduledoc false

def compile(fun, path) do
Expand Down
5 changes: 3 additions & 2 deletions lib/appsignal_phoenix/view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ defmodule Appsignal.Phoenix.View do

defmacro __before_compile__(_env) do
quote do
@span Application.get_env(:appsignal, :appsignal_span, Appsignal.Span)
@tracer Application.get_env(:appsignal, :appsignal_tracer, Appsignal.Tracer)
require Appsignal.Utils
@span Appsignal.Utils.compile_env(:appsignal, :appsignal_span, Appsignal.Span)
@tracer Appsignal.Utils.compile_env(:appsignal, :appsignal_tracer, Appsignal.Tracer)

defoverridable render: 2

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ defmodule Appsignal.Phoenix.MixProject do
end

[
{:appsignal_plug, ">= 2.0.8 and < 3.0.0"},
{:appsignal_plug, ">= 2.0.9 and < 3.0.0"},
{:phoenix, "~> 1.4"},
{:phoenix_html, "~> 2.11 or ~> 3.0", optional: true},
{:phoenix_live_view, "~> 0.9", optional: true},
Expand Down

0 comments on commit 42b2cdd

Please sign in to comment.