-
Notifications
You must be signed in to change notification settings - Fork 13
/
draft-inadarei-api-health-check-03.html
948 lines (900 loc) · 39.9 KB
/
draft-inadarei-api-health-check-03.html
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
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head profile="http://www.w3.org/2006/03/hcard http://dublincore.org/documents/2008/08/04/dc-html/">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<title>Health Check Response Format for HTTP APIs</title>
<style type="text/css" title="Xml2Rfc (sans serif)">
/*<![CDATA[*/
a {
text-decoration: none;
}
/* info code from SantaKlauss at http://www.madaboutstyle.com/tooltip2.html */
a.info {
/* This is the key. */
position: relative;
z-index: 24;
text-decoration: none;
}
a.info:hover {
z-index: 25;
color: #FFF; background-color: #900;
}
a.info span { display: none; }
a.info:hover span.info {
/* The span will display just on :hover state. */
display: block;
position: absolute;
font-size: smaller;
top: 2em; left: -5em; width: 15em;
padding: 2px; border: 1px solid #333;
color: #900; background-color: #EEE;
text-align: left;
}
a.smpl {
color: black;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: underline;
}
address {
margin-top: 1em;
margin-left: 2em;
font-style: normal;
}
body {
color: black;
font-family: verdana, helvetica, arial, sans-serif;
font-size: 10pt;
max-width: 55em;
}
cite {
font-style: normal;
}
dd {
margin-right: 2em;
}
dl {
margin-left: 2em;
}
ul.empty {
list-style-type: none;
}
ul.empty li {
margin-top: .5em;
}
dl p {
margin-left: 0em;
}
dt {
margin-top: .5em;
}
h1 {
font-size: 14pt;
line-height: 21pt;
page-break-after: avoid;
}
h1.np {
page-break-before: always;
}
h1 a {
color: #333333;
}
h2 {
font-size: 12pt;
line-height: 15pt;
page-break-after: avoid;
}
h3, h4, h5, h6 {
font-size: 10pt;
page-break-after: avoid;
}
h2 a, h3 a, h4 a, h5 a, h6 a {
color: black;
}
img {
margin-left: 3em;
}
li {
margin-left: 2em;
margin-right: 2em;
}
ol {
margin-left: 2em;
margin-right: 2em;
}
ol p {
margin-left: 0em;
}
p {
margin-left: 2em;
margin-right: 2em;
}
pre {
margin-left: 3em;
background-color: lightyellow;
padding: .25em;
}
pre.text2 {
border-style: dotted;
border-width: 1px;
background-color: #f0f0f0;
width: 69em;
}
pre.inline {
background-color: white;
padding: 0em;
}
pre.text {
border-style: dotted;
border-width: 1px;
background-color: #f8f8f8;
width: 69em;
}
pre.drawing {
border-style: solid;
border-width: 1px;
background-color: #f8f8f8;
padding: 2em;
}
table {
margin-left: 2em;
}
table.tt {
vertical-align: top;
}
table.full {
border-style: outset;
border-width: 1px;
}
table.headers {
border-style: outset;
border-width: 1px;
}
table.tt td {
vertical-align: top;
}
table.full td {
border-style: inset;
border-width: 1px;
}
table.tt th {
vertical-align: top;
}
table.full th {
border-style: inset;
border-width: 1px;
}
table.headers th {
border-style: none none inset none;
border-width: 1px;
}
table.left {
margin-right: auto;
}
table.right {
margin-left: auto;
}
table.center {
margin-left: auto;
margin-right: auto;
}
caption {
caption-side: bottom;
font-weight: bold;
font-size: 9pt;
margin-top: .5em;
}
table.header {
border-spacing: 1px;
width: 95%;
font-size: 10pt;
color: white;
}
td.top {
vertical-align: top;
}
td.topnowrap {
vertical-align: top;
white-space: nowrap;
}
table.header td {
background-color: gray;
width: 50%;
}
table.header a {
color: white;
}
td.reference {
vertical-align: top;
white-space: nowrap;
padding-right: 1em;
}
thead {
display:table-header-group;
}
ul.toc, ul.toc ul {
list-style: none;
margin-left: 1.5em;
margin-right: 0em;
padding-left: 0em;
}
ul.toc li {
line-height: 150%;
font-weight: bold;
font-size: 10pt;
margin-left: 0em;
margin-right: 0em;
}
ul.toc li li {
line-height: normal;
font-weight: normal;
font-size: 9pt;
margin-left: 0em;
margin-right: 0em;
}
li.excluded {
font-size: 0pt;
}
ul p {
margin-left: 0em;
}
.comment {
background-color: yellow;
}
.center {
text-align: center;
}
.error {
color: red;
font-style: italic;
font-weight: bold;
}
.figure {
font-weight: bold;
text-align: center;
font-size: 9pt;
}
.filename {
color: #333333;
font-weight: bold;
font-size: 12pt;
line-height: 21pt;
text-align: center;
}
.fn {
font-weight: bold;
}
.hidden {
display: none;
}
.left {
text-align: left;
}
.right {
text-align: right;
}
.title {
color: #990000;
font-size: 18pt;
line-height: 18pt;
font-weight: bold;
text-align: center;
margin-top: 36pt;
}
.vcardline {
display: block;
}
.warning {
font-size: 14pt;
background-color: yellow;
}
@media print {
.noprint {
display: none;
}
a {
color: black;
text-decoration: none;
}
table.header {
width: 90%;
}
td.header {
width: 50%;
color: black;
background-color: white;
vertical-align: top;
font-size: 12pt;
}
ul.toc a::after {
content: leader('.') target-counter(attr(href), page);
}
ul.ind li li a {
content: target-counter(attr(href), page);
}
.print2col {
column-count: 2;
-moz-column-count: 2;
column-fill: auto;
}
}
@page {
@top-left {
content: "Internet-Draft";
}
@top-right {
content: "December 2010";
}
@top-center {
content: "Abbreviated Title";
}
@bottom-left {
content: "Doe";
}
@bottom-center {
content: "Expires June 2011";
}
@bottom-right {
content: "[Page " counter(page) "]";
}
}
@page:first {
@top-left {
content: normal;
}
@top-right {
content: normal;
}
@top-center {
content: normal;
}
}
/*]]>*/
</style>
<link href="#rfc.toc" rel="Contents">
<link href="#rfc.section.1" rel="Chapter" title="1 Introduction">
<link href="#rfc.section.2" rel="Chapter" title="2 Notational Conventions">
<link href="#rfc.section.3" rel="Chapter" title="3 API Health Response">
<link href="#rfc.section.3.1" rel="Chapter" title="3.1 status">
<link href="#rfc.section.3.2" rel="Chapter" title="3.2 version">
<link href="#rfc.section.3.3" rel="Chapter" title="3.3 releaseId">
<link href="#rfc.section.3.4" rel="Chapter" title="3.4 notes">
<link href="#rfc.section.3.5" rel="Chapter" title="3.5 output">
<link href="#rfc.section.3.6" rel="Chapter" title="3.6 checks">
<link href="#rfc.section.3.7" rel="Chapter" title="3.7 links">
<link href="#rfc.section.3.8" rel="Chapter" title="3.8 serviceId">
<link href="#rfc.section.3.9" rel="Chapter" title="3.9 description">
<link href="#rfc.section.4" rel="Chapter" title="4 The Checks Object">
<link href="#rfc.section.4.1" rel="Chapter" title="4.1 componentId">
<link href="#rfc.section.4.2" rel="Chapter" title="4.2 componentType">
<link href="#rfc.section.4.3" rel="Chapter" title="4.3 observedValue">
<link href="#rfc.section.4.4" rel="Chapter" title="4.4 observedUnit">
<link href="#rfc.section.4.5" rel="Chapter" title="4.5 status">
<link href="#rfc.section.4.6" rel="Chapter" title="4.6 affectedEndpoints">
<link href="#rfc.section.4.7" rel="Chapter" title="4.7 time">
<link href="#rfc.section.4.8" rel="Chapter" title="4.8 output">
<link href="#rfc.section.4.9" rel="Chapter" title="4.9 links">
<link href="#rfc.section.5" rel="Chapter" title="5 Example Output">
<link href="#rfc.section.6" rel="Chapter" title="6 Security Considerations">
<link href="#rfc.section.7" rel="Chapter" title="7 IANA Considerations">
<link href="#rfc.section.8" rel="Chapter" title="8 Acknowledgements">
<link href="#rfc.section.9" rel="Chapter" title="9 Creating and Serving Health Responses">
<link href="#rfc.section.10" rel="Chapter" title="10 Consuming Health Check Responses">
<link href="#rfc.references" rel="Chapter" title="11 References">
<link href="#rfc.references.1" rel="Chapter" title="11.1 Normative References">
<link href="#rfc.references.2" rel="Chapter" title="11.2 Informative References">
<link href="#rfc.authors" rel="Chapter">
<meta name="generator" content="xml2rfc version 2.10.3 - https://tools.ietf.org/tools/xml2rfc" />
<link rel="schema.dct" href="http://purl.org/dc/terms/" />
<meta name="dct.creator" content="Nadareishvili, I." />
<meta name="dct.identifier" content="urn:ietf:id:draft-inadarei-api-health-check-03" />
<meta name="dct.issued" scheme="ISO8601" content="2019-09" />
<meta name="dct.abstract" content="This document proposes a service health check response format for HTTP APIs." />
<meta name="description" content="This document proposes a service health check response format for HTTP APIs." />
</head>
<body>
<table class="header">
<tbody>
<tr>
<td class="left">Network Working Group</td>
<td class="right">I. Nadareishvili</td>
</tr>
<tr>
<td class="left">Internet-Draft</td>
<td class="right">May 9, 2019</td>
</tr>
<tr>
<td class="left">Intended status: Informational</td>
<td class="right"></td>
</tr>
<tr>
<td class="left">Expires: November 10, 2019</td>
<td class="right"></td>
</tr>
</tbody>
</table>
<p class="title">Health Check Response Format for HTTP APIs<br />
<span class="filename">draft-inadarei-api-health-check-03</span></p>
<h1 id="rfc.abstract"><a href="#rfc.abstract">Abstract</a></h1>
<p>This document proposes a service health check response format for HTTP APIs.</p>
<h1><a>Note to Readers</a></h1>
<p><strong>RFC EDITOR: please remove this section before publication</strong></p>
<p>The issues list for this draft can be found at <a href="https://github.com/inadarei/rfc-healthcheck/issues">https://github.com/inadarei/rfc-healthcheck/issues</a>.</p>
<p>The most recent draft is at <a href="https://inadarei.github.io/rfc-healthcheck/">https://inadarei.github.io/rfc-healthcheck/</a>.</p>
<p>Recent changes are listed at <a href="https://github.com/inadarei/rfc-healthcheck/commits/master">https://github.com/inadarei/rfc-healthcheck/commits/master</a>.</p>
<p>See also the draft’s current status in the IETF datatracker, at <a href="https://datatracker.ietf.org/doc/draft-inadarei-api-health-check/">https://datatracker.ietf.org/doc/draft-inadarei-api-health-check/</a>.</p>
<h1 id="rfc.status"><a href="#rfc.status">Status of This Memo</a></h1>
<p>This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.</p>
<p>Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.</p>
<p>Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."</p>
<p>This Internet-Draft will expire on November 10, 2019.</p>
<h1 id="rfc.copyrightnotice"><a href="#rfc.copyrightnotice">Copyright Notice</a></h1>
<p>Copyright (c) 2019 IETF Trust and the persons identified as the document authors. All rights reserved.</p>
<p>This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.</p>
<hr class="noprint" />
<h1 class="np" id="rfc.toc"><a href="#rfc.toc">Table of Contents</a></h1>
<ul class="toc">
<li>1. <a href="#rfc.section.1">Introduction</a>
</li>
<li>2. <a href="#rfc.section.2">Notational Conventions</a>
</li>
<li>3. <a href="#rfc.section.3">API Health Response</a>
</li>
<ul><li>3.1. <a href="#rfc.section.3.1">status</a>
</li>
<li>3.2. <a href="#rfc.section.3.2">version</a>
</li>
<li>3.3. <a href="#rfc.section.3.3">releaseId</a>
</li>
<li>3.4. <a href="#rfc.section.3.4">notes</a>
</li>
<li>3.5. <a href="#rfc.section.3.5">output</a>
</li>
<li>3.6. <a href="#rfc.section.3.6">checks</a>
</li>
<li>3.7. <a href="#rfc.section.3.7">links</a>
</li>
<li>3.8. <a href="#rfc.section.3.8">serviceId</a>
</li>
<li>3.9. <a href="#rfc.section.3.9">description</a>
</li>
</ul><li>4. <a href="#rfc.section.4">The Checks Object</a>
</li>
<ul><li>4.1. <a href="#rfc.section.4.1">componentId</a>
</li>
<li>4.2. <a href="#rfc.section.4.2">componentType</a>
</li>
<li>4.3. <a href="#rfc.section.4.3">observedValue</a>
</li>
<li>4.4. <a href="#rfc.section.4.4">observedUnit</a>
</li>
<li>4.5. <a href="#rfc.section.4.5">status</a>
</li>
<li>4.6. <a href="#rfc.section.4.6">affectedEndpoints</a>
</li>
<li>4.7. <a href="#rfc.section.4.7">time</a>
</li>
<li>4.8. <a href="#rfc.section.4.8">output</a>
</li>
<li>4.9. <a href="#rfc.section.4.9">links</a>
</li>
</ul><li>5. <a href="#rfc.section.5">Example Output</a>
</li>
<li>6. <a href="#rfc.section.6">Security Considerations</a>
</li>
<li>7. <a href="#rfc.section.7">IANA Considerations</a>
</li>
<li>8. <a href="#rfc.section.8">Acknowledgements</a>
</li>
<li>9. <a href="#rfc.section.9">Creating and Serving Health Responses</a>
</li>
<li>10. <a href="#rfc.section.10">Consuming Health Check Responses</a>
</li>
<li>11. <a href="#rfc.references">References</a>
</li>
<ul><li>11.1. <a href="#rfc.references.1">Normative References</a>
</li>
<li>11.2. <a href="#rfc.references.2">Informative References</a>
</li>
</ul><li><a href="#rfc.authors">Author's Address</a>
</li>
</ul>
<h1 id="rfc.section.1">
<a href="#rfc.section.1">1.</a> <a href="#introduction" id="introduction">Introduction</a>
</h1>
<p id="rfc.section.1.p.1">The vast majority of modern APIs driving data to web and mobile applications use HTTP <a href="#RFC7230" class="xref">[RFC7230]</a> as their protocol. The health and uptime of these APIs determine availability of the applications themselves. In distributed systems built with a number of APIs, understanding the health status of the APIs and making corresponding decisions, for caching, failover or circuit-breaking, are essential to the ability of providing highly-available solutions.</p>
<p id="rfc.section.1.p.2">There exists a wide variety of operational software that relies on the ability to read health check response of APIs. However, there is currently no standard for the health check output response, so most applications either rely on the basic level of information included in HTTP status codes <a href="#RFC7231" class="xref">[RFC7231]</a> or use task-specific formats.</p>
<p id="rfc.section.1.p.3">Usage of task-specific or application-specific formats creates significant challenges, disallowing any meaningful interoperability across different implementations and between different tooling.</p>
<p id="rfc.section.1.p.4">Standardizing a format for health checks can provide any of a number of benefits, including:</p>
<p></p>
<ul>
<li>Flexible deployment - since operational tooling and API clients can rely on rich, uniform format, they can be safely combined and substituted as needed.</li>
<li>Evolvability - new APIs, conforming to the standard, can safely be introduced in any environment and ecosystem that also conforms to the same standard, without costly coordination and testing requirements.</li>
</ul>
<p id="rfc.section.1.p.6">This document defines a “health check” format using the JSON format <a href="#RFC8259" class="xref">[RFC8259]</a> for APIs to use as a standard point for the health information they offer. Having a well-defined format for this purpose promotes good practice and tooling.</p>
<h1 id="rfc.section.2">
<a href="#rfc.section.2">2.</a> <a href="#notational-conventions" id="notational-conventions">Notational Conventions</a>
</h1>
<p id="rfc.section.2.p.1">The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in <a href="#RFC2119" class="xref">[RFC2119]</a>.</p>
<h1 id="rfc.section.3">
<a href="#rfc.section.3">3.</a> <a href="#api-health-response" id="api-health-response">API Health Response</a>
</h1>
<p id="rfc.section.3.p.1">Health Check Response Format for HTTP APIs uses the JSON format described in <a href="#RFC8259" class="xref">[RFC8259]</a> and has the media type “application/health+json”.</p>
<p id="rfc.section.3.p.2">Its content consists of a single mandatory root field (“status”) and several optional fields:</p>
<h1 id="rfc.section.3.1">
<a href="#rfc.section.3.1">3.1.</a> <a href="#status" id="status">status</a>
</h1>
<p id="rfc.section.3.1.p.1">status: (required) indicates whether the service status is acceptable or not. API publishers SHOULD use following values for the field:</p>
<p></p>
<ul>
<li>“pass”: healthy (acceptable aliases: “ok” to support Node’s Terminus and “up” for Java’s SpringBoot),</li>
<li>“fail”: unhealthy (acceptable aliases: “error” to support Node’s Terminus and “down” for Java’s SpringBoot), and</li>
<li>“warn”: healthy, with some concerns.</li>
</ul>
<p id="rfc.section.3.1.p.3">The value of the status field is case-insensitive and is tightly related with the HTTP response code returned by the health endpoint. For “pass” status, HTTP response code in the 2xx-3xx range MUST be used. For “fail” status, HTTP response code in the 4xx-5xx range MUST be used. In case of the “warn” status, endpoints MUST return HTTP status in the 2xx-3xx range, and additional information SHOULD be provided, utilizing optional fields of the response.</p>
<p id="rfc.section.3.1.p.4">A health endpoint is only meaningful in the context of the component it indicates the health of. It has no other meaning or purpose. As such, its health is a conduit to the health of the component. Clients SHOULD assume that the HTTP response code returned by the health endpoint is applicable to the entire component (e.g. a larger API or a microservice). This is compatible with the behavior that current infrastructural tooling expects: load-balancers, service discoveries and others, utilizing health-checks.</p>
<h1 id="rfc.section.3.2">
<a href="#rfc.section.3.2">3.2.</a> <a href="#version" id="version">version</a>
</h1>
<p id="rfc.section.3.2.p.1">version: (optional) public version of the service.</p>
<h1 id="rfc.section.3.3">
<a href="#rfc.section.3.3">3.3.</a> <a href="#releaseid" id="releaseid">releaseId</a>
</h1>
<p id="rfc.section.3.3.p.1">releaseId: (optional) in well-designed APIs, backwards-compatible changes in the service should not update a version number. APIs usually change their version number as infrequently as possible, to preserve stable interface. However, implementation of an API may change much more frequently, which leads to the importance of having separate “release number” or “releaseId” that is different from the public version of the API.</p>
<h1 id="rfc.section.3.4">
<a href="#rfc.section.3.4">3.4.</a> <a href="#notes" id="notes">notes</a>
</h1>
<p id="rfc.section.3.4.p.1">notes: (optional) array of notes relevant to current state of health</p>
<h1 id="rfc.section.3.5">
<a href="#rfc.section.3.5">3.5.</a> <a href="#output" id="output">output</a>
</h1>
<p id="rfc.section.3.5.p.1">output: (optional) raw error output, in case of “fail” or “warn” states. This field SHOULD be omitted for “pass” state.</p>
<h1 id="rfc.section.3.6">
<a href="#rfc.section.3.6">3.6.</a> <a href="#checks" id="checks">checks</a>
</h1>
<p id="rfc.section.3.6.p.1">checks (optional) is an object that provides detailed health statuses of additional downstream systems and endpoints which can affect the overall health of the main API. Please refer to the “The Checks Object” section for more information.</p>
<h1 id="rfc.section.3.7">
<a href="#rfc.section.3.7">3.7.</a> <a href="#links" id="links">links</a>
</h1>
<p id="rfc.section.3.7.p.1">links (optional) is an array of objects containing link relations and URIs <a href="#RFC3986" class="xref">[RFC3986]</a> for external links that MAY contain more information about the health of the endpoint. Per web-linking standards <a href="#RFC8288" class="xref">[RFC8288]</a> a link relationship SHOULD either be a common/registered one or be indicated as a URI, to avoid name clashes. If a “self” link is provided, it MAY be used by clients to check health via HTTP response code, as mentioned above.</p>
<h1 id="rfc.section.3.8">
<a href="#rfc.section.3.8">3.8.</a> <a href="#serviceid" id="serviceid">serviceId</a>
</h1>
<p id="rfc.section.3.8.p.1">serviceId (optional) is a unique identifier of the service, in the application scope.</p>
<h1 id="rfc.section.3.9">
<a href="#rfc.section.3.9">3.9.</a> <a href="#description" id="description">description</a>
</h1>
<p id="rfc.section.3.9.p.1">description (optional) is a human-friendly description of the service.</p>
<h1 id="rfc.section.4">
<a href="#rfc.section.4">4.</a> <a href="#the-checks-object" id="the-checks-object">The Checks Object</a>
</h1>
<p id="rfc.section.4.p.1">The “checks” object MAY have a number of unique keys, one for each logical downstream dependency or sub-component. Since each sub-component may be backed by several nodes with varying health statuses, these keys point to arrays of objects. In case of a single-node sub-component (or if presence of nodes is not relevant), a single-element array SHOULD be used as the value, for consistency.</p>
<p id="rfc.section.4.p.2">The key identifying an element in the object SHOULD be a unique string within the details section. It MAY have two parts: “{componentName}:{measurementName}”, in which case the meaning of the parts SHOULD be as follows:</p>
<p></p>
<ul>
<li>componentName: (optional) human-readable name for the component. MUST not contain a colon, in the name, since colon is used as a separator.</li>
<li>measurementName: (optional) name of the measurement type (a data point type) that the status is reported for. MUST not contain a colon, in the name, since colon is used as a separator. The observation’s name can be one of: <ul>
<li>A pre-defined value from this spec. Pre-defined values include: <ul>
<li>utilization</li>
<li>responseTime</li>
<li>connections</li>
<li>uptime</li>
</ul>
</li>
<li>A common and standard term from a well-known source such as schema.org, IANA or microformats.</li>
<li>A URI that indicates extra semantics and processing rules that MAY be provided by a resource at the other end of the URI. URIs do not have to be dereferenceable, however. They are just a namespace, and the meaning of a namespace CAN be provided by any convenient means (e.g. publishing an RFC, Swagger document or a nicely printed book).</li>
</ul>
</li>
</ul>
<p id="rfc.section.4.p.4">On the value side of the equation, each “component details” object in the array MAY have one of the following object keys:</p>
<h1 id="rfc.section.4.1">
<a href="#rfc.section.4.1">4.1.</a> <a href="#componentid" id="componentid">componentId</a>
</h1>
<p id="rfc.section.4.1.p.1">componentId: (optional) is a unique identifier of an instance of a specific sub-component/dependency of a service. Multiple objects with the same componentID MAY appear in the details, if they are from different nodes.</p>
<h1 id="rfc.section.4.2">
<a href="#rfc.section.4.2">4.2.</a> <a href="#componenttype" id="componenttype">componentType</a>
</h1>
<p id="rfc.section.4.2.p.1">componentType: (optional) SHOULD be present if componentName is present. It’s a type of the component and could be one of:</p>
<p></p>
<ul>
<li>Pre-defined value from this spec. Pre-defined values include: <ul>
<li>component</li>
<li>datastore</li>
<li>system</li>
</ul>
</li>
<li>A common and standard term from a well-known source such as schema.org, IANA or microformats.</li>
<li>A URI that indicates extra semantics and processing rules that MAY be provided by a resource at the other end of the URI. URIs do not have to be dereferenceable, however. They are just a namespace, and the meaning of a namespace CAN be provided by any convenient means (e.g. publishing an RFC, Swagger document or a nicely printed book).</li>
</ul>
<h1 id="rfc.section.4.3">
<a href="#rfc.section.4.3">4.3.</a> <a href="#observedvalue" id="observedvalue">observedValue</a>
</h1>
<p id="rfc.section.4.3.p.1">observedValue: (optional) could be any valid JSON value, such as: string, number, object, array or literal.</p>
<h1 id="rfc.section.4.4">
<a href="#rfc.section.4.4">4.4.</a> <a href="#observedunit" id="observedunit">observedUnit</a>
</h1>
<p id="rfc.section.4.4.p.1">observedUnit (optional) SHOULD be present if observedValue is present. Clarifies the unit of measurement in which observedUnit is reported, e.g. for a time-based value it is important to know whether the time is reported in seconds, minutes, hours or something else. To make sure unit is denoted by a well-understood name or an abbreviation, it SHOULD be one of:</p>
<p></p>
<ul>
<li>A common and standard term from a well-known source such as schema.org, IANA, microformats, or a standards document such as <a href="#RFC3339" class="xref">[RFC3339]</a>.</li>
<li>A URI that indicates extra semantics and processing rules that MAY be provided by a resource at the other end of the URI. URIs do not have to be dereferenceable, however. They are just a namespace, and the meaning of a namespace CAN be provided by any convenient means (e.g. publishing an RFC, Swagger document or a nicely printed book).</li>
</ul>
<h1 id="rfc.section.4.5">
<a href="#rfc.section.4.5">4.5.</a> <a href="#status-1" id="status-1">status</a>
</h1>
<p id="rfc.section.4.5.p.1">status (optional) has the exact same meaning as the top-level “output” element, but for the sub-component/downstream dependency represented by the details object.</p>
<h1 id="rfc.section.4.6">
<a href="#rfc.section.4.6">4.6.</a> <a href="#affectedendpoints" id="affectedendpoints">affectedEndpoints</a>
</h1>
<p id="rfc.section.4.6.p.1">A typical API has many URI endpoints. Most of the time we are interested in the overall health of the API, without diving into details. That said, sometimes operational and resilience middleware needs to know more details about the health of the API (which is why “checks” property provides details). In such cases, we often need to indicate which particular endpoints are affected by a particular check’s troubles vs. other endpoints that may be fine. The <samp>affectedEndpoints</samp> property is a JSON array containing URI Templates as defined by <a href="#RFC6570" class="xref">[RFC6570]</a>.</p>
<h1 id="rfc.section.4.7">
<a href="#rfc.section.4.7">4.7.</a> <a href="#time" id="time">time</a>
</h1>
<p id="rfc.section.4.7.p.1">time (optional) is the date-time, in ISO8601 format, at which the reading of the observedValue was recorded. This assumes that the value can be cached and the reading typically doesn’t happen in real time, for performance and scalability purposes.</p>
<h1 id="rfc.section.4.8">
<a href="#rfc.section.4.8">4.8.</a> <a href="#output-1" id="output-1">output</a>
</h1>
<p id="rfc.section.4.8.p.1">output (optional) has the exact same meaning as the top-level “output” element, but for the sub-component/downstream dependency represented by the details object.</p>
<h1 id="rfc.section.4.9">
<a href="#rfc.section.4.9">4.9.</a> <a href="#links-1" id="links-1">links</a>
</h1>
<p id="rfc.section.4.9.p.1">links (optional) has the exact same meaning as the top-level “output” element, but for the sub-component/downstream dependency represented by the details object.</p>
<h1 id="rfc.section.5">
<a href="#rfc.section.5">5.</a> <a href="#example-output" id="example-output">Example Output</a>
</h1>
<pre>
GET /health HTTP/1.1
Host: example.org
Accept: application/health+json
HTTP/1.1 200 OK
Content-Type: application/health+json
Cache-Control: max-age=3600
Connection: close
{
"status": "pass",
"version": "1",
"releaseId": "1.2.2",
"notes": [""],
"output": "",
"serviceId": "f03e522f-1f44-4062-9b55-9587f91c9c41",
"description": "health of authz service",
"checks": {
"cassandra:responseTime": [
{
"componentId": "dfd6cf2b-1b6e-4412-a0b8-f6f7797a60d2",
"componentType": "datastore",
"observedValue": 250,
"observedUnit": "ms",
"status": "pass",
"affectedEndpoints" : [
"/users/{userId}",
"/customers/{customerId}/status",
"/shopping/{anything}"
],
"time": "2018-01-17T03:36:48Z",
"output": ""
}
],
"cassandra:connections": [
{
"componentId": "dfd6cf2b-1b6e-4412-a0b8-f6f7797a60d2",
"type": "datastore",
"observedValue": 75,
"status": "warn",
"time": "2018-01-17T03:36:48Z",
"output": "",
"links": {
"self": "http://api.example.com/dbnode/dfd6cf2b/health"
}
}
],
"uptime": [
{
"componentType": "system",
"observedValue": 1209600.245,
"observedUnit": "s",
"status": "pass",
"time": "2018-01-17T03:36:48Z"
}
],
"cpu:utilization": [
{
"componentId": "6fd416e0-8920-410f-9c7b-c479000f7227",
"node": 1,
"componentType": "system",
"observedValue": 85,
"observedUnit": "percent",
"status": "warn",
"time": "2018-01-17T03:36:48Z",
"output": ""
},
{
"componentId": "6fd416e0-8920-410f-9c7b-c479000f7227",
"node": 2,
"componentType": "system",
"observedValue": 85,
"observedUnit": "percent",
"status": "warn",
"time": "2018-01-17T03:36:48Z",
"output": ""
}
],
"memory:utilization": [
{
"componentId": "6fd416e0-8920-410f-9c7b-c479000f7227",
"node": 1,
"componentType": "system",
"observedValue": 8.5,
"observedUnit": "GiB",
"status": "warn",
"time": "2018-01-17T03:36:48Z",
"output": ""
},
{
"componentId": "6fd416e0-8920-410f-9c7b-c479000f7227",
"node": 2,
"componentType": "system",
"observedValue": 5500,
"observedUnit": "MiB",
"status": "pass",
"time": "2018-01-17T03:36:48Z",
"output": ""
}
]
},
"links": {
"about": "http://api.example.com/about/authz",
"http://api.x.io/rel/thresholds":
"http://api.x.io/about/authz/thresholds"
}
}
</pre>
<h1 id="rfc.section.6">
<a href="#rfc.section.6">6.</a> <a href="#security-considerations" id="security-considerations">Security Considerations</a>
</h1>
<p id="rfc.section.6.p.1">Clients need to exercise care when reporting health information. Malicious actors could use this information for orchestrating attacks. In some cases, the health check endpoints may need to be authenticated and institute role-based access control.</p>
<h1 id="rfc.section.7">
<a href="#rfc.section.7">7.</a> <a href="#iana-considerations" id="iana-considerations">IANA Considerations</a>
</h1>
<p id="rfc.section.7.p.1">The media type for health check response is application/health+json.</p>
<p></p>
<ul>
<li>Media type name: application</li>
<li>Media subtype name: health+json</li>
<li>Required parameters: n/a</li>
<li>Optional parameters: n/a</li>
<li>Encoding considerations: binary</li>
<li>Security considerations: Health+JSON shares security issues common to all JSON content types. See RFC 8259 Section #12 for additional information. <br><br> Health+JSON allows utilization of Uniform Resource Identifiers (URIs) and as such shares security issues common to URI usage. See RFC 3986 Section #7 for additional information. <br><br> Since health+json can carry wide variety of data, some data may require privacy or integrity services. This specification does not prescribe any specific solution and assumes that concrete implementations will utilize common, trusted approaches such as TLS/HTTPS, OAuth2 etc.</li>
<li>Interoperability considerations: None</li>
<li>Published specification: this RFC draft</li>
<li>Applications which use this media: Various</li>
<li>Fragment identifier considerations: Health+JSON follows RFC6901 for implementing URI Fragment Identification standard to JSON content types.</li>
<li>Restrictions on usage: None</li>
<li>Additional information: <ol>
<li>Deprecated alias names for this type: n/a</li>
<li>Magic number(s): n/a</li>
<li>File extension(s): .json</li>
<li>Macintosh file type code: TEXT</li>
<li>Object Identifiers: n/a</li>
</ol>
</li>
<li>General Comments:</li>
<li>Person to contact for further information: <ol>
<li>Name: Irakli Nadareishvili</li>
<li>Email: [email protected]</li>
</ol>
</li>
<li>Intended usage: Common</li>
<li>Author/Change controller: Irakli Nadareishvili</li>
</ul>
<h1 id="rfc.section.8">
<a href="#rfc.section.8">8.</a> <a href="#acknowledgements" id="acknowledgements">Acknowledgements</a>
</h1>
<p id="rfc.section.8.p.1">Thanks to Mike Amundsen, Erik Wilde, Justin Bachorik and Randall Randall for their suggestions and feedback. And to Mark Nottingham for blueprint for authoring RFCs easily.</p>
<h1 id="rfc.section.9">
<a href="#rfc.section.9">9.</a> <a href="#creating-and-serving-health-responses" id="creating-and-serving-health-responses">Creating and Serving Health Responses</a>
</h1>
<p id="rfc.section.9.p.1">When making an health check endpoint available, there are a few things to keep in mind:</p>
<p></p>
<ul>
<li>A health response endpoint is best located at a memorable and commonly-used URI, such as “health” because it will help self-discoverability by clients.</li>
<li>Health check responses can be personalized. For example, you could advertise different URIs, and/or different kinds of link relations, to afford different clients access to additional health check information.</li>
<li>Health check responses SHOULD be assigned a freshness lifetime (e.g., “Cache-Control: max-age=3600”) so that clients can determine how long they could cache them, to avoid overly frequent fetching and unintended DDOS-ing of the service. Any method of cache lifetime negotiation provided by HTTP spec is acceptable (e.g. ETags are just fine).</li>
<li>Custom link relation types, as well as the URIs for variables, should lead to documentation for those constructs.</li>
</ul>
<h1 id="rfc.section.10">
<a href="#rfc.section.10">10.</a> <a href="#consuming-health-check-responses" id="consuming-health-check-responses">Consuming Health Check Responses</a>
</h1>
<p id="rfc.section.10.p.1">Clients might use health check responses in a variety of ways.</p>
<p id="rfc.section.10.p.2">Note that the health check response is a “living” document; links from the health check response MUST NOT be assumed to be valid beyond the freshness lifetime of the health check response, as per HTTP’s caching model <a href="#RFC7234" class="xref">[RFC7234]</a>.</p>
<p id="rfc.section.10.p.3">As a result, clients ought to cache the health check response (as per <a href="#RFC7234" class="xref">[RFC7234]</a>), to avoid fetching it before every interaction (which would otherwise be required).</p>
<p id="rfc.section.10.p.4">Likewise, a client encountering a 404 (Not Found) on a link is encouraged to obtain a fresh copy of the health check response, to assure that it is up-to-date.</p>
<h1 id="rfc.references">
<a href="#rfc.references">11.</a> References</h1>
<h1 id="rfc.references.1">
<a href="#rfc.references.1">11.1.</a> Normative References</h1>
<table><tbody>
<tr>
<td class="reference"><b id="RFC2119">[RFC2119]</b></td>
<td class="top">
<a>Bradner, S.</a>, "<a href="https://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a>", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997.</td>
</tr>
<tr>
<td class="reference"><b id="RFC3986">[RFC3986]</b></td>
<td class="top">
<a>Berners-Lee, T.</a>, <a>Fielding, R.</a> and <a>L. Masinter</a>, "<a href="https://tools.ietf.org/html/rfc3986">Uniform Resource Identifier (URI): Generic Syntax</a>", STD 66, RFC 3986, DOI 10.17487/RFC3986, January 2005.</td>
</tr>
<tr>
<td class="reference"><b id="RFC6570">[RFC6570]</b></td>
<td class="top">
<a>Gregorio, J.</a>, <a>Fielding, R.</a>, <a>Hadley, M.</a>, <a>Nottingham, M.</a> and <a>D. Orchard</a>, "<a href="https://tools.ietf.org/html/rfc6570">URI Template</a>", RFC 6570, DOI 10.17487/RFC6570, March 2012.</td>
</tr>
<tr>
<td class="reference"><b id="RFC7234">[RFC7234]</b></td>
<td class="top">
<a>Fielding, R.</a>, <a>Nottingham, M.</a> and <a>J. Reschke</a>, "<a href="https://tools.ietf.org/html/rfc7234">Hypertext Transfer Protocol (HTTP/1.1): Caching</a>", RFC 7234, DOI 10.17487/RFC7234, June 2014.</td>
</tr>
<tr>
<td class="reference"><b id="RFC8259">[RFC8259]</b></td>
<td class="top">
<a>Bray, T.</a>, "<a href="https://tools.ietf.org/html/rfc8259">The JavaScript Object Notation (JSON) Data Interchange Format</a>", STD 90, RFC 8259, DOI 10.17487/RFC8259, December 2017.</td>
</tr>
<tr>
<td class="reference"><b id="RFC8288">[RFC8288]</b></td>
<td class="top">
<a>Nottingham, M.</a>, "<a href="https://tools.ietf.org/html/rfc8288">Web Linking</a>", RFC 8288, DOI 10.17487/RFC8288, October 2017.</td>
</tr>
</tbody></table>
<h1 id="rfc.references.2">
<a href="#rfc.references.2">11.2.</a> Informative References</h1>
<table><tbody>
<tr>
<td class="reference"><b id="RFC3339">[RFC3339]</b></td>
<td class="top">
<a>Klyne, G.</a> and <a>C. Newman</a>, "<a href="https://tools.ietf.org/html/rfc3339">Date and Time on the Internet: Timestamps</a>", RFC 3339, DOI 10.17487/RFC3339, July 2002.</td>
</tr>
<tr>
<td class="reference"><b id="RFC6838">[RFC6838]</b></td>
<td class="top">
<a>Freed, N.</a>, <a>Klensin, J.</a> and <a>T. Hansen</a>, "<a href="https://tools.ietf.org/html/rfc6838">Media Type Specifications and Registration Procedures</a>", BCP 13, RFC 6838, DOI 10.17487/RFC6838, January 2013.</td>
</tr>
<tr>
<td class="reference"><b id="RFC7230">[RFC7230]</b></td>
<td class="top">
<a>Fielding, R.</a> and <a>J. Reschke</a>, "<a href="https://tools.ietf.org/html/rfc7230">Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</a>", RFC 7230, DOI 10.17487/RFC7230, June 2014.</td>
</tr>
<tr>
<td class="reference"><b id="RFC7231">[RFC7231]</b></td>
<td class="top">
<a>Fielding, R.</a> and <a>J. Reschke</a>, "<a href="https://tools.ietf.org/html/rfc7231">Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</a>", RFC 7231, DOI 10.17487/RFC7231, June 2014.</td>
</tr>
</tbody></table>
<h1 id="rfc.authors"><a href="#rfc.authors">Author's Address</a></h1>
<div class="avoidbreak">
<address class="vcard">
<span class="vcardline">
<span class="fn">Irakli Nadareishvili</span>
<span class="n hidden">
<span class="family-name">Nadareishvili</span>
</span>
</span>
<span class="org vcardline"></span>
<span class="adr">
<span class="vcardline">114 5th Avenue</span>
<span class="vcardline">
<span class="locality">New York</span>,
<span class="region"></span>
<span class="code"></span>
</span>
<span class="country-name vcardline">United States</span>
</span>
<span class="vcardline">EMail: <a href="mailto:[email protected]">[email protected]</a></span>
<span class="vcardline">URI: <a href="http://www.freshblurbs.com">http://www.freshblurbs.com</a></span>
</address>
</div>
</body>
</html>