Module: Instana::Instrumentation::RestClientRequest

Defined in:
lib/instana/instrumentation/rest-client.rb

Instance Method Summary collapse

Instance Method Details

#execute(&block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/instana/instrumentation/rest-client.rb', line 7

def execute(&block)
  # Since RestClient uses net/http under the covers, we just
  # provide span visibility here.  HTTP related KVs are reported
  # in the Net::HTTP instrumentation
  span = ::Instana.tracer.start_span(:'rest-client', with_parent: OpenTelemetry::Context.current)

  Trace.with_span(span) { super(&block) }
rescue => e
  span.record_exception(e)
  raise
ensure
  span.finish
end