| Class | NewRelic::Agent::SqlSampler |
| In: |
lib/new_relic/agent/sql_sampler.rb
|
| Parent: | Object |
This class contains the logic of recording slow SQL traces, which may represent multiple aggregated SQL queries.
A slow SQL trace consists of a collection of SQL instrumented SQL queries that all normalize to the same text. For example, the following two queries would be aggregated together into a single slow SQL trace:
SELECT * FROM table WHERE id=42 SELECT * FROM table WHERE id=1234
Each slow SQL trace keeps track of the number of times the same normalized query was seen, the min, max, and total time spent executing those queries, and an example backtrace from one of the aggregated queries.
@api public
| MAX_SAMPLES | = | 10 |
| disabled | [R] | |
| sql_traces | [R] | this is for unit tests only |
Records an SQL query, potentially creating a new slow SQL trace, or aggregating the query into an existing slow SQL trace.
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 metric_name [String] is the metric name under which this query will be recorded @param config [Object] is 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.