-
Notifications
You must be signed in to change notification settings - Fork 8
/
apiary.apib
297 lines (234 loc) · 9.49 KB
/
apiary.apib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
FORMAT: 1A
HOST: https://example.com
# Hootsuite Health Checks
The API that Hootsuite uses for monitoring service health.
# Group Status
Status endpoints used to check the health of a service.
## Am I Up [/status/am-i-up]
### /status/am-i-up [GET]
Checks if the service is running. This endpoint does not check any dependencies, it simply returns "OK".
+ Response 200 (application/text)
+ Body
"OK"
## Aggregate [/status/aggregate?type={type}]
### /status/aggregate [GET]
Checks the overall status of the service by checking the status of dependencies.
By default, this endpoint checks `all` dependencies or can be filtered to check only `internal` or `external`
dependencies.
+ Parameters
+ type: `"internal"` (string, optional) - The type of dependencies to check (internal, external).
+ Response 200 (application/json)
+ Attributes (array)
+ (Status)
+ Body
[
"OK"
]
+ Response 200 (application/json)
+ Attributes (array)
+ (Status)
+ (StatusDetails)
+ Body
[
"CRIT",
{
"description":"aggregate check CRIT",
"result":"CRIT",
"details":"A detailed error message"
}
]
+ Response 200 (application/json)
+ Attributes (array)
+ (Status)
+ (StatusDetails)
+ Body
[
"WARN",
{
"description":"aggregate check WARN",
"result":"WARN",
"details":"A detailed warning message"
}
]
## About [/status/about]
### /status/about [GET]
Gets metadata about the service including it's dependencies and their current status
+ Response 200 (application/json)
+ Attributes (About)
+ Body
{
"id": "awesome",
"name": "Awesome Service",
"description": "This service does awesome stuff.",
"protocol": "http",
"owners": [
"Adam <adam@example.com>",
"Denis <denis@example.com>"
],
"version": "1.1.0.5a1dea1",
"host": "app1.staging.example.com",
"projectRepo": "https://github.com/hootsuite/awesome-service",
"projectHome": "https://documentation.com/awesome-service",
"logsLinks": [
"http://logging.com/logs",
"http://logging.com/errors"
],
"statsLinks": [
"http://graphs.com/awesome-service-dashboard",
"http://graphs.com/awesome-service-dashboard-2"
],
"dependencies": [
{
"name": "Mysql DB",
"status": [
"OK"
],
"statusDuration": 0.001469342,
"statusPath": "mysql",
"type": "internal",
"isTraversable": false
},
{
"name": "Another Service",
"status": [
"OK"
],
"statusDuration": 0.000605037,
"statusPath": "another-service",
"type": "service",
"isTraversable": true
}
],
"customData": [
"a-key": "a-value"
]
}
## Traverse [/status/traverse?dependencies={dependencies}&action={action}]
### /status/traverse [GET]
Traverse to another node in the graph and run an "action" at that level and return the result. The default action is about.
+ Parameters
+ dependencies: `service1,service2` (string, optional) - A comma delimited list of services to traverse.
+ Default: ``
+ action: `about` (string, optional) - The action to run at the last node in the traversal.
+ Default: `about`
+ Response 200 (application/json)
+ Attributes (About)
+ Body
{
"id": "awesome",
"name": "Awesome Service",
"description": "This service does awesome stuff.",
"protocol": "http",
"owners": [
"Adam <adam@example.com>",
"Denis <denis@example.com>"
],
"version": "1.1.0.5a1dea1",
"host": "s1.staging.example.com",
"projectRepo": "https://github.com/hootsuite/awesome-service",
"projectHome": "https://documentation.com/awesome-service",
"logsLinks": [
"http://logging.com/logs",
"http://logging.com/errors"
],
"statsLinks": [
"http://graphs.com/awesome-service-dashboard",
"http://graphs.com/awesome-service-dashboard-2"
],
"dependencies": [
{
"name": "Mysql DB",
"status": [
"OK"
],
"statusDuration": 0.001469342,
"statusPath": "mysql",
"type": "internal",
"isTraversable": false
},
{
"name": "Another Service",
"status": [
"OK"
],
"statusDuration": 0.000605037,
"statusPath": "another-service",
"type": "service",
"isTraversable": true
}
],
"customData": [
"a-key": "a-value"
]
}
## Dependency [/status/{dependency}]
### /status/{dependency} [GET]
Gets the status of a configured dependency using its `statusPath`. There are 3 levels of status:
OK - Everything is all good
WARN - The dependency is in a sub optimal state. See `details` in response for more info.
CRIT - The dependency has an error. See `details` in response for more info.
+ Parameters
+ dependency: `"mysql-db"` (string, required) - The `statusPath` of configured dependency to check the status of.
+ Response 200 (application/json)
+ Attributes (array)
+ (Status)
+ Body
[
"OK"
]
+ Response 200 (application/json)
+ Attributes (array)
+ (Status)
+ (StatusDetails)
+ Body
[
"CRIT",
{
"description":"mysql check CRIT",
"result":"CRIT",
"details":"Can't connect to database"
}
]
+ Response 200 (application/json)
+ Attributes (array)
+ (Status)
+ (StatusDetails)
+ Body
[
"WARN",
{
"description":"mysql check WARN",
"result":"WARN",
"details":"Running out of disk space"
}
]
# Data Structures
## Status (enum)
+ OK (string)
+ CRIT (string)
+ WARN (string)
## StatusDetails (object)
+ description : mysql (string, required) Description of the status check
+ result : CRIT (Status, required) Resulting Status of the check
+ details : Can't connect to database (string, required) Details about the result of the check. An error message
## Dependency (object)
+ name : "Mysql DB" (string, required) Name of the dependency
+ status : ["OK] (array[Status,StatusDetails], required) The status of the dependency
+ statusDuration : 0.001469342 (number, required) The length of time it took to check the status of the dependency
+ statusPath : mysql-db (string, required) The path of the status endpoint for this dependency
+ type : internal (string, required) The type of dependency
+ isTraversable : false (boolean, required) Is the dependency traversable
## About (object)
+ id : awesome (string, required) The unique id of the service. To be used in statusPath and dependencies for calling services
+ name : Awesome Service (string, required) The name of the service
+ description : The awesome service does awesome stuff (string, required) A description of the service
+ protocol : http (string, required) The protocol of the service
+ owners : ["Adam <adam@example.com>", "Denis <denis@example.com>"] (array[string], required) The owners/maintainers of the service
+ version : 1.1.0.5a1dea1 (string, required) The version of the service
+ host : s1.staging.example.com (string, required) Hostname of the machine hosting the service
+ projectRepo : https://github.com/hootsuite/awesome-service (string, required) Link to project source control
+ projectHome : https://documentation.com/awesome-service (string, required) Link to the documentation or homepage of the service
+ logsLinks : ["http://logging.com/logs", "http://logging.com/errors"] (array[string], required)
+ statsLinks : ["http://graphs.com/awesome-service-dashboard", "http://graphs.com/awesome-service-dashboard-2"] (array[string], required)
+ dependencies : (array[Dependency], required)
+ customData: (object, optional) Custom data defined by the service