Skip to content

lyokato/aws_ex_ray_plug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AwsExRay - Plug Support

Installation

If available in Hex, the package can be installed by adding aws_ex_ray_plug to your list of dependencies in mix.exs:

def application do
  [
    extra_applications: [
      :logger,
      :aws_ex_ray
      # ...
    ],
    mod {MyApp.Supervisor, []}
  ]
end

def deps do
  [
    {:aws_ex_ray, "~> 0.1"},
    {:aws_ex_ray_plug, "~> 0.1.2"},
     # ...
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/aws_ex_ray_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.

SEE ALSO

About

Elixir Library : Plug support for aws_ex_ray

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages