opentelemetry-ruby icon indicating copy to clipboard operation
opentelemetry-ruby copied to clipboard

Add a helper to disable tracing in a block

Open fbogsany opened this issue 4 years ago • 1 comments

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.

fbogsany avatar Jul 29 '20 14:07 fbogsany