Skip to content

Serialize and log kojo_job table for each log message emitted by the logger

Compare
Choose a tag to compare
@alexberryman alexberryman released this 27 Aug 14:12
· 83 commits to 4.x since this release
75e95e2

This adds a new top level key kojo_job that contains the state of the Data\Job object which reflects what is in the kojo_job database table. Here is an example message with the new kojo_job message:

{
  "time": "Tue, 27 Aug 19 14:02:16.008313 UTC",
  "level": "notice",
  "process_id": "240",
  "process_path": "\/server[201]\/root[205]\/job[240]",
  "kojo_job": {
    "kojo_job_id": 16,
    "type_code": "complex_logging_structure",
    "name": "Protean DLCP Example",
    "priority": 10,
    "importance": 10,
    "work_at_date_time": "2019-08-27 14:02:09",
    "next_state_request": "none",
    "assigned_state": "working",
    "previous_state": "waiting",
    "worker_uri": "Neighborhoods\\KojoFitnessUseCase46\\V1\\Worker\\Facade",
    "worker_method": "start",
    "can_work_in_parallel": true,
    "last_transition_date_time": "2019-08-27 14:02:15",
    "last_transition_micro_time": "1566914535331998",
    "times_worked": 1,
    "times_retried": 0,
    "times_held": 0,
    "times_crashed": 0,
    "times_panicked": 0,
    "created_at_date_time": "2019-08-27 14:02:09",
    "completed_at_date_time": null,
    "delete_after_date_time": null
  },
  "message": "Got lucky this time boss!",
  "context": {
    "event_type": "task_status",
    "top_level_status": "success",
    "nested_object": {
      "random_letters": "crmls",
      "random_word": "ingestion",
      "random_value": 11,
      "status": "success"
    }
  },
  "context_json_last_error": 0
}

Useful things this provides:

  • The kojo_job.type_code will provide a standard way to aggregate jobs in elasticsearch
  • Monitoring the kojo_job.times_crashed or times_panicked will provide insight into reoccurring issues
  • Checking kojo_job.assigned_state will help reveal if pseudo-success messages are being emitted from userspace before the job calls $this->getApiV1WorkerService()->requestCompleteSuccess()->applyRequest(); which can reveal logical flow errors.