Module: OneApm::Agent::Instrumentation::ThriftHelper
- Defined in:
- lib/one_apm/inst/http_clients/thrift.rb
Instance Method Summary collapse
- #metrics(operator_name) ⇒ Object
- #operations ⇒ Object
- #operator(result_klass) ⇒ Object
- #started_time(op) ⇒ Object
- #thost ⇒ Object
Instance Method Details
#metrics(operator_name) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/one_apm/inst/http_clients/thrift.rb', line 23 def metrics operator_name metrics = if thost.nil? ["External/Thrift/#{operator_name}"] else ["External/#{thost}/Thrift/#{operator_name}", "External/#{thost}/all"] end metrics << "External/all" if OneApm::Transaction.recording_web_transaction? metrics << "External/allWeb" else metrics << "External/allOther" end metrics end |
#operations ⇒ Object
43 44 45 |
# File 'lib/one_apm/inst/http_clients/thrift.rb', line 43 def operations @operations ||= {} end |
#operator(result_klass) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/one_apm/inst/http_clients/thrift.rb', line 8 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 |
#started_time(op) ⇒ Object
38 39 40 41 |
# File 'lib/one_apm/inst/http_clients/thrift.rb', line 38 def started_time op _op_ = operations.delete(op) (_op_ && _op_[:started_time]) or Time.now.to_f end |
#thost ⇒ Object
17 18 19 20 21 |
# File 'lib/one_apm/inst/http_clients/thrift.rb', line 17 def thost @thost ||= @iprot.instance_variable_get("@trans") \ .instance_variable_get("@transport") \ .instance_variable_get("@host") rescue nil end |