Module jaeger_passage

Utility Functions.

Copyright © 2017 Takeru Ohta <phjgt308@gmail.com>

Description

Utility Functions

Data Types

start_tracer_option()

start_tracer_option() = {reporter_id, jaeger_passage_reporter:reporter_id()} | {max_queue_len, non_neg_integer() | infinity} | jaeger_passage_reporter:start_option()

start_tracer_options()

start_tracer_options() = [start_tracer_option()]

Options for start_tracer/3.

Function Index

start_tracer/2Equivalent to start_tracer(TracerId, Sampler, []).
start_tracer/3Starts a tracer for Jaeger.
stop_tracer/1Stops the tracer which has been started by start_tracer/3.

Function Details

start_tracer/2

start_tracer(Tracer, Sampler) -> ok | {error, Reason::term()}

Equivalent to start_tracer(TracerId, Sampler, []).

start_tracer/3

start_tracer(Tracer, Sampler, Options) -> ok | {error, Reason::term()}

Starts a tracer for Jaeger.

This function also starts a reporter for the jaeger agent.

Conceptually this is equivalent to the following code:

  ReporterId = proplists:get_value(reporter_id, Options, Tracer),
  Context = jaeger_passage_span_context,
  {ok, Reporter} = jaeger_passage_reporter:start(ReporterId, Options),
  passage_tracer_registry:register(Tracer, Context, Sampler, Reporter).

Examples

  %% Starts `test_tracer'
  Sampler = passage_sampler_all:new().
  ok = jaeger_passage:start_tracer(example_tracer, Sampler).
 
  [example_tracer] = passage_tracer_registry:which_tracers().
  [example_tracer] = jaeger_passage_reporter:which_reporters().
 
  %% Starts and finishes spans
  passage_pd:start_span(example_span, [{tracer, example_tracer}]).
  passage_pd:log(#{message => "something wrong"}, [error]).
  passage_pd:finish_span().
 
  %% Stops `example_tracer'
  ok = jaeger_passage:stop_tracer(example_tracer).
  [] = passage_tracer_registry:which_tracers().
  [] = jaeger_passage_reporter:which_reporters().

stop_tracer/1

stop_tracer(Tracer::passage:tracer_id()) -> ok

Stops the tracer which has been started by start_tracer/3.


Generated by EDoc, Jan 23 2020, 22:32:01.