open-telemetry / opentelemetry-erlang-api

Erlang/Elixir OpenTelemetry API
Apache License 2.0
60 stars 13 forks source link

add create_span and new end_span/2 #27

Closed tsloughter closed 4 years ago

tsloughter commented 4 years ago

The create_span function does not touch the underlying context and end_span/2 takes a span_ctx and also does not touch the underlying context.

tsloughter commented 4 years ago

Yea, I will in this PR, first verifying it with the spec. I'll also be adding it to the Elixir lib api in this PR once it is clear it is the way forward.

And you should not use end_span/2 with the return of start_span, so it is clearly important to make lots of distinctions in the docs :)

You technically can pass the return of start_span to end_span/2 but since start_span will update the current context to set it to active the user would have to handle that manually if they were to call end_span/2 with the returned SpanCtx.