Class: CloseYourIt::PerformanceIssueEvent
- Defined in:
- lib/closeyourit/events/performance_issue_event.rb
Overview
Payload kind=performance_issue per la pipeline metriche (/api/v1/projects/:id/metrics).
È un VERDETTO aggregato (N+1, slow request, slow external HTTP), non una metrica grezza:
subtype lo qualifica, trace_id lo correla a log/errori della stessa richiesta. Lo SQL è già
offuscato (è il fingerprint del profilo). I campi nil vengono omessi (slow_request non ha sql).
Instance Method Summary collapse
- #ingest_path(project_id) ⇒ Object
-
#initialize(attrs, configuration) ⇒ PerformanceIssueEvent
constructor
A new instance of PerformanceIssueEvent.
- #to_h ⇒ Object
Constructor Details
#initialize(attrs, configuration) ⇒ PerformanceIssueEvent
Returns a new instance of PerformanceIssueEvent.
12 13 14 15 |
# File 'lib/closeyourit/events/performance_issue_event.rb', line 12 def initialize(attrs, configuration) super(configuration) @attrs = attrs end |
Instance Method Details
#ingest_path(project_id) ⇒ Object
38 39 40 |
# File 'lib/closeyourit/events/performance_issue_event.rb', line 38 def ingest_path(project_id) "/api/v1/projects/#{project_id}/metrics" end |
#to_h ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/closeyourit/events/performance_issue_event.rb', line 17 def to_h compact( "kind" => "performance_issue", "subtype" => @attrs[:subtype], "sample_id" => SecureRandom.uuid, "duration_ms" => @attrs[:duration_ms]&.round(2), "occurred_at" => @occurred_at, "environment" => environment, "trace_id" => @attrs[:trace_id], "sql" => @attrs[:sql], "source" => @attrs[:source], "route" => @attrs[:route], "http_host" => @attrs[:http_host], "http_url" => @attrs[:http_url], "query_count" => @attrs[:query_count], "total_query_time_ms" => @attrs[:total_query_time_ms]&.round(2), "count_in_request" => @attrs[:count_in_request], "sdk" => sdk ) end |