Appsignal.HTTPoison as a drop-in client, and Appsignal.HTTPoison.Base for custom client modules. The response and error structs (%HTTPoison.Response{}, %HTTPoison.Error{}, …) are HTTPoison’s own types and are returned unchanged.
AppSignal will wrap requests executed via Appsignal.HTTPoison as request.httpoison events on your performance traces’ event timeline, allowing you to see how much time HTTPoison spends making external API requests. This data may help inform you to move the API requests to a background job, or to introduce caching to help speed up performance and limit unnecessary API requests.
Configuration
HTTPoison instrumentation is opt-in. Choose the approach that best fits your application.Using Appsignal.HTTPoison directly
CallAppsignal.HTTPoison instead of HTTPoison to make instrumented requests. Pattern-match on %HTTPoison.Response{...} and %HTTPoison.Error{...} as normal — these are HTTPoison’s own struct types, returned unchanged:
Custom client modules
If you use a custom HTTP client module based onHTTPoison.Base, replace use HTTPoison.Base with use Appsignal.HTTPoison.Base. No further changes are needed — inside the module, you can call methods like get/1 and post/3, and match on HTTPoison’s response and error structs as normal:
request/5, make sure to call super to preserve the instrumentation: