|
43 | 43 | -callback start_span(otel_ctx:t(), |
44 | 44 | opentelemetry:tracer(), |
45 | 45 | opentelemetry:span_name(), |
46 | | - otel_span:start_opts()) -> opentelemetry:span_ctx() | undefined. |
| 46 | + otel_span:start_opts()) -> opentelemetry:span_ctx(). |
47 | 47 | -callback with_span(otel_ctx:t(), opentelemetry:tracer(), |
48 | | - opentelemetry:span_name(), otel_span:start_opts(), traced_fun(T)) -> T | any(). |
| 48 | + opentelemetry:span_name(), otel_span:start_opts(), traced_fun(T)) -> T. |
49 | 49 |
|
50 | 50 | -spec start_span(opentelemetry:tracer(), opentelemetry:span_name(), otel_span:start_opts()) |
51 | | - -> opentelemetry:span_ctx() | undefined. |
| 51 | + -> opentelemetry:span_ctx(). |
52 | 52 | start_span(Tracer={Module, _}, SpanName, Opts) -> |
53 | 53 | case otel_span:is_valid_name(SpanName) of |
54 | 54 | true -> |
55 | 55 | Module:start_span(otel_ctx:get_current(), Tracer, SpanName, otel_span:validate_start_opts(Opts)); |
56 | 56 | false -> |
57 | | - undefind |
| 57 | + otel_tracer_noop:noop_span_ctx() |
58 | 58 | end. |
59 | 59 |
|
60 | 60 | -spec start_span(otel_ctx:t(), opentelemetry:tracer(), opentelemetry:span_name(), otel_span:start_opts()) |
61 | | - -> opentelemetry:span_ctx() | undefined. |
| 61 | + -> opentelemetry:span_ctx(). |
62 | 62 | start_span(Ctx, Tracer={Module, _}, SpanName, Opts) -> |
63 | 63 | case otel_span:is_valid_name(SpanName) of |
64 | 64 | true -> |
65 | 65 | Module:start_span(Ctx, Tracer, SpanName, otel_span:validate_start_opts(Opts)); |
66 | 66 | false -> |
67 | | - undefined |
| 67 | + otel_tracer_noop:noop_span_ctx() |
68 | 68 | end. |
69 | 69 |
|
70 | | --spec with_span(opentelemetry:tracer(), opentelemetry:span_name(), otel_span:start_opts(), traced_fun(T)) -> T | any(). |
| 70 | +-spec with_span(opentelemetry:tracer(), opentelemetry:span_name(), otel_span:start_opts(), traced_fun(T)) -> T. |
71 | 71 | with_span(Tracer={Module, _}, SpanName, Opts, Fun) when is_atom(Module) -> |
72 | 72 | case otel_span:is_valid_name(SpanName) of |
73 | 73 | true -> |
74 | 74 | Module:with_span(otel_ctx:get_current(), Tracer, SpanName, otel_span:validate_start_opts(Opts), Fun); |
75 | 75 | false -> |
76 | | - Fun() |
| 76 | + Fun(otel_tracer_noop:noop_span_ctx()) |
77 | 77 | end. |
78 | 78 |
|
79 | | --spec with_span(otel_ctx:t(), opentelemetry:tracer(), opentelemetry:span_name(), otel_span:start_opts(), traced_fun(T)) -> T | any(). |
| 79 | +-spec with_span(otel_ctx:t(), opentelemetry:tracer(), opentelemetry:span_name(), otel_span:start_opts(), traced_fun(T)) -> T. |
80 | 80 | with_span(Ctx, Tracer={Module, _}, SpanName, Opts, Fun) when is_atom(Module) -> |
81 | 81 | case otel_span:is_valid_name(SpanName) of |
82 | 82 | true -> |
83 | 83 | Module:with_span(Ctx, Tracer, SpanName, otel_span:validate_start_opts(Opts), Fun); |
84 | 84 | false -> |
85 | | - Fun() |
| 85 | + Fun(otel_tracer_noop:noop_span_ctx()) |
86 | 86 | end. |
87 | 87 |
|
88 | 88 | %% @doc Returns a `span_ctx' record with `is_recording' set to `false'. This is mainly |
|
0 commit comments