Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use Appsignal.Utils for logging and compiling #47

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions lib/appsignal_plug.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
defmodule Appsignal.Plug do
require Appsignal.Utils
@span Appsignal.Utils.compile_env(:appsignal, :appsignal_span, Appsignal.Span)
@span Application.compile_env(:appsignal, :appsignal_span, Appsignal.Span)

@moduledoc """
AppSignal's Plug instrumentation instruments calls to Plug applications to
Expand Down Expand Up @@ -28,16 +27,15 @@ defmodule Appsignal.Plug do
defmacro __using__(_) do
quote do
require Logger
require Appsignal.Utils
Appsignal.IntegrationLogger.debug("AppSignal.Plug attached to #{__MODULE__}")

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

use Plug.ErrorHandler

def call(%Plug.Conn{private: %{appsignal_plug_instrumented: true}} = conn, opts) do
Appsignal.Utils.warning(
Logger.warning(
"Appsignal.Plug was included twice, disabling Appsignal.Plug. Please only `use Appsignal.Plug` once."
)

Expand Down
Loading