module OneApm::Agent::Instrumentation::ThriftHelper
Attributes
segment[RW]
Public Instance Methods
metrics(operator_name)
click to toggle source
# File lib/one_apm/inst/http_clients/thrift.rb, line 38 def metrics operator_name metrics = if thost.nil? ["External/Thrift/#{operator_name}"] else #changed from */host/Thrift to */Thrift/host ["External/Thrift/#{thost}/#{operator_name}", "External/#{thost}/all"] end metrics << "External/all" metrics end
operations()
click to toggle source
# File lib/one_apm/inst/http_clients/thrift.rb, line 54 def operations @operations ||= {} end
operator(result_klass)
click to toggle source
# File lib/one_apm/inst/http_clients/thrift.rb, line 23 def operator result_klass namespaces = result_klass.to_s.split('::') operator_name = 'unknown' if namespaces.last =~ /_result/ operator_name = namespaces.last.sub('_result', '').downcase end operator_name end
rpc_request()
click to toggle source
# File lib/one_apm/inst/http_clients/thrift.rb, line 10 def rpc_request @rpc_request || {} end
rpc_request=(rpc_request)
click to toggle source
# File lib/one_apm/inst/http_clients/thrift.rb, line 14 def rpc_request=(rpc_request) @rpc_request = rpc_request end
rpc_reset!()
click to toggle source
# File lib/one_apm/inst/http_clients/thrift.rb, line 18 def rpc_reset! @rpc_request = nil @segment = nil end
started_time(op)
click to toggle source
# File lib/one_apm/inst/http_clients/thrift.rb, line 49 def started_time op _op_ = operations.delete(op) (_op_ && _op_[:started_time]) or Time.now.to_f end
thost()
click to toggle source
# File lib/one_apm/inst/http_clients/thrift.rb, line 32 def thost @thost ||= @iprot.instance_variable_get("@trans") \ .instance_variable_get("@transport") \ .instance_variable_get("@host") rescue nil end