lib/ting_yun/instrumentation/thrift.rb in tingyun_rpm-1.2.0 vs lib/ting_yun/instrumentation/thrift.rb in tingyun_rpm-1.3.0
- old
+ new
@@ -11,10 +11,11 @@
executes do
TingYun::Agent.logger.info 'Installing Thrift Instrumentation'
require 'ting_yun/support/serialize/json_wrapper'
+ require 'ting_yun/instrumentation/support/external_helper'
end
executes do
::Thrift::BaseProtocol.class_eval do
@@ -38,22 +39,20 @@
::Thrift::Client.module_eval do
require 'ting_yun/instrumentation/support/thrift_helper'
include TingYun::Instrumentation::ThriftHelper
+ include TingYun::Instrumentation::Support::ExternalHelper
-
def send_message_args_with_tingyun(args_class, args = {})
return send_message_args_without_tingyun(args_class, args) unless TingYun::Agent.config[:'nbs.transaction_tracer.thrift'] && TingYun::Agent.config[:'nbs.transaction_tracer.enabled']
begin
state = TingYun::Agent::TransactionState.tl_get
return unless state.execution_traced?
- cross_app_id = TingYun::Agent.config[:tingyunIdSecret] or
- raise TingYun::Agent::CrossAppTracing::Error, "no tingyunIdSecret configured"
- tingyun_id = "#{cross_app_id};c=1;x=#{state.request_guid}"
- data = TingYun::Support::Serialize::JSONWrapper.dump("TingyunID" => tingyun_id)
- @oprot.write_field_begin("TingyunField", 11, 6)
+ data = TingYun::Support::Serialize::JSONWrapper.dump("TingyunID" => create_tingyun_id("thrift"))
+ TingYun::Agent.logger.info("thift will send TingyunID : ", data)
+ @oprot.write_field_begin("TingyunField", 11, 40000)
@oprot.write_string(data)
@oprot.write_field_end
rescue => e
TingYun::Agent.logger.error("Failed to thrift send_message_args_with_tingyun : ", e)
ensure
\ No newline at end of file