otter API module. Use the API in this module to interact with
the otter
application.
The module covers 3 APIs. The Span API
, Snapshot/Count API
and
Config API
.
The module exposes the functional span API.
These API calls allow you to create and manage spans. These are:
start/1, start/2, start/3
start_with_tags/2, start_with_tags/3, start_with_tags/4
finish/1
ids/1
log/2, log/3
tag/3, tag/4
The API supports pre-filtering of spans with the start_with_tags functions. Pre-filtering is invoked when the span is started with initial tags. The result of the pre filter rules can be an inactive span. Inactive spans do not trigger the rules when finishing the span (i.e. always discarded) and consume somewhat less resources (depending on the API) than gathering active spans.
There are additional span APIs developed for specific use cases to
simplify instrumentations for different code bases. These
are accessible in separate modules.
- simple process dictionary API : otter_span_pdict_api
- multi span process dictionary API : otter_span_mpdict_api
- span id/process API : otter_span_id_api
For further information on these APIs, check the documentation of the
modules
When finish/1
is called then the completed span is
passed to a configurable filter. The filter can check the Span tags
as well as the name and duration of the span and use the information
to decide to send the Span to the trace collector (Zipkin supported)
and/or increase counters based on values of the tags and store the
last Span for the counters. This latter is particularly useful for
troubleshooting e.g. error events when increase of the corresponding
counter is noticed. These snapshots (referred as Snap) and counters
can be retrieved, managed with this API. These are:
counter_list/0
counter_snapshot/1
counter_delete/1
counter_delete_all/0
otter.app`
file as a reference. These are:<br/>
`config_list/0
config_read/1
config_read/2
config_write/2
config_list/0 | List all defined configuration. |
config_read/1 | Read a configuration value. |
config_read/2 | Read a configuration value with default. |
config_write/2 | Write a configuration value. |
counter_delete/1 | Delete (reset) a counter. |
counter_delete_all/0 | Delete (reset) all counters. |
counter_list/0 | List all the snapshot counters. |
counter_snapshot/1 | Show the last event snapshot of a counter. |
finish/1 | Ends an active span and prepares it for potential delivery to the backend based on filtering rules. |
ids/1 | Returns the trace id and span id for a given span. |
log/2 | Adds a log message to a span. |
log/3 | Adds a log message to a span with the specified service information. |
start/1 | Starts a span with the specified name. |
start/2 | Starts a span with the specified name and parent span or a trace id. |
start/3 | Starts a child span with the specified name, trace id and parent id. |
start_with_tags/2 | Starts a span with the specified name and initial tags. |
start_with_tags/3 | Starts a span with the specified name, initial tags and trace id or a parent span. |
start_with_tags/4 | Starts a child span with the specified name, trace id and parent id. |
tag/3 | Adds a tag to a span. |
tag/4 | Adds a tag to a span with a given service. |
config_list() -> term()
List all defined configuration
config_read(Key::atom()) -> term()
Read a configuration value
config_read(Key::atom(), Default::term()) -> term()
Read a configuration value with default
config_write(Key::atom(), Value::term()) -> ok
Write a configuration value. Note : With the default config implementation this write is not persistent. Update the application environment/config accordingly to persist.
counter_delete(Key::term()) -> ok
Delete (reset) a counter
counter_delete_all() -> ok
Delete (reset) all counters
counter_list() -> [{term(), integer()}]
List all the snapshot counters
counter_snapshot(Key::term()) -> term()
Show the last event snapshot of a counter
finish(Span::span()) -> ok
Ends an active span and prepares it for potential delivery to the backend based on filtering rules.
ids(Span::span()) -> {trace_id(), span_id()}
Returns the trace id and span id for a given span.
Adds a log message to a span. If the span is not active, the tag is not added.
Adds a log message to a span with the specified service information. If the span is not active, the tag is not added.
Starts a span with the specified name. Automatically generates a trace id.
Starts a span with the specified name and parent span or a trace id
Starts a child span with the specified name, trace id and parent id
start_with_tags(Name, Tags) -> any()
Starts a span with the specified name and initial tags. Automatically generates a trace id and invokes pre filtering.
Starts a span with the specified name, initial tags and trace id or a parent span
start_with_tags(Name::info(), Tags::[tag()], TraceId::trace_id(), ParentId::span_id()) -> span()
Starts a child span with the specified name, trace id and parent id
Adds a tag to a span. If the tag already exists, its value will be overwritten.
Adds a tag to a span with a given service. If the tag already exists, its value will be overwritten.
Generated by EDoc, May 26 2017, 15:36:09.