Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

fix docs #165

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# OpenCensus Erlang library #

__Version:__ 0.5.0
__Version:__ 0.9.3

## Erlang stats collection and distributed tracing framework

Expand Down
11 changes: 5 additions & 6 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,12 @@ $ rebar3 protobuf compile
<table width="100%" border="0" summary="list of modules">
<tr><td><a href="oc_producer.md" class="module">oc_producer</a></td></tr>
<tr><td><a href="oc_producer_registry.md" class="module">oc_producer_registry</a></td></tr>
<tr><td><a href="oc_propagation_binary.md" class="module">oc_propagation_binary</a></td></tr>
<tr><td><a href="oc_propagation_http_b3.md" class="module">oc_propagation_http_b3</a></td></tr>
<tr><td><a href="oc_propagation_http_tracecontext.md" class="module">oc_propagation_http_tracecontext</a></td></tr>
<tr><td><a href="oc_reporter.md" class="module">oc_reporter</a></td></tr>
<tr><td><a href="oc_reporter_noop.md" class="module">oc_reporter_noop</a></td></tr>
<tr><td><a href="oc_reporter_sequential.md" class="module">oc_reporter_sequential</a></td></tr>
<tr><td><a href="oc_reporter_pid.md" class="module">oc_reporter_pid</a></td></tr>
<tr><td><a href="oc_reporter_stdout.md" class="module">oc_reporter_stdout</a></td></tr>
<tr><td><a href="oc_reporter_zipkin.md" class="module">oc_reporter_zipkin</a></td></tr>
<tr><td><a href="oc_sampler.md" class="module">oc_sampler</a></td></tr>
<tr><td><a href="oc_sampler_always.md" class="module">oc_sampler_always</a></td></tr>
<tr><td><a href="oc_sampler_impl.md" class="module">oc_sampler_impl</a></td></tr>
Expand All @@ -194,8 +195,6 @@ $ rebar3 protobuf compile
<tr><td><a href="oc_self_producer.md" class="module">oc_self_producer</a></td></tr>
<tr><td><a href="oc_server.md" class="module">oc_server</a></td></tr>
<tr><td><a href="oc_span.md" class="module">oc_span</a></td></tr>
<tr><td><a href="oc_span_ctx_binary.md" class="module">oc_span_ctx_binary</a></td></tr>
<tr><td><a href="oc_span_ctx_header.md" class="module">oc_span_ctx_header</a></td></tr>
<tr><td><a href="oc_span_sweeper.md" class="module">oc_span_sweeper</a></td></tr>
<tr><td><a href="oc_span_transform.md" class="module">oc_span_transform</a></td></tr>
<tr><td><a href="oc_stat.md" class="module">oc_stat</a></td></tr>
Expand All @@ -211,11 +210,11 @@ $ rebar3 protobuf compile
<tr><td><a href="oc_stat_transform.md" class="module">oc_stat_transform</a></td></tr>
<tr><td><a href="oc_stat_unit.md" class="module">oc_stat_unit</a></td></tr>
<tr><td><a href="oc_stat_view.md" class="module">oc_stat_view</a></td></tr>
<tr><td><a href="oc_std_encoder.md" class="module">oc_std_encoder</a></td></tr>
<tr><td><a href="oc_tag_ctx_binary.md" class="module">oc_tag_ctx_binary</a></td></tr>
<tr><td><a href="oc_tag_ctx_header.md" class="module">oc_tag_ctx_header</a></td></tr>
<tr><td><a href="oc_tags.md" class="module">oc_tags</a></td></tr>
<tr><td><a href="oc_trace.md" class="module">oc_trace</a></td></tr>
<tr><td><a href="oc_tracestate.md" class="module">oc_tracestate</a></td></tr>
<tr><td><a href="ocp.md" class="module">ocp</a></td></tr>
<tr><td><a href="opencensus.md" class="module">opencensus</a></td></tr>
<tr><td><a href="opencensus_app.md" class="module">opencensus_app</a></td></tr>
Expand Down
2 changes: 1 addition & 1 deletion doc/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ make

