File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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`.
Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments