module TingYun::Instrumentation::ThriftHelper
Public Instance Methods
metrics(operate)
click to toggle source
# File lib/ting_yun/instrumentation/support/thrift_helper.rb, line 45 def metrics operate metrics = if tingyun_host.nil? ["External/thrift://#{operate}/thrift"] else ["External/thrift://#{tingyun_host}:#{tingyun_port}/#{operate}/thrift"] end metrics << "External/NULL/ALL" if TingYun::Agent::Transaction.recording_web_transaction? metrics << "External/NULL/AllWeb" else metrics << "External/NULL/AllBackground" end return metrics end
metrics_for_cross_app(operate,my_data)
click to toggle source
# File lib/ting_yun/instrumentation/support/thrift_helper.rb, line 61 def metrics_for_cross_app(operate,my_data) metrics = ["ExternalTransaction/NULL/#{my_data["id"]}", "ExternalTransaction/thrift/#{my_data["id"]}", "ExternalTransaction/thrift://#{tingyun_host}:#{tingyun_port}/#{operate}/#{my_data["id"]}/ #{my_data["action"].to_s.gsub(/\/\z/,'')}"] return metrics end
operations()
click to toggle source
# File lib/ting_yun/instrumentation/support/thrift_helper.rb, line 21 def operations @operations ||= {} end
operator(result_klass)
click to toggle source
# File lib/ting_yun/instrumentation/support/thrift_helper.rb, line 9 def operator result_klass namespaces = result_klass.to_s.split('::') operator_name = namespaces[0].downcase if namespaces.last =~ /_result/ operator_name = "#{operator_name}.#{namespaces.last.sub('_result', '').downcase}" elsif namespaces.last =~ /_args/ operator_name = "#{operator_name}.#{namespaces.last.sub('_args', '').downcase}" end operator_name end
started_time_and_node(operate)
click to toggle source
# File lib/ting_yun/instrumentation/support/thrift_helper.rb, line 25 def started_time_and_node(operate) _op_ = operations.delete(operate) time = (_op_ && _op_[:started_time]) || Time.now.to_f node = _op_ && _op_[:node] [time, node] end
tingyun_host()
click to toggle source
# File lib/ting_yun/instrumentation/support/thrift_helper.rb, line 37 def tingyun_host @tingyun_host ||= tingyun_socket.instance_variable_get("@host") rescue nil end
tingyun_port()
click to toggle source
# File lib/ting_yun/instrumentation/support/thrift_helper.rb, line 41 def tingyun_port @tingyun_port ||= tingyun_socket.instance_variable_get("@port") rescue nil end
tingyun_socket()
click to toggle source
# File lib/ting_yun/instrumentation/support/thrift_helper.rb, line 33 def tingyun_socket @iprot.instance_variable_get("@trans").instance_variable_get("@transport") end