opentelemetry-ruby
opentelemetry-ruby copied to clipboard
Add a helper to disable tracing in a block
It is sometimes useful to explicitly disable tracing. For example, some applications may wish to avoid tracing healthcheck endpoints. More commonly, though, exporters that use HTTP often wish to avoid tracing their export request. It is possible to achieve this with something like:
@tracer = OpenTelemetry.tracer_provider.tracer
...
@tracer.with_span(OpenTelemetry::Trace::Span.new) do
...
end
It would be convenient to extract this pattern into a helper on the Tracer
class.
This is not foolproof, since it assumes a parent_or_else
sampler.