Pure function that converts a trace list (from trace$to_list()) into
the OTLP JSON structure expected by OpenTelemetry collectors.
Examples
tr <- Trace$new("format-demo")
tr$start()
s <- Span$new("step", type = "tool")
s$start()
s$end()
tr$add_span(s)
tr$end()
otlp <- otlp_format_trace(tr$to_list())
str(otlp, max.level = 3)
#> List of 1
#> $ resourceSpans:List of 1
#> ..$ :List of 2
#> .. ..$ resource :List of 1
#> .. ..$ scopeSpans:List of 1