An open API service indexing awesome lists of open source software.

https://github.com/nfibrokerage/hummingbird

A generic Phoenix plug for automatically sending traces to honeycomb.io
https://github.com/nfibrokerage/hummingbird

library

Last synced: 12 months ago
JSON representation

A generic Phoenix plug for automatically sending traces to honeycomb.io

Awesome Lists containing this project

README

          

# Hummingbird

A plug to correlate events between services in a ✋ful lines of Elixir.

Given appropriate trace headers, ships an event for router and response calls.

## Use Case
For reasons, you may not have access to configure structured logging and log shipping. If you can control your controller, this might help. It's dangerous out there, take this.

## To Use

```elixir
defmodule YourAppWeb.YourController do
use YourAppWeb, :controller

plug Hummingbird, service_name: "your_service_name"
end
```

and add the `Hummingbird.Telemetry` child to your supervision tree:

```elixir
defmodule YouApp.Application do
# ..

def start(_type, _args) do
children = [
Hummingbird.Telemetry,
# ..
]

Supervisor.start_link(children, strategy: :one_for_one, name: YourApp.Supervisor)
end

# ..
end
```

## Configuration

**Configure OpenCensus**

In your config.exs:

```elixir
# configure opencensus
config :opencensus,
reporters: [{Opencensus.Honeycomb.Reporter, []}],
send_interval_ms: 1000
```

**Set the dataset per environment**

In your dev, prod, exs files:

```elixir
# configure write key per dataset/environment
# we use environment variables to protect the secret. It doesn't matter how you
# set the value. Choose your own adventure.

config :opencensus_honeycomb,
dataset: "your_dataset_name_goes_here",
write_key: "${HONEYCOMB_WRITE_KEY}"
```

## Assumptions

Currently, it looks for `x-b3-spanid` and `x-b3-traceid` headers on incoming request to create the trace.

## Current Example

![Image of Trace Waterfall](images/waterfall.png)

## Thanks

Wraps around https://github.com/open-telemetry/opentelemetry-erlang