Class: Airbrake::Query
- Inherits:
-
Object
- Object
- Airbrake::Query
- Includes:
- Grouppable, HashKeyable, Ignorable, Mergeable, Stashable
- Defined in:
- lib/airbrake-ruby/query.rb
Overview
Query holds SQL query data that powers SQL query collection.
rubocop:disable Metrics/ParameterLists
Instance Attribute Summary collapse
- #file ⇒ Object
- #func ⇒ Object
- #line ⇒ Object
- #method ⇒ Object
- #query ⇒ Object
- #route ⇒ Object
- #time ⇒ Object
- #timing ⇒ Object
Attributes included from Ignorable
Instance Method Summary collapse
- #cargo ⇒ Object
- #destination ⇒ Object
-
#initialize(method:, route:, query:, func: nil, file: nil, line: nil, timing: nil, time: Time.now) ⇒ Query
constructor
A new instance of Query.
- #to_h ⇒ Object
Methods included from Grouppable
Methods included from Mergeable
Methods included from Stashable
Methods included from Ignorable
Methods included from HashKeyable
Constructor Details
#initialize(method:, route:, query:, func: nil, file: nil, line: nil, timing: nil, time: Time.now) ⇒ Query
Returns a new instance of Query.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/airbrake-ruby/query.rb', line 17 def initialize( method:, route:, query:, func: nil, file: nil, line: nil, timing: nil, time: Time.now ) @time_utc = TimeTruncate.utc_truncate_minutes(time) @method = method @route = route @query = query @func = func @file = file @line = line @timing = timing @time = time end |
Instance Attribute Details
#file ⇒ Object
15 16 17 |
# File 'lib/airbrake-ruby/query.rb', line 15 def file @file end |
#func ⇒ Object
15 16 17 |
# File 'lib/airbrake-ruby/query.rb', line 15 def func @func end |
#line ⇒ Object
15 16 17 |
# File 'lib/airbrake-ruby/query.rb', line 15 def line @line end |
#method ⇒ Object
15 16 17 |
# File 'lib/airbrake-ruby/query.rb', line 15 def method @method end |
#query ⇒ Object
15 16 17 |
# File 'lib/airbrake-ruby/query.rb', line 15 def query @query end |
#route ⇒ Object
15 16 17 |
# File 'lib/airbrake-ruby/query.rb', line 15 def route @route end |
#time ⇒ Object
15 16 17 |
# File 'lib/airbrake-ruby/query.rb', line 15 def time @time end |
#timing ⇒ Object
15 16 17 |
# File 'lib/airbrake-ruby/query.rb', line 15 def timing @timing end |
Instance Method Details
#cargo ⇒ Object
42 43 44 |
# File 'lib/airbrake-ruby/query.rb', line 42 def cargo 'queries' end |
#destination ⇒ Object
38 39 40 |
# File 'lib/airbrake-ruby/query.rb', line 38 def destination 'queries-stats' end |
#to_h ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/airbrake-ruby/query.rb', line 46 def to_h { 'method' => method, 'route' => route, 'query' => query, 'time' => @time_utc, 'function' => func, 'file' => file, 'line' => line, }.delete_if { |_key, val| val.nil? } end |