# fix internal doc links
sed -i 's/https:\/\/github\.com\/doc\/\(.*\)\.md/\1.html/g' *.html
sed -i 's/\"\([a-zA-Z_-]*\)\.md\([a-zA-Z_-#]*\)\"/\"\1.html\2\"/g' *.html
sed -i 's/\"\([a-zA-Z_-]*\)\.md\([a-zA-Z_#-]*\)\"/\"\1.html\2\"/g' *.html
sed -i 's/\"doc\/\([a-zA-Z_-]*\)\.md\"/\"\1.html\"/g' *.html
sed -i 's/\"\([a-zA-Z_-]*\)\.md\"/\"\1.html\"/g' *.html
sed -i 's/<br \/>//g' *.html
Expand Down
14 changes: 7 additions & 7 deletions doc/edoc-info
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
%% encoding: UTF-8
{application,opencensus}.
{modules,[oc_producer,oc_producer_registry,oc_reporter,oc_reporter_noop,
oc_reporter_sequential,oc_reporter_stdout,oc_reporter_zipkin,
oc_sampler,oc_sampler_always,oc_sampler_impl,oc_sampler_never,
oc_sampler_period_or_count,oc_sampler_probability,oc_self_producer,
oc_server,oc_span,oc_span_ctx_binary,oc_span_ctx_header,
{modules,[oc_producer,oc_producer_registry,oc_propagation_binary,
oc_propagation_http_b3,oc_propagation_http_tracecontext,oc_reporter,
oc_reporter_pid,oc_reporter_stdout,oc_sampler,oc_sampler_always,
oc_sampler_impl,oc_sampler_never,oc_sampler_period_or_count,
oc_sampler_probability,oc_self_producer,oc_server,oc_span,
oc_span_sweeper,oc_span_transform,oc_stat,oc_stat_aggregation,
oc_stat_aggregation_count,oc_stat_aggregation_distribution,
oc_stat_aggregation_latest,oc_stat_aggregation_sum,oc_stat_config,
oc_stat_exporter,oc_stat_exporter_stdout,oc_stat_measure,
oc_stat_transform,oc_stat_unit,oc_stat_view,oc_std_encoder,
oc_tag_ctx_binary,oc_tag_ctx_header,oc_tags,oc_trace,ocp,opencensus,
oc_stat_transform,oc_stat_unit,oc_stat_view,oc_tag_ctx_binary,
oc_tag_ctx_header,oc_tags,oc_trace,oc_tracestate,ocp,opencensus,
opencensus_app,opencensus_sup]}.
35 changes: 13 additions & 22 deletions doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# OpenCensus Erlang library #

__Version:__ 0.5.0
__Version:__ 0.9.3

## Erlang stats collection and distributed tracing framework

Expand Down Expand Up @@ -52,33 +52,33 @@ some_fun() ->
end).
```

More details on working with spans can be found [here](span.md) and in the modules documentation for [ocp](ocp.md), [oc_trace](oc_trace.md) and [oc_span](oc_span.md).
More details on working with spans can be found [here](doc/span.md) and in the modules documentation for [ocp](doc/ocp.md), [oc_trace](doc/oc_trace.md) and [oc_span](doc/oc_span.md).

#### <a name="Propagating_Span_Context">Propagating Span Context</a> ####

Opencensus comes with two forms of span context encoding for sending over the wire. `oc_span_ctx_header` encodes a span context suitable for transfering as an HTTP header and `oc_span_ctx_binary` will encode and decode a binary form used in GRPC and other binary protocols.
Builtin support for encoding and decoding span context from HTTP headers comes in two formats:

For example, creating the header for sending with an HTTP client might look like:
* [W3C Trace Context](https://www.w3.org/TR/trace-context/)
* [B3](https://github.com/openzipkin/b3-propagation)

```erlang
EncodedSpanCtx = oc_span_ctx_header:encode(ocp:current_span_ctx()),
Headers = [{oc_span_ctx_header:field_name(), EncodedSpanCtx}],
```
Additionally `oc_propagation_binary` will encode and decode a binary form used for GRPC and other binary protocols.

#### <a name="Samplers">Samplers</a> ####

[oc_sampler_never](oc_sampler_never.md): Never enable a new trace, but keeps a trace enabled if its propagated context is enabled.
[oc_sampler_never](doc/oc_sampler_never.md): Never enable a new trace, but keeps a trace enabled if its propagated context is enabled.

[oc_sampler_always](oc_sampler_always.md): Enable every new trace for sampling.
[oc_sampler_always](doc/oc_sampler_always.md): Enable every new trace for sampling.

[oc_sampler_probability](oc_sampler_probability.md): Takes a probability, default 0.5, that any new trace will be sampled.
[oc_sampler_probability](doc/oc_sampler_probability.md): Takes a probability, default 0.5, that any new trace will be sampled.


#### <a name="Reporters">Reporters</a> ####

[Google Cloud Trace](https://github.com/tsloughter/oc_google_reporter): Support for v1 in master, v2 and grpc coming soon;
[Zipkin](https://github.com/opencensus-beam/opencensus_zipkin): Zipkin v2 reporter.

[Prometheus](https://github.com/deadtrickster/opencensus-erlang-prometheus): Exports spans as Prometheus metrics.
[Google Cloud Trace](https://github.com/opencensus-beam/oc_google_reporter): Support for v1 in master, v2 and grpc coming soon;

[Prometheus](https://github.com/opencensus-beam/prometheus): Exports spans as Prometheus metrics.

[DataDog][oc_datadog]: Export spans to DataDog APM

Expand Down Expand Up @@ -185,13 +185,4 @@ Running tests:
$ rebar3 ct
```

#### Updating OpenCensus standard protobuf encoder and decoder

Language independent interface types for Census are found in the `opencensus-proto` repo. The opencensus Erlang app provides functionality for converting from the apps internal representation to the standard protobuf interface. Below are the steps to update the Erlang module and header for encoding and decoding the protobufs:

```sh
$ git clone https://github.com/census-instrumentation/opencensus-proto priv/opencensus-proto
$ rebar3 protobuf compile
```

[oc_datadog]: https://github.com/hauleth/oc_datadog
22 changes: 21 additions & 1 deletion doc/oc_reporter.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ __This module defines the `oc_reporter` behaviour.__<br /> Required callback fun
## Function Index ##


<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#code_change-3">code_change/3</a></td><td></td></tr><tr><td valign="top"><a href="#handle_call-3">handle_call/3</a></td><td></td></tr><tr><td valign="top"><a href="#handle_cast-2">handle_cast/2</a></td><td></td></tr><tr><td valign="top"><a href="#handle_info-2">handle_info/2</a></td><td></td></tr><tr><td valign="top"><a href="#init-1">init/1</a></td><td></td></tr><tr><td valign="top"><a href="#start_link-0">start_link/0</a></td><td></td></tr><tr><td valign="top"><a href="#store_span-1">store_span/1</a></td><td></td></tr><tr><td valign="top"><a href="#terminate-2">terminate/2</a></td><td></td></tr></table>
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#code_change-3">code_change/3</a></td><td></td></tr><tr><td valign="top"><a href="#handle_call-3">handle_call/3</a></td><td></td></tr><tr><td valign="top"><a href="#handle_cast-2">handle_cast/2</a></td><td></td></tr><tr><td valign="top"><a href="#handle_info-2">handle_info/2</a></td><td></td></tr><tr><td valign="top"><a href="#init-1">init/1</a></td><td></td></tr><tr><td valign="top"><a href="#register-1">register/1</a></td><td>Equivalent to <a href="#register-2"><tt>register(Reporter, [])</tt></a>.</td></tr><tr><td valign="top"><a href="#register-2">register/2</a></td><td>
Register new traces reporter <code>Reporter</code> with <code>Config</code>.</td></tr><tr><td valign="top"><a href="#start_link-0">start_link/0</a></td><td></td></tr><tr><td valign="top"><a href="#store_span-1">store_span/1</a></td><td></td></tr><tr><td valign="top"><a href="#terminate-2">terminate/2</a></td><td></td></tr></table>


<a name="functions"></a>
Expand Down Expand Up @@ -54,6 +55,25 @@ __This module defines the `oc_reporter` behaviour.__<br /> Required callback fun

`init(Args) -> any()`

<a name="register-1"></a>

### register/1 ###

`register(Reporter) -> any()`

Equivalent to [`register(Reporter, [])`](#register-2).

<a name="register-2"></a>

### register/2 ###

<pre><code>
register(Reporter::module(), Options::term()) -&gt; ok
</code></pre>
<br />

Register new traces reporter `Reporter` with `Config`.

<a name="start_link-0"></a>

### start_link/0 ###
Expand Down
8 changes: 4 additions & 4 deletions doc/oc_span.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ maybe(T) = T | undefined
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#add_link-2">add_link/2</a></td><td>
Add a Link to the list of Links in the span.</td></tr><tr><td valign="top"><a href="#add_time_event-2">add_time_event/2</a></td><td>
Add an Annotation or MessageEvent to the list of TimeEvents in a span.</td></tr><tr><td valign="top"><a href="#add_time_event-3">add_time_event/3</a></td><td></td></tr><tr><td valign="top"><a href="#annotation-2">annotation/2</a></td><td>
Create an Annotation.</td></tr><tr><td valign="top"><a href="#finish_span-1">finish_span/1</a></td><td>
Create an Annotation.</td></tr><tr><td valign="top"><a href="#finish_span-2">finish_span/2</a></td><td>
Finish a span, setting the end_time and sending to the reporter.</td></tr><tr><td valign="top"><a href="#link-4">link/4</a></td><td>
Create a Link which can be added to a Span.</td></tr><tr><td valign="top"><a href="#message_event-4">message_event/4</a></td><td>
Create a MessageEvent.</td></tr><tr><td valign="top"><a href="#put_attribute-3">put_attribute/3</a></td><td>
Expand Down Expand Up @@ -85,12 +85,12 @@ annotation(Description, Attributes) -&gt; Annotation

Create an Annotation.

<a name="finish_span-1"></a>
<a name="finish_span-2"></a>

### finish_span/1 ###
### finish_span/2 ###

<pre><code>
finish_span(Span::<a href="#type-maybe">maybe</a>(<a href="opencensus.md#type-span">opencensus:span()</a>)) -&gt; true
finish_span(Span_ctx::<a href="opencensus.md#type-span_ctx">opencensus:span_ctx()</a>, Span::<a href="#type-maybe">maybe</a>(<a href="opencensus.md#type-span">opencensus:span()</a>)) -&gt; true
</code></pre>
<br />

Expand Down
6 changes: 3 additions & 3 deletions doc/oc_trace.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Return the current span context in a `Ctx` or `undefined`.
### finish_span/1 ###

<pre><code>
finish_span(Span_ctx::<a href="#type-maybe">maybe</a>(<a href="opencensus.md#type-span_ctx">opencensus:span_ctx()</a>)) -&gt; boolean()
finish_span(SpanCtx::<a href="#type-maybe">maybe</a>(<a href="opencensus.md#type-span_ctx">opencensus:span_ctx()</a>)) -&gt; boolean()
</code></pre>
<br />

Expand Down Expand Up @@ -220,7 +220,7 @@ Set Status. Returns true if the data was successfully updated.
start_span(Name, SpanCtx) -&gt; SpanCtx
</code></pre>

<ul class="definitions"><li><code>Name = <a href="unicode.md#type-unicode_binary">unicode:unicode_binary()</a></code></li><li><code>SpanCtx = <a href="opencensus.md#type-span_ctx">opencensus:span_ctx()</a></code></li></ul>
<ul class="definitions"><li><code>Name = <a href="unicode.md#type-unicode_binary">unicode:unicode_binary()</a></code></li><li><code>SpanCtx = <a href="opencensus.md#type-span_ctx">opencensus:span_ctx()</a> | undefined</code></li></ul>

Create a new span, detached from any context.

Expand All @@ -232,7 +232,7 @@ Create a new span, detached from any context.
start_span(Name, SpanCtx, Options) -&gt; SpanCtx
</code></pre>

<ul class="definitions"><li><code>Name = <a href="unicode.md#type-unicode_binary">unicode:unicode_binary()</a></code></li><li><code>SpanCtx = <a href="opencensus.md#type-span_ctx">opencensus:span_ctx()</a></code></li><li><code>Options = #{remote_parent =&gt; boolean(), sampler =&gt; module(), kind =&gt; <a href="opencensus.md#type-span_kind">opencensus:span_kind()</a>, attributes =&gt; <a href="opencensus.md#type-attributes">opencensus:attributes()</a>}</code></li></ul>
<ul class="definitions"><li><code>Name = <a href="unicode.md#type-unicode_binary">unicode:unicode_binary()</a></code></li><li><code>SpanCtx = <a href="opencensus.md#type-span_ctx">opencensus:span_ctx()</a> | undefined</code></li><li><code>Options = #{remote_parent =&gt; boolean(), sampler =&gt; module(), kind =&gt; <a href="opencensus.md#type-span_kind">opencensus:span_kind()</a>, attributes =&gt; <a href="opencensus.md#type-attributes">opencensus:attributes()</a>}</code></li></ul>

<a name="with_child_span-2"></a>

Expand Down
14 changes: 12 additions & 2 deletions doc/opencensus.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ message_event_type() = TYPE_UNSPECIFIED | SENT | RECEIVED


<pre><code>
span() = #span{name = <a href="unicode.md#type-unicode_binary">unicode:unicode_binary()</a>, trace_id = <a href="opencensus.md#type-trace_id">opencensus:trace_id()</a> | undefined, span_id = <a href="opencensus.md#type-span_id">opencensus:span_id()</a> | undefined, parent_span_id = <a href="opencensus.md#type-span_id">opencensus:span_id()</a> | undefined, trace_options = integer() | undefined, kind = <a href="opencensus.md#type-span_kind">opencensus:span_kind()</a>, start_time = <a href="wts.md#type-timestamp">wts:timestamp()</a>, end_time = <a href="wts.md#type-timestamp">wts:timestamp()</a> | undefined, attributes = <a href="opencensus.md#type-attributes">opencensus:attributes()</a>, stack_trace = <a href="opencensus.md#type-stack_trace">opencensus:stack_trace()</a> | undefined, links = <a href="opencensus.md#type-links">opencensus:links()</a>, time_events = <a href="opencensus.md#type-time_events">opencensus:time_events()</a>, status = <a href="opencensus.md#type-status">opencensus:status()</a> | undefined, same_process_as_parent_span = boolean() | undefined, child_span_count = integer() | undefined}
span() = #span{name = <a href="unicode.md#type-unicode_binary">unicode:unicode_binary()</a>, trace_id = <a href="opencensus.md#type-trace_id">opencensus:trace_id()</a> | undefined, span_id = <a href="opencensus.md#type-span_id">opencensus:span_id()</a> | undefined, parent_span_id = <a href="opencensus.md#type-span_id">opencensus:span_id()</a> | undefined, tracestate = <a href="opencensus.md#type-tracestate">opencensus:tracestate()</a> | undefined, trace_options = integer() | undefined, kind = <a href="opencensus.md#type-span_kind">opencensus:span_kind()</a>, start_time = <a href="wts.md#type-timestamp">wts:timestamp()</a>, end_time = <a href="wts.md#type-timestamp">wts:timestamp()</a> | undefined, attributes = <a href="opencensus.md#type-attributes">opencensus:attributes()</a>, stack_trace = <a href="opencensus.md#type-stack_trace">opencensus:stack_trace()</a> | undefined, links = <a href="opencensus.md#type-links">opencensus:links()</a>, time_events = <a href="opencensus.md#type-time_events">opencensus:time_events()</a>, status = <a href="opencensus.md#type-status">opencensus:status()</a> | undefined, same_process_as_parent_span = boolean() | undefined, child_span_count = integer() | undefined}
</code></pre>


Expand All @@ -109,7 +109,7 @@ span() = #span{name = <a href="unicode.md#type-unicode_binary">unicode:unicode_b


<pre><code>
span_ctx() = #span_ctx{trace_id = <a href="opencensus.md#type-trace_id">opencensus:trace_id()</a> | undefined, span_id = <a href="opencensus.md#type-span_id">opencensus:span_id()</a> | undefined, trace_options = integer() | undefined}
span_ctx() = #span_ctx{trace_id = <a href="opencensus.md#type-trace_id">opencensus:trace_id()</a> | undefined, span_id = <a href="opencensus.md#type-span_id">opencensus:span_id()</a> | undefined, trace_options = integer() | undefined, tracestate = <a href="opencensus.md#type-tracestate">opencensus:tracestate()</a> | undefined}
</code></pre>


Expand Down Expand Up @@ -172,6 +172,16 @@ time_events() = [{<a href="wts.md#type-timestamp">wts:timestamp()</a>, <a href="
trace_id() = non_neg_integer()
</code></pre>




### <a name="type-tracestate">tracestate()</a> ###


<pre><code>
tracestate() = #tracestate{entries = [{<a href="unicode.md#type-latin1_chardata">unicode:latin1_chardata()</a>, <a href="unicode.md#type-latin1_chardata">unicode:latin1_chardata()</a>}]}
</code></pre>

<a name="index"></a>

## Function Index ##
Expand Down
9 changes: 7 additions & 2 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{"1.1.0",
{"1.2.0",
[{<<"counters">>,{pkg,<<"counters">>,<<"0.2.1">>},0},
{<<"ctx">>,{pkg,<<"ctx">>,<<"0.5.0">>},0},
{<<"rfc3339">>,{pkg,<<"rfc3339">>,<<"0.9.0">>},1},
Expand All @@ -8,5 +8,10 @@
{<<"counters">>, <<"AA3D97E88F92573488987193D0F48EFCE0F3B2CD1443BF4EE760BC7F99322F0C">>},
{<<"ctx">>, <<"78E0F16712E12D707A7F34277381B8E193D7C71EAA24D37330DC02477C09EDA5">>},
{<<"rfc3339">>, <<"2075653DC9407541C84B1E15F8BDA2ABE95FB17C9694025E079583F2D19C1060">>},
{<<"wts">>, <<"5CDF22C775CB1EBAE24C326A5DB6074D753C42F4BD12A9AA47CC62D3E2C71AD1">>}]}
{<<"wts">>, <<"5CDF22C775CB1EBAE24C326A5DB6074D753C42F4BD12A9AA47CC62D3E2C71AD1">>}]},
{pkg_hash_ext,[
{<<"counters">>, <<"A020C714992F7DB89178D27E1F39909E5D77DA3B80DAA4D6015877ED0C94B8AB">>},
{<<"ctx">>, <<"52554D80F9D93B3F82DBA8E1776E8EA87B0D6218AE94BA0F73D61AD1579AED08">>},
{<<"rfc3339">>, <<"182314DE35C9F4180B22EB5F22916D8D7A799C1109A060C752970273A9332AD6">>},
{<<"wts">>, <<"97E2C65F17BCD488FCBE0B7073296FEE7A6AFCFA837C8ED10FB15E65A8713F02">>}]}
].
2 changes: 1 addition & 1 deletion src/oc_reporter.erl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ start_link() ->
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).

%% @doc
%% @equiv register(Reporter, []).
%% @equiv register(Reporter, [])
%% @end
register(Reporter) -> register(Reporter, []).

Expand Down