Class: CloseYourIt::SlowQueryEvent
- Defined in:
- lib/closeyourit/events/slow_query_event.rb
Overview
Payload ‘kind=slow_query` per la pipeline metriche (`/api/v1/projects/:id/metrics`). Lo SQL è offuscato (binds esclusi) — vedi PDR §9.
Instance Method Summary collapse
- #ingest_path(project_id) ⇒ Object
-
#initialize(payload, duration_ms, configuration) ⇒ SlowQueryEvent
constructor
A new instance of SlowQueryEvent.
- #to_h ⇒ Object
Constructor Details
#initialize(payload, duration_ms, configuration) ⇒ SlowQueryEvent
Returns a new instance of SlowQueryEvent.
11 12 13 14 15 16 |
# File 'lib/closeyourit/events/slow_query_event.rb', line 11 def initialize(payload, duration_ms, configuration) super(configuration) @payload = payload @duration_ms = duration_ms @scrubber = Scrubber.new(configuration) end |
Instance Method Details
#ingest_path(project_id) ⇒ Object
35 36 37 |
# File 'lib/closeyourit/events/slow_query_event.rb', line 35 def ingest_path(project_id) "/api/v1/projects/#{project_id}/metrics" end |
#to_h ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/closeyourit/events/slow_query_event.rb', line 18 def to_h compact( "kind" => "slow_query", "sample_id" => SecureRandom.uuid, "duration_ms" => @duration_ms.round(2), "occurred_at" => @occurred_at, "environment" => environment, "sql" => @scrubber.obfuscate_sql(@payload[:sql]), "name" => @payload[:name], "cached" => @payload.fetch(:cached, false), "db_system" => db_system, "source" => @payload[:source], "bindings" => bindings, "sdk" => sdk ) end |