Sha256: 972e0536dc1fa51994abc22d55eab6dcd8da06b54ed4214af68ea8e191b4a07e

Contents?: true

Size: 893 Bytes

Versions: 1

Compression:

Stored size: 893 Bytes

Contents

# encoding: utf-8


module TingYun
  module Instrumentation
    module Support
      module ExternalHelper
        def create_tingyun_id(protocol)
          state = TingYun::Agent::TransactionState.tl_get
          externel_guid = tingyun_externel_guid
          state.transaction_sample_builder.current_node["externalId"] = externel_guid
          cross_app_id  = TingYun::Agent.config[:tingyunIdSecret] or
              raise TingYun::Agent::CrossAppTracing::Error, "no tingyunIdSecret configured"
          "#{cross_app_id};c=1;x=#{state.request_guid};e=#{externel_guid};s=#{TingYun::Helper.time_to_millis(Time.now)};p=#{protocol}"
        end

        # generate a random 64 bit uuid
        def tingyun_externel_guid
          guid = ''
          16.times do
            guid << (0..15).map{|i| i.to_s(16)}[rand(16)]
          end
          guid
        end
      end
    end
  end
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tingyun_rpm-1.3.0 lib/ting_yun/instrumentation/support/external_helper.rb