Sha256: 34d4e55ffc06e52d354411e514fa85836412ba8c7897e36e1de03a26679e834a
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
module AppOpticsAPM module API module Metrics ## # Internal: method to send duration for a transaction # it checks if it can send metrics with the current transaction name # or a default transaction name and sets the transaction name accordingly # # === Arguments # # * +span+ the name of the current span (used to construct a transaction name if none is defined) # * +kvs+ A hash containing key/value pairs, only the value of :TransactionName will be relevant # # Returns the result of the block. # def send_metrics(span, kvs = {}) # This is a new span, we do not know the transaction name yet AppOpticsAPM.transaction_name = nil # if a transaction name is provided it will take precedence over transaction names defined # later or in lower spans start = Time.now yield ensure duration =(1000 * 1000 * (Time.now - start)).round(0) transaction_name = AppOpticsAPM::API.determine_transaction_name(span, kvs) kvs[:TransactionName] = AppOpticsAPM::API.set_transaction_name(AppOpticsAPM::Span.createSpan(transaction_name, nil, duration)) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
appoptics_apm-4.2.3 | lib/appoptics_apm/api/metrics.rb |