Skip to content

Commit b1cef35

Browse files
Jez-Aclaude
andcommitted
refactor: Remove unused valid_active_span?/0 public function
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent da169c4 commit b1cef35

2 files changed

Lines changed: 0 additions & 31 deletions

File tree

‎lib/zexbox/open_telemetry.ex‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,6 @@ defmodule Zexbox.OpenTelemetry do
2323
@grafana_host "zappi.grafana.net"
2424
@kibana_host "zappi.tools"
2525

26-
@doc "Returns `true` when the current OTEL span context is valid (non-zero trace ID)."
27-
@spec valid_active_span?() :: boolean()
28-
def valid_active_span? do
29-
case get_span_context() do
30-
nil -> false
31-
context -> :otel_span.is_valid(context)
32-
end
33-
rescue
34-
_e -> false
35-
end
36-
3726
@doc """
3827
Returns a Grafana Tempo trace URL for the current span, or `nil` if no active span
3928
or if the environment is not `:production` or `:sandbox`.

‎test/zexbox/open_telemetry_test.exs‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,6 @@ defmodule Zexbox.OpenTelemetryTest do
3939
:ok
4040
end
4141

42-
describe "valid_active_span?/0" do
43-
test "returns true when the current span is valid" do
44-
with_active_span(fn ->
45-
assert OpenTelemetry.valid_active_span?() == true
46-
end)
47-
end
48-
49-
test "returns false when there is no active span" do
50-
with_no_span(fn ->
51-
assert OpenTelemetry.valid_active_span?() == false
52-
end)
53-
end
54-
55-
test "returns false when OTEL raises" do
56-
with_mock :otel_tracer, current_span_ctx: fn -> raise "otel not running" end do
57-
assert OpenTelemetry.valid_active_span?() == false
58-
end
59-
end
60-
end
61-
6242
describe "generate_trace_url/0" do
6343
test "returns nil when there is no active span" do
6444
Application.put_env(:zexbox, :app_env, :production)

0 commit comments

Comments
 (0)