Log Metadata object with job, process, and host information
Changes
- Add
kojo_metadata
object to logging structure that containsjob
,process
andhost
keys. - In the
kojo_metadata.host
object there is:host_name
: Contains the gethostname() results. On docker this is just a hash of the container ID, but on EC2 or Kubernetes it will be a more verbose string.load_average
: the instantaneous Load average that is also sampled by canEnvironmentSustainAdditionProcesses()
- In the
kojo_metadata.process
object you can find memory stats for the process that executing your Kōjō job.memory_usage_bytes
: current memory allocated to the PHP process via emalloc()memory_peak_usage_bytes
: peak memory allocatedmemory_limit_bytes
: The results ofini_get('memory_limit')
string like'128M'
normalized into bytes.
Example output
Example dashboard: https://snapshot.raintank.io/dashboard/snapshot/C9KwxOAe2rugM73YIDikDUyN7ezmoz9d?orgId=2
{
"time": "Thu, 19 Sep 19 13:38:44.508414 UTC",
"level": "notice",
"message": "Got lucky this time boss!",
"context": {
"event_type": "task_status",
"top_level_status": "success",
"nested_object": {
"random_letters": "bright",
"random_word": "materialization",
"random_value": 25,
"status": "success"
}
},
"context_json_last_error": 0,
"kojo_metadata": {
"job": {
"kojo_job_id": 8268,
"type_code": "complex_logging_structure",
"name": "Protean DLCP Example",
"priority": 7,
"importance": 10,
"work_at_date_time": "2019-09-19 13:38:27",
"next_state_request": "none",
"assigned_state": "working",
"previous_state": "crashed",
"worker_uri": "Neighborhoods\\KojoFitnessUseCase46\\V1\\Worker\\Facade",
"worker_method": "start",
"can_work_in_parallel": true,
"last_transition_date_time": "2019-09-19 13:38:43",
"last_transition_micro_time": "1568900323188672",
"times_worked": 4,
"times_retried": 0,
"times_held": 0,
"times_crashed": 3,
"times_panicked": 0,
"created_at_date_time": "2019-09-19 13:38:27",
"completed_at_date_time": null,
"delete_after_date_time": null
},
"process": {
"process_id": 7750,
"parent_process_id": 7240,
"path": "\/server[7236]\/root[7240]\/job[7750]",
"uuid": "af35fa582d5b-172.21.0.7-\/server[7236]\/root[7240]\/job[7750]-1568900322.717618-2585409713",
"type_code": "job",
"memory_usage_bytes": 10681168,
"memory_peak_usage_bytes": 10722400,
"memory_limit_bytes": 134217728
},
"host": {
"host_name": "af35fa582d5b",
"load_average": 4.83
}
}
}