aws_ex_ray_plug v0.1.0 AwsExRay.Plug

USAGE

In your router, set AwsExRay.Plug.

defmodule MyPlugRouter do

  use Plug.Router

  plug AwsExRay.Plug, name: "my-xray", skip: [{:get, "/bar"}]

  plug :match
  plug :dispatch

  get "/foo" do
    conn
    |> put_resp_content_type("application/json")
    |> send_resp(200, Poison.encode!(%{body: "Hello, Foo"}))
  end

  get "/bar" do
    conn
    |> put_resp_content_type("application/json")
    |> send_resp(200, Poison.encode!(%{body: "Hello, Bar"}))
  end

end

When new http request comes, and it’s METHOD and PATH pair is not included :skip option, Tracing is automatically started with the name which you passed with :name option.

If the incoming request has valid X-Amzn-Trace-Id header, it tries to take over parent Trace, or else, it starts a new Trace.

Link to this section Summary

Link to this section Types

Link to this type http_method()
http_method() :: :get | :post | :put | :delete
Link to this type t()
t() :: %AwsExRay.Plug{name: String.t(), skip: [{http_method(), String.t()}]}

Link to this section Functions

Link to this function call(conn, opts)
Link to this function init(opts \\ [])