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