module NewRelic::Agent::Instrumentation::Ethon::Easy
Constants
- ACTION_INSTANCE_VAR
- HEADERS_INSTANCE_VAR
Public Instance Methods
fabricate_with_tracing(_url, action_name, _options) { || ... }
click to toggle source
‘Ethon::Easy` doesn’t expose the “action name” (‘GET’, ‘POST’, etc.) and Ethon’s fabrication of HTTP classes uses ‘Ethon::Easy::Http::Custom` for non-standard actions. To be able to know the action name at `#perform` time, we set a new instance variable on the `Ethon::Easy` instance with the base name of the fabricated class, respecting the ’Custom’ name where appropriate.
# File lib/new_relic/agent/instrumentation/ethon/instrumentation.rb, line 64 def fabricate_with_tracing(_url, action_name, _options) fabbed = yield instance_variable_set(ACTION_INSTANCE_VAR, NewRelic::Agent.base_name(fabbed.class.name).upcase) fabbed end
headers_equals_with_tracing(headers) { || ... }
click to toggle source
‘Ethon::Easy` uses `Ethon::Easy::Header` to set request headers on libcurl with `#headers=`. After they are set, they aren’t easy to get at again except via FFI so set a new instance variable on the ‘Ethon::Easy` instance to store them in Ruby hash format.
# File lib/new_relic/agent/instrumentation/ethon/instrumentation.rb, line 74 def headers_equals_with_tracing(headers) instance_variable_set(HEADERS_INSTANCE_VAR, headers) yield end
perform_with_tracing(*args) { || ... }
click to toggle source
# File lib/new_relic/agent/instrumentation/ethon/instrumentation.rb, line 79 def perform_with_tracing(*args) return unless NewRelic::Agent::Tracer.state.is_execution_traced? segment = prep_easy(self) wrap_with_tracing(segment) { yield } end