Sha256: b9ea502efbe86bc393fb85a15aa237fcb5cfe75b10edb2a69033eddff5d7d4f3
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true module ActiveRecordQueryCounter # Thresholds for sending notifications based on query time, row count, transaction time, and # transaction count. class Thresholds attr_reader :query_time, :row_count, :transaction_time, :transaction_count def query_time=(value) @query_time = value&.to_f end def row_count=(value) @row_count = value&.to_i end def transaction_time=(value) @transaction_time = value&.to_f end def transaction_count=(value) @transaction_count = value&.to_i end # Set threshold values from a hash. # # @param attributes [Hash] the attributes to set # @return [void] def set(values) values.each do |key, value| setter = "#{key}=" if respond_to?(setter) public_send("#{key}=", value) else raise ArgumentError, "Unknown threshold: #{key}" end end end # Clear all threshold values. def clear @query_time = nil @row_count = nil @transaction_time = nil @transaction_count = nil end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_record_query_counter-2.1.0 | lib/active_record_query_counter/thresholds.rb |
active_record_query_counter-2.0.0 | lib/active_record_query_counter/thresholds.rb |