Fix ctx return types for process_propagator functions (#114)
This commit is contained in:
parent
da912fd08b
commit
8e5d373477
|
@ -84,7 +84,7 @@ defmodule OpentelemetryProcessPropagator do
|
|||
@doc """
|
||||
Attempt to fetch an otel context from a give pid.
|
||||
"""
|
||||
@spec fetch_ctx(pid) :: OpenTelemetry.span_ctx() | :undefined
|
||||
@spec fetch_ctx(pid) :: OpenTelemetry.Ctx.t() | :undefined
|
||||
defdelegate fetch_ctx(pid), to: :opentelemetry_process_propagator
|
||||
|
||||
@doc """
|
||||
|
@ -92,14 +92,14 @@ defmodule OpentelemetryProcessPropagator do
|
|||
|
||||
This is equivalent to calling `fetch_parent_ctx(1, :"$ancestors")`
|
||||
"""
|
||||
@spec fetch_parent_ctx() :: OpenTelemetry.span_ctx() | :undefined
|
||||
@spec fetch_parent_ctx() :: OpenTelemetry.Ctx.t() | :undefined
|
||||
defdelegate fetch_parent_ctx(), to: :opentelemetry_process_propagator
|
||||
|
||||
@doc """
|
||||
Attempt to find an otel context in a spawning process within `n` number of parent
|
||||
processes
|
||||
"""
|
||||
@spec fetch_parent_ctx(non_neg_integer()) :: OpenTelemetry.span_ctx() | :undefined
|
||||
@spec fetch_parent_ctx(non_neg_integer()) :: OpenTelemetry.Ctx.t() | :undefined
|
||||
defdelegate fetch_parent_ctx(depth), to: :opentelemetry_process_propagator
|
||||
|
||||
@doc """
|
||||
|
@ -110,6 +110,6 @@ defmodule OpentelemetryProcessPropagator do
|
|||
Processes spawned by `proc_lib` are stored under `:"$ancestors`. The
|
||||
Elixir `Task` module uses the `:"$callers` key.
|
||||
"""
|
||||
@spec fetch_parent_ctx(non_neg_integer(), atom()) :: OpenTelemetry.span_ctx() | :undefined
|
||||
@spec fetch_parent_ctx(non_neg_integer(), atom()) :: OpenTelemetry.Ctx.t() | :undefined
|
||||
defdelegate fetch_parent_ctx(max_depth, key), to: :opentelemetry_process_propagator
|
||||
end
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
fetch_parent_ctx/1,
|
||||
fetch_parent_ctx/2]).
|
||||
|
||||
-spec fetch_parent_ctx() -> opentelemetry:span_ctx() | undefined.
|
||||
-spec fetch_parent_ctx() -> otel_ctx:t() | undefined.
|
||||
fetch_parent_ctx() ->
|
||||
fetch_parent_ctx(1, '$ancestors').
|
||||
|
||||
-spec fetch_parent_ctx(non_neg_integer()) -> opentelemetry:span_ctx() | undefined.
|
||||
-spec fetch_parent_ctx(non_neg_integer()) -> otel_ctx:t() | undefined.
|
||||
fetch_parent_ctx(MaxDepth) ->
|
||||
fetch_parent_ctx(MaxDepth, '$ancestors').
|
||||
|
||||
-spec fetch_parent_ctx(non_neg_integer(), atom()) -> opentelemetry:span_ctx() | undefined.
|
||||
-spec fetch_parent_ctx(non_neg_integer(), atom()) -> otel_ctx:t() | undefined.
|
||||
fetch_parent_ctx(MaxDepth, Key) ->
|
||||
Pids = pids(Key, pdict(self())),
|
||||
inspect_parent(undefined, lists:sublist(Pids, MaxDepth)).
|
||||
|
@ -30,7 +30,7 @@ inspect_parent(_Ctx, [Pid | Rest]) ->
|
|||
inspect_parent(OtelCtx, [])
|
||||
end.
|
||||
|
||||
-spec fetch_ctx(pid()) -> opentelemetry:span_ctx() | undefined.
|
||||
-spec fetch_ctx(pid()) -> otel_ctx:t() | undefined.
|
||||
fetch_ctx(Pid) ->
|
||||
case pdict(Pid) of
|
||||
undefined ->
|
||||
|
@ -48,7 +48,7 @@ pdict(Pid) ->
|
|||
undefined
|
||||
end.
|
||||
|
||||
-spec otel_ctx([{term(), term()}]) -> opentelemetry:span_ctx() | undefined.
|
||||
-spec otel_ctx([{term(), term()}]) -> otel_ctx:t() | undefined.
|
||||
otel_ctx(Dictionary) ->
|
||||
case lists:keyfind('$__current_otel_ctx', 1, Dictionary) of
|
||||
false ->
|
||||
|
|
Loading…
Reference in New Issue