Skip to content

Commit

Permalink
Merge pull request #744 from appsignal/change-version-file
Browse files Browse the repository at this point in the history
Change how the agent version is retrieved for diagnose
  • Loading branch information
luismiramirez authored Jan 17, 2022
2 parents 243f0d2 + 8c14f82 commit 4aa8fe3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
bump: "patch"
type: "change"
---

The diagnose library report now reports the agent version from the committed agent file,
rather than the downloaded version, which is reported in the installation report.
2 changes: 1 addition & 1 deletion lib/appsignal/diagnose/library.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Appsignal.Diagnose.Library do
require Appsignal.Utils

@appsignal_version Mix.Project.config()[:version]
@agent_version Appsignal.Nif.agent_version()
@agent_version Appsignal.Agent.version()
@nif Appsignal.Utils.compile_env(:appsignal, :appsignal_nif, Appsignal.Nif)

def info do
Expand Down
10 changes: 0 additions & 10 deletions lib/appsignal/nif.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ defmodule Appsignal.Nif do
end
end

def agent_version do
case :appsignal
|> :code.priv_dir()
|> Path.join("appsignal.version")
|> File.read() do
{:ok, contents} -> String.trim(contents)
_ -> nil
end
end

def env_put(key, value) do
_env_put(key, value)
end
Expand Down
12 changes: 0 additions & 12 deletions test/appsignal/nif_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,4 @@ defmodule Appsignal.NifTest do
assert Nif.close_span(ref) == :ok
end
end

describe "agent_version" do
@tag :skip_env_test_no_nif
test "returns the installed agent version" do
assert Nif.agent_version() == Appsignal.Agent.version()
end

@tag :skip_env_test
test "does not return the agent version if the agent is not installed" do
assert Nif.agent_version() == nil
end
end
end
2 changes: 1 addition & 1 deletion test/mix/tasks/appsignal_diagnose_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule Mix.Tasks.Appsignal.DiagnoseTest do
alias Appsignal.{Diagnose.FakeReport, FakeNif, FakeSystem}

@appsignal_version Mix.Project.config()[:version]
@agent_version Appsignal.Nif.agent_version()
@agent_version Appsignal.Agent.version()

defp run, do: capture_io("Y", &run_fn/0)
defp run(args) when is_list(args), do: capture_io(fn -> run_fn(args) end)
Expand Down

0 comments on commit 4aa8fe3

Please sign in to comment.