Class: FiberAudit::Runtime::Event

Inherits:
Data
  • Object
show all
Defined in:
lib/fiber_audit/runtime/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind:, source:, occurred_at:, monotonic_ns:, duration_ns: nil, operation: nil, location: nil, execution_context: :unknown, thread_id: nil, fiber_id: nil, measurements: {}) ⇒ Event

Returns a new instance of Event.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/fiber_audit/runtime/event.rb', line 22

def initialize(
  kind:,
  source:,
  occurred_at:,
  monotonic_ns:,
  duration_ns: nil,
  operation: nil,
  location: nil,
  execution_context: :unknown,
  thread_id: nil,
  fiber_id: nil,
  measurements: {}
)
  super(
    kind: Validation.identifier(kind, 'kind'),
    source: Validation.identifier(source, 'source'),
    occurred_at: Validation.utc_time(occurred_at, 'occurred_at'),
    monotonic_ns: Validation.integer(monotonic_ns, 'monotonic_ns'),
    duration_ns: Validation.integer(duration_ns, 'duration_ns', allow_nil: true),
    operation: Validation.operation(operation, allow_nil: true),
    location: normalize_location(location),
    execution_context: normalize_context(execution_context),
    thread_id: Validation.integer(thread_id, 'thread_id', allow_nil: true),
    fiber_id: Validation.integer(fiber_id, 'fiber_id', allow_nil: true),
    measurements: normalize_measurements(measurements)
  )
end

Instance Attribute Details

#duration_nsObject (readonly)

Returns the value of attribute duration_ns

Returns:

  • (Object)

    the current value of duration_ns



9
10
11
# File 'lib/fiber_audit/runtime/event.rb', line 9

def duration_ns
  @duration_ns
end

#execution_contextObject (readonly)

Returns the value of attribute execution_context

Returns:

  • (Object)

    the current value of execution_context



9
10
11
# File 'lib/fiber_audit/runtime/event.rb', line 9

def execution_context
  @execution_context
end

#fiber_idObject (readonly)

Returns the value of attribute fiber_id

Returns:

  • (Object)

    the current value of fiber_id



9
10
11
# File 'lib/fiber_audit/runtime/event.rb', line 9

def fiber_id
  @fiber_id
end

#kindObject (readonly)

Returns the value of attribute kind

Returns:

  • (Object)

    the current value of kind



9
10
11
# File 'lib/fiber_audit/runtime/event.rb', line 9

def kind
  @kind
end

#locationObject (readonly)

Returns the value of attribute location

Returns:

  • (Object)

    the current value of location



9
10
11
# File 'lib/fiber_audit/runtime/event.rb', line 9

def location
  @location
end

#measurementsObject (readonly)

Returns the value of attribute measurements

Returns:

  • (Object)

    the current value of measurements



9
10
11
# File 'lib/fiber_audit/runtime/event.rb', line 9

def measurements
  @measurements
end

#monotonic_nsObject (readonly)

Returns the value of attribute monotonic_ns

Returns:

  • (Object)

    the current value of monotonic_ns



9
10
11
# File 'lib/fiber_audit/runtime/event.rb', line 9

def monotonic_ns
  @monotonic_ns
end

#occurred_atObject (readonly)

Returns the value of attribute occurred_at

Returns:

  • (Object)

    the current value of occurred_at



9
10
11
# File 'lib/fiber_audit/runtime/event.rb', line 9

def occurred_at
  @occurred_at
end

#operationObject (readonly)

Returns the value of attribute operation

Returns:

  • (Object)

    the current value of operation



9
10
11
# File 'lib/fiber_audit/runtime/event.rb', line 9

def operation
  @operation
end

#sourceObject (readonly)

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



9
10
11
# File 'lib/fiber_audit/runtime/event.rb', line 9

def source
  @source
end

#thread_idObject (readonly)

Returns the value of attribute thread_id

Returns:

  • (Object)

    the current value of thread_id



9
10
11
# File 'lib/fiber_audit/runtime/event.rb', line 9

def thread_id
  @thread_id
end