Class: CloseYourIt::SlowMethodEvent
- Defined in:
- lib/closeyourit/events/slow_method_event.rb
Overview
Payload ‘kind=slow_method` per la pipeline metriche. Di default solo label + durata + posizione. Gli argomenti del metodo sono inviati SOLO se `capture_method_arguments` (opt-in, default OFF): posizionali per indice, kwargs per nome (scrub della chiave sensibile), valore via `inspect` troncato per sicurezza JSON. Vedi PDR §9.
Instance Method Summary collapse
- #ingest_path(project_id) ⇒ Object
-
#initialize(label, duration_ms, location, configuration, args: nil, kwargs: nil) ⇒ SlowMethodEvent
constructor
A new instance of SlowMethodEvent.
- #to_h ⇒ Object
Constructor Details
#initialize(label, duration_ms, location, configuration, args: nil, kwargs: nil) ⇒ SlowMethodEvent
Returns a new instance of SlowMethodEvent.
13 14 15 16 17 18 19 20 21 |
# File 'lib/closeyourit/events/slow_method_event.rb', line 13 def initialize(label, duration_ms, location, configuration, args: nil, kwargs: nil) super(configuration) @label = label @duration_ms = duration_ms @location = location @args = args @kwargs = kwargs @scrubber = Scrubber.new(configuration) end |
Instance Method Details
#ingest_path(project_id) ⇒ Object
38 39 40 |
# File 'lib/closeyourit/events/slow_method_event.rb', line 38 def ingest_path(project_id) "/api/v1/projects/#{project_id}/metrics" end |
#to_h ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/closeyourit/events/slow_method_event.rb', line 23 def to_h compact( "kind" => "slow_method", "sample_id" => SecureRandom.uuid, "duration_ms" => @duration_ms.round(2), "occurred_at" => @occurred_at, "environment" => environment, "label" => @label, "file" => @location&.path, "lineno" => @location&.lineno, "arguments" => arguments, "sdk" => sdk ) end |