This reporter exports spans to the OpenCensus Agent in the standard protobuf format over grpc.
Take a dependency on opencensus_service
, e.g. with rebar3
by adding it
to your applications list in .app.src
.
Configure :opencensus
' :reporters
to use :oc_reporter_service
:
{opencensus, [
{reporters, [{oc_reporter_service, #{}}]}
...]}
Take a dependency on opencensus_service
by adding to your deps
in
mix.exs
:
{:opencensus, "~> 0.9.0", override: true},
{:opencensus_service, "~> 0.1"}
(You'll need the override
because the opencensus_service
package expects
version 0.7 of opencensus
. It seems to work fine with 0.9, however.)
Configure :opencensus
' :reporters
in config/config.exs
to use
:oc_reporter_service
:
config :opencensus, :reporters, [{:oc_reporter_service, %{}}]
The map (%{}
) at the end gives oc_reporter_service
its options. Its
defaults are:
%{
channel_name: :channel_service,
endpoints: [{:http, 'localhost', 55678, []}],
options: %{},
sup_flags: %{intensity: 1, period: 5, strategy: :one_for_one}
}
WARNING: the hostname in endpoints
is a charlist, not a binary. If
you're pulling the endpoint out of an environment variable, pipe the result
from System.get_env/1
through String.to_charlist/1
.