Module: OneApm::Agent::Instrumentation::ThriftHelper
- Defined in:
- lib/one_apm/inst/http_clients/thrift.rb
Instance Attribute Summary collapse
-
#segment ⇒ Object
Returns the value of attribute segment.
Instance Method Summary collapse
- #metrics(operator_name) ⇒ Object
- #operations ⇒ Object
- #operator(result_klass) ⇒ Object
- #rpc_request ⇒ Object
- #rpc_request=(rpc_request) ⇒ Object
- #rpc_reset! ⇒ Object
- #started_time(op) ⇒ Object
- #thost ⇒ Object
Instance Attribute Details
#segment ⇒ Object
Returns the value of attribute segment.
8 9 10 |
# File 'lib/one_apm/inst/http_clients/thrift.rb', line 8 def segment @segment end |
Instance Method Details
#metrics(operator_name) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# 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 ⇒ Object
54 55 56 |
# File 'lib/one_apm/inst/http_clients/thrift.rb', line 54 def operations @operations ||= {} end |
#operator(result_klass) ⇒ Object
23 24 25 26 27 28 29 30 |
# 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 ⇒ Object
10 11 12 |
# File 'lib/one_apm/inst/http_clients/thrift.rb', line 10 def rpc_request @rpc_request || {} end |
#rpc_request=(rpc_request) ⇒ Object
14 15 16 |
# File 'lib/one_apm/inst/http_clients/thrift.rb', line 14 def rpc_request=(rpc_request) @rpc_request = rpc_request end |
#rpc_reset! ⇒ Object
18 19 20 21 |
# File 'lib/one_apm/inst/http_clients/thrift.rb', line 18 def rpc_reset! @rpc_request = nil @segment = nil end |
#started_time(op) ⇒ Object
49 50 51 52 |
# 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 ⇒ Object
32 33 34 35 36 |
# 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 |