An open-source entry in TopGit's GitHub warehouse: derailed/ex_ray, 57 stars, Elixir. An Elixir OpenTracing library based on Otter
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
ExRay defines an annotation construct that wraps regular functions and enable
them to be traced using a simple affordance @trace to interact with an
OpenTracing compliant collector.
OpenTracing defines the concept of spans that
track the call stack and record timing information and various call artifacts
that can be used for application runtime inspection.
This is a really cool piece of technology that compliments your monitoring
solution as you now have x-ray vision of your application at runtime once
a monitoring metric gets off the chart.
However in practice, your code gets quickly cluttered by your tracing efforts.
ExRay alleviates the clutter by injecting cross-cutting tracing concern into
your application code. By using @trace annotation, you can trap the essence of
the calls without introducing tracing code mixed-in with your business logic.
ExRay leverages Otter Erlang
OpenTracing lib from the fine folks of BlueHouse Technology.
Documentation
ExRay
Installation
Tracing information needs to be collected by a tracing backend of your choice. You can run
ExRay using any trace collector that Otter supports. In the following example we will use
Jaeger from the self-driven folks at Uber!
Start Jaeger
Providing you have docker running on you box, you can use the all-in-one Jaeger
image to get you started. If you are a Kubernetes fan, you can use the
Jaeger chart
Alternatively, you could use the echo server otter_srv
for testing your installation but I find it more fun to have a cool UI to look at your tracing outcomes.
Setup Dependencies
Add the following dependencies to your project (Elixir or Phoenix)
NOTE: You can use Httpc(default), Hackney or IBrowse for your http client.
We opt for Ibrowse here.
def deps do
[
...
{:ex_ray , "~> 0.1.2"},
{:ibrowse, "~> 4.4.0"}
]
end
Configure Otter
In your config file, you need to tell Otter where to find your Zipkin collector.
Note: This thru me for a loop! The uri is indeed a char list and not a string!
Configure Your Application
ExRay uses ETS to track the span chains. Each request will create a new chain that
will grow and collapse with your function call stack. As such you will need to track a unique
call ID either by generating a custom ID for each request. If you are using Phoenix, the
framework does this for you by using the request_id in the response headers.
The ETS table is used to locate the parent span for which to attach to when
navigating the call stack.
NOTE: One cool aspect of OpenTracing is the tracing does not stop at the process boundaries
as you can continue the chain to other processes and external services. Please see
the examples directory for further info.
In your application initialization, you need to make sure the ExRay ETS table is created by calling
# application.ex
...
ExRay.Store.create()
...
Let's Trace!
Here is a simples tracing example. Please take a look at the examples in the Repo and
ExRay Tracers for Phoenix sample use cases.
defmodule TraceMe do
use ExRay, pre: :before_fun, post: :after_fun
alias ExRay.Span
# Generates a request id
@req_id :os.system_time(:milli_seconds) |> Integer.to_string |> IO.inspect
@trace kind: :critical
def fred(a, b), do: a+b
defp before_fun(ctx) do
ctx.target
|> Span.open(@req_id)
|> :otter.tag(:kind, ctx.meta[:kind])
|> :otter.log(">>> #{ctx.target} with #{ctx.args |> inspect}")
end
defp after_fun(ctx, span, res) do
span
|> :otter.log("<<< #{ctx.target} returned #{res}")
|> Span.close(@req_id)
end
end
See it!
That's great, but how do you see the tracing information?
open http://localhost:16686
Under Service open up our TraceMe service, click Find Traces and you should
now see your span in all its glory ie timing, tag and log info
No homepage URL was recorded for derailed/ex_ray in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
How active is development on derailed/ex_ray?
The most recent commit recorded on derailed/ex_ray was 7.8 years ago, based on the GitHub push timestamp. The repository has 12 forks — one of the better signals of community interest.
Is derailed/ex_ray open source?
TopGit's metadata for derailed/ex_ray does not record a license. Most public repositories on GitHub ARE open source, but the exact terms vary — verify by opening the LICENSE file directly.
What topics is derailed/ex_ray associated with?
GitHub's repository topics for derailed/ex_ray: "elixir", "opentracing", "otter". TopGit's editorial category is open-source.
Where do I read more about derailed/ex_ray?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/derailed/ex_ray is the definitive source.
Read full README in the tab above.
Curious whether ex_ray is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about ex_ray.