Class: LogStruct::Log::ActiveJob::Retry

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Shared::SerializeCommon

#as_json, #serialize, #serialize_common

Methods included from Interfaces::CommonFieldBase

#serialize

Constructor Details

#initialize(source: Source::Job, event: Event::Retry, timestamp:, level: Level::Info, job_id:, job_class:, queue_name: nil, arguments: nil, executions: nil, provider_job_id: nil, error_class: nil, message: nil, wait_ms: nil) ⇒ void

Parameters:

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

    Shared/common fields

  • event (Event) (defaults to: Event::Retry)
  • timestamp (Time)
  • level (Level) (defaults to: Level::Info)
  • job_id (String)
  • job_class (String)
  • queue_name (Symbol, nil) (defaults to: nil)
  • arguments (Array<T.untyped>, nil) (defaults to: nil)
  • executions (Integer, nil) (defaults to: nil)
  • provider_job_id (String, nil) (defaults to: nil)
  • error_class (T.class_of(Exception), nil) (defaults to: nil) —

    Event-specific fields

  • message (String, nil) (defaults to: nil)
  • wait_ms (Float, nil) (defaults to: nil)


# File ''

const :source, Source::Job, default: Source::Job
const :event, Event, default: Event::Retry
const :timestamp, Time, factory: -> { Time.now }
const :level, Level, default: Level::Info
const :job_id, String
const :job_class, String
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 :provider_job_id, T.nilable(String), default: nil
const :error_class, T.nilable(T.class_of(Exception)), default: nil
const :message, T.nilable(String), default: nil
const :wait_ms, T.nilable(Float), default: nil

Instance Attribute Details

#arguments ⇒ Array<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

#error_class ⇒ T.class_of(Exception)? (readonly)

Event-specific fields

Returns:

  • (T.class_of(Exception), nil)


# File ''

const :error_class, T.nilable(T.class_of(Exception)), default: nil

#event ⇒ Event (readonly)

Returns the value of prop event.

Returns:



# File ''

const :event, Event, default: Event::Retry

#executions ⇒ Integer? (readonly)

Returns the value of prop executions.

Returns:

  • (Integer, nil)


# File ''

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

#job_class ⇒ String (readonly)

Returns the value of prop job_class.

Returns:

  • (String)


# File ''

const :job_class, String

#job_id ⇒ String (readonly)

Returns the value of prop job_id.

Returns:

  • (String)


# File ''

const :job_id, String

#level ⇒ Level (readonly)

Returns the value of prop level.

Returns:



# File ''

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

#message ⇒ String? (readonly)

Returns the value of prop message.

Returns:

  • (String, nil)


# File ''

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

#provider_job_id ⇒ String? (readonly)

Returns the value of prop provider_job_id.

Returns:

  • (String, nil)


# File ''

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

#queue_name ⇒ Symbol? (readonly)

Returns the value of prop queue_name.

Returns:

  • (Symbol, nil)


# File ''

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

#source ⇒ Source::Job (readonly)

Shared/common fields

Returns:



# File ''

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

#timestamp ⇒ Time (readonly)

Returns the value of prop timestamp.

Returns:

  • (Time)


# File ''

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

#wait_ms ⇒ Float? (readonly)

Returns the value of prop wait_ms.

Returns:

  • (Float, nil)


# File ''

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

Instance Method Details

#to_h ⇒ Hash{LogStruct::LogField => T.untyped}

Returns:



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

def to_h
  h = T.let({}, T::Hash[LogStruct::LogField, T.untyped])
  h[LogField::JobId] = job_id
  h[LogField::JobClass] = job_class
  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::ProviderJobId] = provider_job_id unless provider_job_id.nil?
  h[LogField::ErrorClass] = error_class unless error_class.nil?
  h[LogField::Message] = message unless message.nil?
  h[LogField::WaitMs] = wait_ms unless wait_ms.nil?
  h
end