class
CQL::Performance::QueryProfiler
Overview
Query profiler without event system
Included Modules
Defined in:
performance/query_profiler.crConstant Summary
-
MAX_SLOW_QUERIES =
1000 -
OTHER_STATEMENTS =
"(other)"
Constructors
Instance Method Summary
-
#clear : Void
Clear all data
-
#issues : Array(Issue)
Get performance issues
-
#latency_percentiles : LatencyPercentiles
Latency percentiles over every recorded statement
-
#record_query(sql : String, params : Array(DB::Any), execution_time : Time::Span, rows_affected : Int64 | Nil = nil, error : String | Nil = nil, normalized_sql : String | Nil = nil) : Void
Direct method call instead of event handling
-
#slowest_queries(limit : Int32 = 10) : Array(QueryData)
Slowest first.
-
#statistics : Hash(String, NamedTuple(count: Int32, total_ms: Float64, avg_ms: Float64, min_ms: Float64, max_ms: Float64))
Get query statistics
-
#stats_trackers : Hash(String, StatsTracker)
Get stats trackers for report generation
Instance methods inherited from module CQL::Performance::QueryProfilerInterface
clear : Void
clear,
issues : Array(Issue)
issues,
latency_percentiles : LatencyPercentiles
latency_percentiles,
record_query(sql : String, params : Array(DB::Any), execution_time : Time::Span, rows_affected : Int64 | Nil = nil, error : String | Nil = nil, normalized_sql : String | Nil = nil) : Void
record_query,
slowest_queries(limit : Int32) : Array(QueryData)
slowest_queries,
statistics
statistics,
stats_trackers : Hash(String, StatsTracker)
stats_trackers
Instance methods inherited from class CQL::Performance::BasePerformanceComponent
enabled=(enabled : Bool)
enabled=,
enabled? : Bool
enabled?,
healthy? : Bool
healthy?,
reset
reset,
stats : StatsTracker
stats
Instance methods inherited from module CQL::Performance::TimingUtils
categorize_duration(duration : Time::Span, slow_threshold : Time::Span = 100.milliseconds, very_slow_threshold : Time::Span = 1.second) : Symbol
categorize_duration,
format_duration(duration : Time::Span) : String
format_duration,
measure_execution(&)
measure_execution
Constructor Detail
Instance Method Detail
def record_query(sql : String, params : Array(DB::Any), execution_time : Time::Span, rows_affected : Int64 | Nil = nil, error : String | Nil = nil, normalized_sql : String | Nil = nil) : Void
#
Direct method call instead of event handling
Slowest first. The sort is cached until a slow query is added, and runs outside the lock, so #record_query waits
only for a copy.
def statistics : Hash(String, NamedTuple(count: Int32, total_ms: Float64, avg_ms: Float64, min_ms: Float64, max_ms: Float64))
#
Get query statistics