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.
12 13 14 15 16 17 |
# File 'lib/closeyourit/events/slow_query_event.rb', line 12 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
37 38 39 |
# File 'lib/closeyourit/events/slow_query_event.rb', line 37 def ingest_path(project_id) "/api/v1/projects/#{project_id}/metrics" end |
#to_h ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/closeyourit/events/slow_query_event.rb', line 19 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], "trace_id" => CloseYourIt::Scope.current.trace_id, "bindings" => bindings, "sdk" => sdk ) end |