Class: CloseYourIt::MessageEvent
- Defined in:
- lib/closeyourit/events/message_event.rb
Overview
Messaggio diagnostico esplicito (CloseYourIt.capture_message) nel formato evento Sentry
(message.formatted + level). Fonde lo Scope corrente come ErrorEvent. Il messaggio passa dallo
Scrubber (pattern) come exception.message di ErrorEvent — parità PII cross-evento.
Instance Method Summary collapse
- #ingest_path(project_id) ⇒ Object
-
#initialize(message, level:, configuration:) ⇒ MessageEvent
constructor
A new instance of MessageEvent.
- #to_h ⇒ Object
Constructor Details
#initialize(message, level:, configuration:) ⇒ MessageEvent
Returns a new instance of MessageEvent.
11 12 13 14 15 16 |
# File 'lib/closeyourit/events/message_event.rb', line 11 def initialize(, level:, configuration:) super(configuration) @message = @level = level @scrubber = Scrubber.new(configuration) end |
Instance Method Details
#ingest_path(project_id) ⇒ Object
36 37 38 |
# File 'lib/closeyourit/events/message_event.rb', line 36 def ingest_path(project_id) "/api/v1/projects/#{project_id}/events" end |
#to_h ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/closeyourit/events/message_event.rb', line 18 def to_h base = compact( "event_id" => SecureRandom.uuid.delete("-"), "timestamp" => @occurred_at, "platform" => "ruby", "level" => @level, # Correlazione log↔errori: stesso trace_id dei log della medesima richiesta (parità con ErrorEvent). "trace_id" => CloseYourIt::Scope.current.trace_id, "environment" => environment, "release" => @configuration.release, "server_name" => server_name, "message" => { "formatted" => @scrubber.(@message.to_s) }, "contexts" => { "runtime" => { "name" => "ruby", "version" => RUBY_VERSION } }, "sdk" => sdk ) deep_merge(base, CloseYourIt::Scope.current.to_event_hash) end |