Class: Mmtrix::Agent::TransactionSampler
- Inherits:
-
Object
- Object
- Mmtrix::Agent::TransactionSampler
- Defined in:
- lib/mmtrix/agent/transaction_sampler.rb
Overview
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.
Instance Method Summary collapse
-
#notice_nosql(key, duration) ⇒ Object
deprecated
Deprecated.
Use Datastores.notice_statement instead.
-
#notice_sql(sql, config, duration, state = nil, explainer = nil) ⇒ Object
deprecated
Deprecated.
Use Datastores.notice_sql instead.
Instance Method Details
#notice_nosql(key, duration) ⇒ Object
Use Datastores.notice_statement instead.
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.
224 225 226 227 |
# File 'lib/mmtrix/agent/transaction_sampler.rb', line 224 def notice_nosql(key, duration) #THREAD_LOCAL_ACCESS builder = tl_builder notice_extra_data(builder, key, duration, :key) end |
#notice_sql(sql, config, duration, state = nil, explainer = nil) ⇒ Object
Use Datastores.notice_sql instead.
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.
186 187 188 189 190 191 192 193 194 195 |
# File 'lib/mmtrix/agent/transaction_sampler.rb', line 186 def notice_sql(sql, config, duration, state=nil, explainer=nil) #THREAD_LOCAL_ACCESS sometimes # some statements (particularly INSERTS with large BLOBS # may be very large; we should trim them to a maximum usable length state ||= TransactionState.tl_get builder = state.transaction_sample_builder if state.is_sql_recorded? statement = build_database_statement(sql, config, explainer) notice_extra_data(builder, statement, duration, :sql) end end |