Last active
April 11, 2018 17:48
-
-
Save itsderek23/50296b49df16b266e47cc04d227d4b4a to your computer and use it in GitHub Desktop.
Scout HTTPoison Instrumentation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Instruments HTTPoison calls. | |
# | |
# Example usage: | |
# | |
# defmodule Demo.Web.PageController do | |
# use Demo.Web, :controller | |
# alias ScoutApm.HTTPoison | |
# def index(conn, _params) do | |
# HTTPoison.get("https://cnn.com") | |
# HTTPoison.post("https://cnn.com", "") | |
# HTTPoison.get!("http://localhost:4567") | |
# render conn, "index.html" | |
# end | |
# end | |
defmodule ScoutApm.HTTPoison do | |
use HTTPoison.Base | |
import ScoutApm.Tracing | |
def request(method, url, body \\ "", headers \\ [], options \\ []) do | |
timing("HTTP", method) do | |
update_desc(url) | |
super(method, url, body, headers, options) | |
end | |
end | |
end |
Author
itsderek23
commented
May 4, 2017
Hi
How to use it together %HTTPoison.Response{}
and %HTTPoison.Error{}
structs?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment