Debian Codegraph @

tests/testthat/helper-otel.R

raw
1 skip_if_shiny_otel_tracer_is_enabled <- function() {
2 if (shiny_otel_tracer()$is_enabled()) {
3 skip("Skipping stack trace tests when OpenTelemetry is already enabled")
4 }
5 }
6
7 # Helper function to create a mock otel span
8 create_mock_otel_span <- function(name = "test_span") {
9 structure(
10 list(
11 name = name,
12 activate = function(...) NULL,
13 end = function(...) NULL
14 ),
15 class = "otel_span"
16 )
17 }
18
19 # Helper function to create a mock tracer
20 create_mock_tracer <- function() {
21 structure(
22 list(
23 name = "mock_tracer",
24 is_enabled = function() TRUE,
25 start_span = function(name, ...) create_mock_otel_span(name)
26 ),
27 class = "otel_tracer"
28 )
29 }
30
31 # Helper function to create a mock logger
32 create_mock_logger <- function() {
33 structure(
34 list(name = "mock_logger"),
35 class = "otel_logger"
36 )
37 }