| Class | NewRelic::Agent::TransactionSampler |
| In: |
lib/new_relic/agent/transaction_sampler.rb
|
| Parent: | Object |
This class contains the logic for recording and storing transaction traces (sometimes referred to as ‘transaction samples’).
A transaction trace is a detailed timeline of the events that happened during the processing of a single transaction, including database calls, template rendering calls, and other instrumented method calls.
@api public
| MAX_DATA_LENGTH | = | 16384 |
| dev_mode_sample_buffer | [R] | |
| last_sample | [R] | |
| xray_sample_buffer | [R] |
Truncates the message to `MAX_DATA_LENGTH` if needed, and appends an ellipsis because it makes the trucation clearer in the UI
Attaches an additional non-SQL query parameter to the current transaction trace node.
This may be used for recording a query against a key-value store like memcached or redis.
This method should be used only by gem authors wishing to extend the Ruby agent to instrument uninstrumented key-value stores - it should generally not be called directly from application code.
@param key [String] the name of the key that was queried @param duration [Float] number of seconds the query took to execute
@api public @deprecated Use {Datastores.notice_statement} instead.
This delegates to the builder to create a new open transaction node for the frame, beginning at the optionally specified time.
Note that in developer mode, this captures a stacktrace for the beginning of each node, which can be fairly slow
Attaches an SQL query on the current transaction trace node.
This method should be used only by gem authors wishing to extend the Ruby agent to instrument new database interfaces - it should generally not be called directly from application code.
@param sql [String] the SQL query being recorded @param config [Object] the driver configuration for the connection @param duration [Float] number of seconds the query took to execute @param explainer [Proc] for internal use only - 3rd-party clients must
not pass this parameter.
@api public @deprecated Use {Datastores.notice_sql} instead.
This is called when we are done with the transaction. We‘ve unwound the stack to the top level. It also clears the transaction sample builder so that it won‘t continue to have frames appended to it.
It sets various instance variables to the finished sample, depending on which settings are active. See `store_sample`
Checks to see if the transaction sampler is disabled, if transaction trace recording is disabled by a thread local, or if execution is untraced - if so it clears the transaction sample builder from the thread local, otherwise it generates a new transaction sample builder with the stated time as a starting point and saves it in the thread local variable