Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions .changesets/allow-httpoison-3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
bump: patch
type: change
integrations: all
---

Allow HTTPoison 3.0 to be used as an optional dependency. Applications
on HTTPoison 3.0 can now use AppSignal's HTTPoison instrumentation
without a version conflict.
11 changes: 11 additions & 0 deletions .dialyzer_ignore.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# HTTPoison 3.0's `HTTPoison.Base` macro generates a `stream_next/1` that calls
# `:hackney.stream_next/1`. hackney 4.0 narrowed that function's typespec, so
# dialyzer treats the error clause as dead code and flags the generated spec and
# callback. The code is HTTPoison's, injected into `Appsignal.HTTPoison` through
# `use`, so we ignore these rather than work around a third-party type change.
[
{"deps/httpoison/lib/httpoison/base.ex", :callback_arg_type_mismatch},
{"deps/httpoison/lib/httpoison/base.ex", :callback_type_mismatch},
{"deps/httpoison/lib/httpoison/base.ex", :pattern_match_cov},
{"lib/appsignal/httpoison.ex", :invalid_contract}
]
13 changes: 11 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ defmodule Appsignal.Mixfile do
],
dialyzer: [
plt_file: {:no_warn, "priv/plts/dialyzer.plt"},
plt_add_apps: [:mix]
plt_add_apps: [:mix],
ignore_warnings: ".dialyzer_ignore.exs"
]
]
end
Expand Down Expand Up @@ -135,6 +136,14 @@ defmodule Appsignal.Mixfile do
false -> "~> 0.4 or ~> 1.0"
end

# httpoison 3.0 depends on hackney 4.0, which pulls in quic and requires
# OTP 26 or later. Cap httpoison at 2.x on older OTP releases.
httpoison_version =
case otp_version < "26" do
true -> "~> 2.0"
false -> "~> 2.0 or ~> 3.0"
end

mime_dependency =
case Version.compare(system_version, "1.10.0") do
:lt -> [{:mime, "~> 1.0", only: [:test, :test_no_nif]}]
Expand Down Expand Up @@ -195,7 +204,7 @@ defmodule Appsignal.Mixfile do
{:credo, credo_version, only: [:test, :dev], runtime: false},
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
{:telemetry, telemetry_version},
{:httpoison, "~> 2.0", optional: true}
{:httpoison, httpoison_version, optional: true}
] ++ mime_dependency ++ logger_backends_dependency ++ hpax_dependency
end
end
Loading