open-telemetry / opentelemetry-erlang-api

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

new registeration, plus add set_span/2, end_span/2 and replace otel with macros in tracer.hrl #17

Closed tsloughter closed 4 years ago

tsloughter commented 4 years ago

Maybe there should only be register_tracer and it checks if the name is an Application or not? But in this PR it is a new function register_application_tracer which gets all modules for the application and passes them to the SDK's registration implementation.

The model otel has been replaced by macros which get the tracer by using the current module as the name of the tracer -- the modules we pass to registration in the SDK are made able to be looked up and find the tracer, if not found the default tracer is returned.

This also adds set_span to replace the old with_span and updates with_span to start and end a span.

end_span/2 is added which can be passed a tracer context. This is used in the updates to the SDK that will be coming in a PR.

Elixir macros still need to be added to match the Erlang macros.

tsloughter commented 4 years ago

Merging even though this still needs work. The registration part is important and is part of the new Elixir API PR I'll be opening in a minute.