@@ -148,13 +148,20 @@ set_default_tracer(Tracer) ->
148148
149149-spec set_tracer (atom (), tracer ()) -> boolean ().
150150set_tracer (Name , Tracer ) ->
151- verify_and_set_term ( Tracer , ? TRACER_KEY ( Name ), otel_tracer ).
151+ set_tracer ( Name , <<>>, undefined , Tracer ).
152152
153- -spec set_tracer (atom (), unicode :unicode_binary (), uri_string :uri_string (), tracer ()) -> boolean ().
153+ -spec set_tracer (Name , Vsn , SchemaUrl , Tracer ) -> boolean () when
154+ Name :: atom (),
155+ Vsn :: unicode :chardata () | undefined ,
156+ SchemaUrl :: uri_string :uri_string () | undefined ,
157+ Tracer :: opentelemetry :tracer ().
154158set_tracer (Name , Vsn , SchemaUrl , Tracer ) ->
155159 verify_and_set_term (Tracer , ? TRACER_KEY ({Name , Vsn , SchemaUrl }), otel_tracer ).
156160
157- -spec create_application_tracers ([{atom (), string (), string ()}]) -> ok .
161+ -spec create_application_tracers ([{Application , Description , Vsn }]) -> ok when
162+ Application :: atom (),
163+ Description :: string (),
164+ Vsn :: string ().
158165create_application_tracers (Applications ) ->
159166 TracerMap = lists :foldl (fun ({Name , _Description , Version }, Acc ) ->
160167 Vsn = vsn_to_binary (Version ),
@@ -175,15 +182,23 @@ module_to_application(Name, Version, SchemaUrl) ->
175182get_tracer () ->
176183 persistent_term :get (? DEFAULT_TRACER_KEY , {otel_tracer_noop , []}).
177184
178- -spec get_tracer (atom () | {atom (), unicode :chardata (), uri_string :uri_string ()}) -> tracer ().
185+ -spec get_tracer (Name ) -> Tracer when
186+ Name :: atom () | {Name , Vsn , SchemaUrl },
187+ Vsn :: unicode :chardata () | undefined ,
188+ SchemaUrl :: uri_string :uri_string () | undefined ,
189+ Tracer :: opentelemetry :tracer ().
179190get_tracer ('$__default_tracer' ) ->
180191 get_tracer ();
181192get_tracer ({Name , Vsn , SchemaUrl }) ->
182193 get_tracer (Name , Vsn , SchemaUrl );
183194get_tracer (Name ) ->
184195 get_tracer (Name , undefined , undefined ).
185196
186- -spec get_tracer (atom (), unicode :chardata (), uri_string :uri_string ()) -> tracer ().
197+ -spec get_tracer (Name , Vsn , SchemaUrl ) -> Tracer when
198+ Name :: atom (),
199+ Vsn :: unicode :chardata () | undefined ,
200+ SchemaUrl :: uri_string :uri_string () | undefined ,
201+ Tracer :: opentelemetry :tracer ().
187202get_tracer (Name , Vsn , SchemaUrl ) ->
188203 % % check cache and then use provider to get the tracer if it isn't cached yet
189204 case persistent_term :get (? TRACER_KEY ({Name , Vsn , SchemaUrl }), undefined ) of
@@ -203,10 +218,14 @@ get_tracer(Name, Vsn, SchemaUrl) ->
203218get_application_tracer (ModuleName ) ->
204219 get_tracer (get_application (ModuleName )).
205220
206- % % looks up the name of the OTP Application a module is in. This name is used to
207- % % look up a Tracer to use so if none is found for the ModuleName the key used for
208- % % the default tracer
209- -spec get_application (module ()) -> {atom (), unicode :unicode_binary () | undefined , uri_string :uri_string () | undefined } | atom ().
221+ % % looks up the name, version and schema_url used to create a Trace for the OTP
222+ % % Application a module is in. This name is used to look up a Tracer to use so
223+ % % if none is found for the ModuleName the key used for the default tracer.
224+ -spec get_application (module ()) -> ApplicationTuple when
225+ ApplicationTuple :: {Name , Vsn , SchemaUrl } | atom (),
226+ Name :: atom (),
227+ Vsn :: unicode :unicode_binary () | undefined ,
228+ SchemaUrl :: uri_string :uri_string () | undefined .
210229get_application (ModuleName ) ->
211230 Map = persistent_term :get (? MODULE_TO_APPLICATION_KEY , #{}),
212231 maps :get (ModuleName , Map , '$__default_tracer' ).
0 commit comments