tests/testthat/test-tracer-provider-stdout.R

test_that("tracer_provider_stdstream", {
  tracer_provider <- tracer_provider_stdstream_new()
  tracer <- tracer_provider$get_tracer("mytracer")
  expect_true(TRUE)
})

test_that("writing to a file", {
  tmp <- tempfile()
  on.exit(unlink(tmp), add = TRUE)
  tp <- tracer_provider_stdstream_new(list(output = tmp))
  trc <- tp$get_tracer()
  sp1 <- trc$start_local_active_span("testspan")
  sp1$end()
  tp$flush()

  lns <- readLines(tmp)
  expect_true(any(grepl("name\\s*:\\s*testspan", lns)))
})

test_that("tracer_provider_stdstream_options", {
  expect_snapshot({
    tracer_provider_stdstream_options()
  })
})

Try the otelsdk package in your browser

Any scripts or data that you put into this service are public.

otelsdk documentation built on Sept. 10, 2025, 10:32 a.m.