Skip to content

Instantly share code, notes, and snippets.

@itsderek23
Last active April 11, 2018 17:48
Show Gist options
  • Save itsderek23/50296b49df16b266e47cc04d227d4b4a to your computer and use it in GitHub Desktop.
Save itsderek23/50296b49df16b266e47cc04d227d4b4a to your computer and use it in GitHub Desktop.
Scout HTTPoison Instrumentation
# 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
@itsderek23
Copy link
Author

image

@thiagogsr
Copy link

thiagogsr commented Feb 6, 2018

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