Skip to content

pedroforesti/traceman

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Traceman

Build Status

Open Tracing helper for Elixir services.

For example, in order to leverage the in depth tracing options of Istio/Jaeger, you must send a set of headers in all service-to-service communication. Traceman provides conveniences for this.

Installation

Add this to your list of dependencies in mix.exs:

def deps do
  [
    {:traceman, github: "renderedtext/traceman"}
  ]
end

Usage

Construct headers from a map

headers = %{ "A" => "hello", "x-b3-traceid" => "21212121" }

Traceman.construct(headers) # => %{ "x-b3-traceid" => "21212121" }

Extract headers from a GRPC stream

defmodule HelleServer do

  def hello(req, stream) do
    tracing_headers = Traceman.from_grpc_stream(stream)

    req = EchoServer.EchoRequest.new(message: "AAA")

    {:ok, ch} = GRPC.Stub.connect("localhost:50051")
    {:ok, res} = EchoServer.Stub.echo(ch, req, metadata: tracing_headers)
  end

end

With Phoenix requests

Traceman comes with the Traceman.Plug.TraceHeaders plug. It assigns the open tracing headers to the connection. They can be retrieved with conn.assigns.tracing_headers and forwarded in other GRPC or HTTP requests the app makes.

About

Helps you trace your services

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Elixir 100.0%