# JSON
Scheme should be described in JSON
You can read more about JSON here: rfc7151 JSON
# Scheme definition
key | type | required | description |
---|---|---|---|
id | uuid | Y | unique request id (uuid) |
version | int | Y | scheme version |
events | event[] | Y | debug/profile information about request |
{
"id": "ef95a542-25a3-4f71-a0e9-640c92f43813",
"version": 1,
"events": []
}
Note
- Scheme is sort of logs (events) list with context (payload).
- Scheme can by recursive (Tree structure)
- Events in scheme will be sorted from oldest to newest
# Event definition
key | type | required | description |
---|---|---|---|
type | eventType | Y | event type define object properties of `payload` |
payload | object | Y | event details (context). Available properties depend on event type |
tags | tag[] | used for filtering in client | |
importance | importance | used for filtering in client | |
time | tsMs | event date-time in ms | |
duration | durationMs | event duration in ms | |
success | bool | false in case of error / alarm. Will be highlighted in client | |
calledFrom | location | code location, where this event is called from (ex. controller where template is being rendered) | |
definedIn | location | where code defined in (ex. path to template file) | |
nested | event[] | contains other nested Events |
Preview
{
"type": "log",
"payload": {},
"tags": [
"db:mysql",
"server:php_03",
"is_production"
],
"importance": 4,
"time": 1547058563454,
"duration": 15,
"success": true,
"calledFrom": {
"file": "/src/renderer/main.js",
"line": 123,
"positionStart": 56,
"positionEnd": 56
},
"definedIn": {
"file": "/src/renderer/main.js",
"line": 123,
"positionStart": 56,
"positionEnd": 56
},
"nested": []
}
# Event Type definition
This is known list of event types, but you can use any own types
type | event description |
---|---|
log | application logs |
query | database queries during request |
request | request received event, payload contain all request props (method, uri, cookies, params, etc..) |
response | response event before output, payload contain response properties (status code, total duration, etc..) |
middleware | middleware triggered event |
template | rendered templates |
sent email events | |
event | executed code events or hooks |
accessCheck | checked permissions during request |
# Example of scheme
{
"uuid": "ef95a542-25a3-4f71-a0e9-640c92f43813",
"version": 1,
"events": [
{
"type": "log",
"time": 1547058561177,
"importance": 1,
"tags": [
"php:app_03"
],
"payload": {
"message": "User X is try to login to admin panel"
}
},
{
"type": "query",
"time": 1547058563454,
"duration": 18,
"importance": 4,
"payload": {
"target": "mysql",
"query": "UPDATE users SET last_loggin = ?dt WHERE id = ?id",
"syntax": "sql"
},
"success": false,
"nested": [
{
"type": "log",
"time": 1547058571245,
"importance": 5,
"payload": {
"message": "Mysql server is going away!"
}
},
{
"type": "email",
"time": 1547058583422,
"payload": {
"subject": "Mysql is down!",
"body": "<h1>Hello admin</h1> <p>mysql is down.</p>",
"from": "no-reply@example.com",
"to": "admin@example.com"
}
}
]
}
]
}