Class: RailsObservatory::EventSerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_observatory/serializers/event_serializer.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.klassObject



15
16
17
# File 'lib/rails_observatory/serializers/event_serializer.rb', line 15

def self.klass
  ActiveSupport::Notifications::Event
end

Instance Method Details

#serialize(event) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/rails_observatory/serializers/event_serializer.rb', line 3

def serialize(event)
    {
      name: event.name,
      payload: Serializer.serialize(event.payload),
      start_at: event.time,
      end_at: event.end,
      duration: event.duration,
      allocations: event.allocations,
      failed: event.payload.include?(:exception),
    }
end