This repository has been archived by the owner on May 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
support-logging.yaml
438 lines (436 loc) · 17.9 KB
/
support-logging.yaml
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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
openapi: 3.0.0
info:
title: Edgex Foundry - Support Logging API
description: This is the definition of the API for the Support Logging service in the EdgeX Foundry IOT microservice platform. Support Logging provides functionality to other services for use in logging. In the case where a client service isn't simply writing its logs to a file, it can make a call to Support Logging which then serves as an abstraction around the eventual persistence method for logs -- file, database, etc.
version: 2.x
servers:
- url: http://localhost:48061/api/v2
description: URL for local development and testing
components:
schemas:
CorrelatedRequest:
description: "Provides a correlation ID that can be used when grouping multiple requests into a single batch. For example, multiple log entries can be posted at once. Each entry has its own request identifier while the batch has an overall identifier. This allows for visibility into whether or not a response was obtained for every request in the batch."
type: object
properties:
correlationId:
description: "Identifies the batch to which this request belongs. If used via REST, this value should be the same as that of the ''X-Correlation-ID'' HTTP header."
type: string
format: uuid
example: "82eb2e26-0f24-48aa-ae4c-de9dac3fb9bc"
requestId:
description: "Uniquely identifies this request apart from its peers in the batch. For implementation, recommend this value be generated by the type's constructor."
type: string
format: uuid
example: "e6e8a2f4-eb14-4649-9e2b-175247911369"
required:
- correlationId
- requestId
CorrelatedResponse:
description: "Provides a correlation ID that can be used when grouping multiple responses into a single batch. For example, multiple log entries can be posted at once. The responses can be returned as a batch or individually. It doesn't matter as long as both of these properties are correctly set because either way the caller will have visibility into whether or not a response was obtained for every request in the batch."
type: object
properties:
correlationId:
description: "Identifies the batch to which this response belongs. If used via REST, this value should be the same as that of the ''X-Correlation-ID'' HTTP header."
type: string
format: uuid
example: "82eb2e26-0f24-48aa-ae4c-de9dac3fb9bc"
requestId:
description: "Uniquely identifies the request within the larger batch resulting in this response."
type: string
format: uuid
example: "e6e8a2f4-eb14-4649-9e2b-175247911369"
statusCode:
description: "A numeric code signifying the operational status of the response."
type: integer
message:
description: "A field that can contain a free-form message, such as an error message."
type: string
required:
- correlationId
- requestId
LogEntry:
description: "A model defining a basic log entry."
type: object
properties:
level:
description: "Defines the severity of the message being logged. Must be one of the following values -- TRACE, DEBUG, INFO, WARN, ERROR"
type: string
args:
description: "An array of objects, effectively treated as strings, that will be output as a series of key/value pairs. Useful for timestamps, identifying the location of the logging statement in the code, etc."
type: array
items:
type: object
originService:
description: "The service which generated the log entry"
type: string
message:
description: "The primary message to be logged."
type: string
created:
description: "Timestamp when the log entry was created."
type: integer
required:
- level
- originService
- message
- created
LogEntryResponse:
allOf:
- $ref: '#/components/schemas/CorrelatedResponse'
type: object
properties:
entry:
$ref: '#/components/schemas/LogEntry'
required:
- entry
PingResponse:
allOf:
- $ref: '#/components/schemas/CorrelatedResponse'
type: object
properties:
timestamp:
description: "Outputs the current server timestamp in RFC1123 format"
example: "Mon, 02 Jan 2006 15:04:05 MST"
type: string
RequestEnvelope:
description: "A wrapper type for use when sending a request to the /batch endpoint. Each individual request type in the HTTP request should be wrapped in an envelope to facilitate instantiation of the correct routing handler. See property descriptions below for more details."
type: object
properties:
action:
type: string
description: "Indicates the type of operation applicable to the wrapped request. Valid values are 'create','read','update','delete', and 'command'"
content:
type: string
format: byte
description: "A byte array containing a marshalled request type instance. This is the specific, semantically identifiable request -- such as an AddDeviceRequest."
strategy:
type: string
description: "Indicates the expectation of whether a response should be produced synchronously or asynchronously. If asynchronously, desire for either a polling or push/callback should be provided. Valid values are 'sync','async-push','async-poll'"
type:
type: string
description: "The name of the type applicable to the request instance contained in the 'content' property."
version:
description: "Proposed field for explicitly defining version of request DTO. This is for advertising compatibility between a publisher/subscriber or requester/receiver"
type: string
example: "2.0.x"
required:
- action
- content
- strategy
- type
- version
ResponseEnvelope:
description: "A wrapper type for use when receiving a response from the /batch endpoint. Each individual response type in the HTTP response should be wrapped in an envelope to facilitate unmarshalling by the client. See property descriptions below for more details."
type: object
properties:
action:
type: string
description: "Indicates the type of operation applicable to the wrapped response. This should be recapitulated from the originating request. Valid values are 'create','read','update','delete', and 'command'"
content:
type: string
format: byte
description: "A byte array containing a marshalled response type instance. This is the specific, semantically identifiable response -- such as an AddDeviceResponse."
strategy:
type: string
description: "Recapitulates the expectation with regard to the delivery of response that was specified on the originating request. Valid values are 'sync','async-push','async-poll'"
type:
type: string
description: "The name of the type applicable to the response instance contained in the 'content' property."
version:
description: "Proposed field for explicitly defining version of response DTO. This is for advertising compatibility between a publisher/subscriber or requester/receiver"
type: string
example: "2.0.x"
required:
- action
- content
- strategy
- type
- version
WriteLogEntryRequest:
allOf:
- $ref: '#/components/schemas/CorrelatedRequest'
description: "A request to persist a given log entry"
properties:
entry:
$ref: '#/components/schemas/LogEntry'
required:
- entry
WriteLogEntryResponse:
allOf:
- $ref: '#/components/schemas/CorrelatedResponse'
description: "A response to the operation of persisting a given log entry. While logging is largely a fire-and-forget operation, this response will prove useful if there's an error we need to communicate back to the caller."
parameters:
offsetParam:
in: query
name: offset
required: true
schema:
type: integer
minimum: 0
description: "The number of items to skip before starting to collect the result set."
limitParam:
in: query
name: limit
required: true
schema:
type: integer
minimum: 1
maximum: 50
default: 20
description: "The numbers of items to return."
logLevelsParam:
in: query
name: levels
required: false
schema:
type: string
description: "A comma-delimited string of log levels, allowing queries to only return log entries associated with the specified severity."
example: "TRACE, DEBUG"
keywordsParam:
in: query
name: keywords
required: false
schema:
type: string
description: "A simple keyword search term that should be present in the log entries of interest. Grouping, wildcards and boolean operators are not supported."
originServicesParam:
in: query
name: services
required: false
schema:
type: string
description: "A comma-delimited list of service keys indicating the services from which the log entries of interest originated."
example: "edgex-core-data, edgex-core-command"
correlatedRequestHeader:
in: header
name: X-Correlation-ID
description: "A unique identifier correlating a request to its associated response, facilitating tracing through being included on requests originating from the initiating request."
schema:
type: string
format: uuid
required: true
example: "14a42ea6-c394-41c3-8bcd-a29b9f5e6835"
headers:
correlatedResponseHeader:
description: "A response header that returns the unique correlation ID used to initiate the request."
schema:
type: string
format: uuid
required: true
example: "14a42ea6-c394-41c3-8bcd-a29b9f5e6835"
paths:
/batch:
parameters:
- $ref: '#/components/parameters/correlatedRequestHeader'
post:
summary: "Accepts an arbitrary number of RequestEnvelope instances. Each RequestEnvelope has a 'content' property that holds a specific request type. This endpoint is operation agnostic will route the request to the appropriate handler implementation within the service."
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/RequestEnvelope'
responses:
'207':
description: "Indicates a multi-part response supportive of accepting multiple requests at once. The 'statusCode' property of each response in the returned array will indicate success or failure."
headers:
X-Correlation-ID:
$ref: '#/components/headers/correlatedResponseHeader'
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ResponseEnvelope'
/logs:
parameters:
- $ref: '#/components/parameters/correlatedRequestHeader'
post:
summary: "The endpoint for writing new log entries"
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/WriteLogEntryRequest'
responses:
'207':
description: "Indicates a multi-part response supportive of accepting multiple requests at once. The 'statusCode' property of each response in the returned array will indicate success or failure."
headers:
X-Correlation-ID:
$ref: '#/components/headers/correlatedResponseHeader'
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/WriteLogEntryResponse'
/logs/all:
parameters:
- $ref: '#/components/parameters/correlatedRequestHeader'
- $ref: '#/components/parameters/logLevelsParam'
- $ref: '#/components/parameters/keywordsParam'
- $ref: '#/components/parameters/originServicesParam'
get:
parameters:
- $ref: '#/components/parameters/offsetParam'
- $ref: '#/components/parameters/limitParam'
summary: "Allows paginated retrieval of log entries matching the specified parameters, sorted by created timestamp descending."
responses:
'200':
description: "OK"
headers:
X-Correlation-ID:
$ref: '#/components/headers/correlatedResponseHeader'
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/LogEntryResponse'
'500':
description: "An unexpected error occurred on the server"
headers:
X-Correlation-ID:
$ref: '#/components/headers/correlatedResponseHeader'
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/LogEntryResponse'
delete:
summary: "Allows deletion of log entries matching the specified parameters (levels, keywords, services, etc)"
responses:
'204':
description: "Delete successful"
headers:
X-Correlation-ID:
$ref: '#/components/headers/correlatedResponseHeader'
'400':
description: "Request is in an invalid state"
headers:
X-Correlation-ID:
$ref: '#/components/headers/correlatedResponseHeader'
content:
application/json:
schema:
$ref: '#/components/schemas/LogEntryResponse'
'500':
description: "An unexpected error occurred on the server"
headers:
X-Correlation-ID:
$ref: '#/components/headers/correlatedResponseHeader'
content:
application/json:
schema:
$ref: '#/components/schemas/LogEntryResponse'
/logs/start/{start}/end/{end}:
parameters:
- $ref: '#/components/parameters/correlatedRequestHeader'
- $ref: '#/components/parameters/logLevelsParam'
- $ref: '#/components/parameters/keywordsParam'
- $ref: '#/components/parameters/originServicesParam'
- name: start
in: path
required: true
schema:
type: integer
description: "The beginning timestamp of the range of log entries to be returned."
- name: end
in: path
required: true
schema:
type: integer
description: "The ending timestamp of the range of log entries to be returned."
get:
parameters:
- $ref: '#/components/parameters/offsetParam'
- $ref: '#/components/parameters/limitParam'
summary: "Allows paginated retrieval of log entries within a given time range, sorted by created timestamp descending."
responses:
'200':
description: "OK"
headers:
X-Correlation-ID:
$ref: '#/components/headers/correlatedResponseHeader'
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/LogEntryResponse'
'400':
description: "Request is in an invalid state"
headers:
X-Correlation-ID:
$ref: '#/components/headers/correlatedResponseHeader'
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/LogEntryResponse'
'500':
description: "An unexpected error occurred on the server"
headers:
X-Correlation-ID:
$ref: '#/components/headers/correlatedResponseHeader'
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/LogEntryResponse'
delete:
summary: "Allows deletion of log entries within a given time range"
responses:
'204':
description: "Delete successful"
headers:
X-Correlation-ID:
$ref: '#/components/headers/correlatedResponseHeader'
'400':
description: "Request is in an invalid state"
headers:
X-Correlation-ID:
$ref: '#/components/headers/correlatedResponseHeader'
content:
application/json:
schema:
$ref: '#/components/schemas/LogEntryResponse'
'500':
description: "An unexpected error occurred on the server"
headers:
X-Correlation-ID:
$ref: '#/components/headers/correlatedResponseHeader'
content:
application/json:
schema:
$ref: '#/components/schemas/LogEntryResponse'
/ping:
get:
summary: "A simple 'ping' endpoint that can be used as a service healthcheck"
responses:
'200':
description: "OK"
headers:
X-Correlation-ID:
$ref: '#/components/headers/correlatedResponseHeader'
content:
application/json:
schema:
$ref: '#/components/schemas/PingResponse'
'500':
description: "An unexpected error occurred on the server"
headers:
X-Correlation-ID:
$ref: '#/components/headers/correlatedResponseHeader'
content:
application/json:
schema:
$ref: '#/components/schemas/PingResponse'