Skip to content

Commit ee8b75c

Browse files
committed
wip schema
1 parent 86ef7c1 commit ee8b75c

2 files changed

Lines changed: 188 additions & 7 deletions

File tree

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ Stat can stream over a unix or TCP socket, the following are valid examples:
5454

5555
*Note: If the scheme is omitted, the scheme is assumed to be unix*
5656

57-
Upon connection, stat will stream the ring buffer with each sample on a new line, encoded as json with the following prettified format:
57+
Upon connection, stat will stream the ring buffer with each sample on a new line, encoded as json with the following schema:
58+
5859

5960
{
6061
"type": "string",
@@ -70,12 +71,6 @@ Upon connection, stat will stream the ring buffer with each sample on a new line
7071
"used": int,
7172
"peak": int
7273
},
73-
"location": {
74-
"file": "string",
75-
"line": int,
76-
"offset": int,
77-
"opcode": "string"
78-
},
7974
"symbol": {
8075
"scope": "string",
8176
"function": "string"

sample.json

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
{
2+
"definitions": {},
3+
"$schema": "http://json-schema.org/draft-07/schema#",
4+
"$id": "http://gitub.com/krakjoe/stat/sample.json",
5+
"type": "object",
6+
"title": "Sample Schema",
7+
"required": [
8+
"type",
9+
"request",
10+
"elapsed",
11+
"memory"
12+
],
13+
"properties": {
14+
"type": {
15+
"$id": "#/properties/type",
16+
"type": "string",
17+
"title": "Sample Type",
18+
"default": "",
19+
"examples": [
20+
"memory",
21+
"internal",
22+
"user"
23+
],
24+
"pattern": "^(memory|internal|user)$"
25+
},
26+
"request": {
27+
"$id": "#/properties/request",
28+
"type": "object",
29+
"title": "Request",
30+
"required": [
31+
"pid",
32+
"elapsed"
33+
],
34+
"properties": {
35+
"pid": {
36+
"$id": "#/properties/request/properties/pid",
37+
"type": "integer",
38+
"title": "The Process ID"
39+
},
40+
"elapsed": {
41+
"$id": "#/properties/request/properties/elapsed",
42+
"type": "number",
43+
"title": "Time"
44+
},
45+
"path": {
46+
"$id": "#/properties/request/properties/path",
47+
"type": "string",
48+
"title": "The Translated Path",
49+
"examples": [
50+
"/var/www/html/index.php"
51+
],
52+
"pattern": "^(.*)$"
53+
},
54+
"method": {
55+
"$id": "#/properties/request/properties/method",
56+
"type": "string",
57+
"title": "Request Method",
58+
"examples": [
59+
"POST",
60+
"GET",
61+
"PUT",
62+
"PATCH"
63+
],
64+
"pattern": "^(.*)$"
65+
},
66+
"uri": {
67+
"$id": "#/properties/request/properties/uri",
68+
"type": "string",
69+
"title": "Request URI",
70+
"examples": [
71+
"/index.php"
72+
],
73+
"pattern": "^(.*)$"
74+
}
75+
}
76+
},
77+
"elapsed": {
78+
"$id": "#/properties/elapsed",
79+
"type": "number",
80+
"title": "Time"
81+
},
82+
"memory": {
83+
"$id": "#/properties/memory",
84+
"type": "object",
85+
"title": "Memory Usage",
86+
"required": [
87+
"used",
88+
"peak"
89+
],
90+
"properties": {
91+
"used": {
92+
"$id": "#/properties/memory/properties/used",
93+
"type": "integer",
94+
"title": "Used Memory"
95+
},
96+
"peak": {
97+
"$id": "#/properties/memory/properties/peak",
98+
"type": "integer",
99+
"title": "Peak Used Memory"
100+
}
101+
}
102+
},
103+
"symbol": {
104+
"$id": "#/properties/symbol",
105+
"type": "object",
106+
"title": "Symbol",
107+
"required": [
108+
"file"
109+
],
110+
"properties": {
111+
"file": {
112+
"$id": "#/properties/symbol/properties/file",
113+
"type": "string",
114+
"title": "File Name",
115+
"pattern": "^(.*)$"
116+
},
117+
"scope": {
118+
"$id": "#/properties/symbol/properties/scope",
119+
"type": "string",
120+
"title": "Class Name",
121+
"pattern": "^(.*)$"
122+
},
123+
"function": {
124+
"$id": "#/properties/symbol/properties/function",
125+
"type": "string",
126+
"title": "Function Name",
127+
"pattern": "^(.*)$"
128+
}
129+
}
130+
},
131+
"opline": {
132+
"$id": "#/properties/opline",
133+
"type": "object",
134+
"title": "The Opline Schema",
135+
"required": [
136+
"offset"
137+
],
138+
"properties": {
139+
"offset": {
140+
"$id": "#/properties/opline/properties/offset",
141+
"type": "integer",
142+
"title": "Instruction Offset"
143+
},
144+
"line": {
145+
"$id": "#/properties/opline/properties/line",
146+
"type": "integer",
147+
"title": "Line Number"
148+
},
149+
"opcode": {
150+
"$id": "#/properties/opline/properties/opcode",
151+
"type": "string",
152+
"title": "Opcode Name",
153+
"pattern": "^(.*)$"
154+
}
155+
}
156+
},
157+
"caller": {
158+
"$id": "#/properties/caller",
159+
"type": "object",
160+
"title": "Caller",
161+
"required": [
162+
"file"
163+
],
164+
"properties": {
165+
"file": {
166+
"$id": "#/properties/caller/properties/file",
167+
"type": "string",
168+
"title": "File Name",
169+
"pattern": "^(.*)$"
170+
},
171+
"scope": {
172+
"$id": "#/properties/caller/properties/scope",
173+
"type": "string",
174+
"title": "Class Name",
175+
"pattern": "^(.*)$"
176+
},
177+
"function": {
178+
"$id": "#/properties/caller/properties/function",
179+
"type": "string",
180+
"title": "Function Name",
181+
"pattern": "^(.*)$"
182+
}
183+
}
184+
}
185+
}
186+
}

0 commit comments

Comments
 (0)