Module: Restify::Adapter::Typhoeus::EasyOverride

Defined in:
lib/restify/adapter/typhoeus.rb

Overview

Patch Hydra to restore the correct OpenTelemetry span when adding the request, so that the Ethon instrumentation can properly pick up the context where the Restify request originated from.

Handle exception from Ethon or WebMock too, and reject the promise, so that the errors can be handled in user code. Otherwise, the user would only receive a Promise timeout.

Instance Method Summary collapse

Instance Method Details

#add(request) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/restify/adapter/typhoeus.rb', line 35

def add(request)
  OpenTelemetry::Trace.with_span(request._otel_span) do
    super(request)
  rescue Exception => e # rubocop:disable Lint/RescueException
    request._restify_writer.reject(e)
  end
end