Class: LogStruct::Log::GoodJob::Start

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Includes:
Interfaces::CommonFields, Shared::SerializeCommon
Defined in:
lib/log_struct/log/good_job/start.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Shared::SerializeCommon

#as_json, #serialize, #serialize_common

Methods included from Interfaces::CommonFields

#serialize

Constructor Details

#initialize(source: Source::Job, event: Event::Start, timestamp:, level: Level::Info, job_id: nil, job_class: nil, queue_name: nil, arguments: nil, executions: nil, process_id:, thread_id:, wait_ms: nil, scheduled_at: nil) ⇒ void

Parameters:

  • source (Source::Job) (defaults to: Source::Job)

    Shared/common fields

  • event (Event) (defaults to: Event::Start)
  • timestamp (Time)
  • level (Level) (defaults to: Level::Info)
  • job_id (String, nil) (defaults to: nil)
  • job_class (String, nil) (defaults to: nil)
  • queue_name (Symbol, nil) (defaults to: nil)
  • arguments (Array<T.untyped>, nil) (defaults to: nil)
  • executions (Integer, nil) (defaults to: nil)
  • process_id (Integer)

    Event-specific fields

  • thread_id (String)
  • wait_ms (Float, nil) (defaults to: nil)
  • scheduled_at (Time, nil) (defaults to: nil)


# File ''

const :source, Source::Job, default: Source::Job
const :event, Event, default: Event::Start
const :timestamp, Time, factory: -> { Time.now }
const :level, Level, default: Level::Info
const :job_id, T.nilable(String), default: nil
const :job_class, T.nilable(String), default: nil
const :queue_name, T.nilable(Symbol), default: nil
const :arguments, T.nilable(T::Array[T.untyped]), default: nil
const :executions, T.nilable(Integer), default: nil
const :process_id, Integer
const :thread_id, String
const :wait_ms, T.nilable(Float), default: nil
const :scheduled_at, T.nilable(Time), default: nil

Instance Attribute Details

#argumentsArray<T.untyped>? (readonly)

Returns the value of prop arguments.

Returns:

  • (Array<T.untyped>, nil)


# File ''

const :arguments, T.nilable(T::Array[T.untyped]), default: nil

#eventEvent (readonly)

Returns the value of prop event.

Returns:



# File ''

const :event, Event, default: Event::Start

#executionsInteger? (readonly)

Returns the value of prop executions.

Returns:

  • (Integer, nil)


# File ''

const :executions, T.nilable(Integer), default: nil

#job_classString? (readonly)

Returns the value of prop job_class.

Returns:

  • (String, nil)


# File ''

const :job_class, T.nilable(String), default: nil

#job_idString? (readonly)

Returns the value of prop job_id.

Returns:

  • (String, nil)


# File ''

const :job_id, T.nilable(String), default: nil

#levelLevel (readonly)

Returns the value of prop level.

Returns:



# File ''

const :level, Level, default: Level::Info

#process_idInteger (readonly)

Event-specific fields

Returns:

  • (Integer)


# File ''

const :process_id, Integer

#queue_nameSymbol? (readonly)

Returns the value of prop queue_name.

Returns:

  • (Symbol, nil)


# File ''

const :queue_name, T.nilable(Symbol), default: nil

#scheduled_atTime? (readonly)

Returns the value of prop scheduled_at.

Returns:

  • (Time, nil)


# File ''

const :scheduled_at, T.nilable(Time), default: nil

#sourceSource::Job (readonly)

Shared/common fields

Returns:



# File ''

const :source, Source::Job, default: Source::Job

#thread_idString (readonly)

Returns the value of prop thread_id.

Returns:

  • (String)


# File ''

const :thread_id, String

#timestampTime (readonly)

Returns the value of prop timestamp.

Returns:

  • (Time)


# File ''

const :timestamp, Time, factory: -> { Time.now }

#wait_msFloat? (readonly)

Returns the value of prop wait_ms.

Returns:

  • (Float, nil)


# File ''

const :wait_ms, T.nilable(Float), default: nil

Instance Method Details

#to_hHash{LogStruct::LogField => T.untyped}

Returns:



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/log_struct/log/good_job/start.rb', line 49

def to_h
  h = T.let({}, T::Hash[LogStruct::LogField, T.untyped])
  h[LogField::JobId] = job_id unless job_id.nil?
  h[LogField::JobClass] = job_class unless job_class.nil?
  h[LogField::QueueName] = queue_name unless queue_name.nil?
  h[LogField::Arguments] = arguments unless arguments.nil?
  h[LogField::Executions] = executions unless executions.nil?
  h[LogField::ProcessId] = process_id
  h[LogField::ThreadId] = thread_id
  h[LogField::WaitMs] = wait_ms unless wait_ms.nil?
  h[LogField::ScheduledAt] = scheduled_at unless scheduled_at.nil?
  h
end