Skip to content

Commit b85e739

Browse files
author
Tristan Sloughter
committed
add explainer about resetting context after with_span
1 parent fd90b62 commit b85e739

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

apps/opentelemetry_api/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ and ending the Span when the `Fun` or body of the Elixir macro finish, even if
8282
an exception is thrown -- however, the exception is not caught, so it does not
8383
change how user code should deal with raised exceptions. After the Span is
8484
ended the Context in the process dictionary is reset to its value before the
85-
newly started Span was set as the active Span.
85+
newly started Span was set as the active Span. This handling of the active Span
86+
in the process dictionary ensures proper lineage of Spans is kept when starting
87+
and ending child Spans.
8688

8789
``` erlang
8890
?with_span(SpanName, StartOpts, Fun)
@@ -100,8 +102,10 @@ end
100102
[SpanKind](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/trace/api.md#spankind)
101103
defines the relationship between the Span, its parents, and its children in a
102104
Trace. Possible values: `internal`, `server`, `client`, `producer` and
103-
`consumer`.
104-
- `attributes`: [Attributes](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/common/common.md#attributes)
105+
`consumer`. Defaults to `internal` if not specified.
106+
- `attributes`: See
107+
[Attributes](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/common/common.md#attributes)
108+
for details about Attributes. Default is an empty list of attributes.
105109
- `links`: List of [Links](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/overview.md#links-between-spans) to causally related Spans from the same or a different Trace.
106110
- `start_time`: The start time of the Span operation. Defaults to the current
107111
time. The option should only be set if the start of the operation described by

0 commit comments

Comments
 (0)