Skip to content

Commit 3070398

Browse files
authored
APPS-11069: Add spec for app health API (#1006)
* APPS-11069: Add spec for app health API * fix lint errors
1 parent 0fb7311 commit 3070398

File tree

9 files changed

+138
-0
lines changed

9 files changed

+138
-0
lines changed

specification/DigitalOcean-public.v2.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,10 @@ paths:
675675
post:
676676
$ref: "resources/apps/apps_list_metrics_bandwidth_usage.yml"
677677

678+
/v2/apps/{app_id}/health:
679+
get:
680+
$ref: "resources/apps/apps_get_health.yml"
681+
678682
/v2/cdn/endpoints:
679683
get:
680684
$ref: "resources/cdn/cdn_list_endpoints.yml"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
operationId: apps_get_health
2+
3+
summary: Retrieve App Health
4+
5+
description: Retrieve information like health status, cpu and memory utilization of app components.
6+
7+
parameters:
8+
- $ref: parameters.yml#/app_id
9+
10+
tags:
11+
- Apps
12+
13+
responses:
14+
"200":
15+
$ref: responses/apps_health.yml
16+
17+
"401":
18+
$ref: ../../shared/responses/unauthorized.yml
19+
20+
"404":
21+
$ref: "../../shared/responses/not_found.yml"
22+
23+
"429":
24+
$ref: "../../shared/responses/too_many_requests.yml"
25+
26+
"500":
27+
$ref: ../../shared/responses/server_error.yml
28+
29+
default:
30+
$ref: ../../shared/responses/unexpected_error.yml
31+
32+
x-codeSamples:
33+
- $ref: 'examples/curl/apps_get_health.yml'
34+
35+
security:
36+
- bearer_auth:
37+
- 'app:read'
38+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
lang: cURL
2+
source: |-
3+
curl -X GET \
4+
-H "Content-Type: application/json" \
5+
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
6+
"https://api.digitalocean.com/v2/apps/{id}/health"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
type: object
2+
properties:
3+
name:
4+
type: string
5+
example: sample_app
6+
cpu_usage_percent:
7+
type: number
8+
format: double
9+
example: 30
10+
memory_usage_percent:
11+
type: number
12+
format: double
13+
example: 25
14+
replicas_desired:
15+
type: integer
16+
format: int64
17+
example: 1
18+
replicas_ready:
19+
type: integer
20+
format: int64
21+
example: 1
22+
state:
23+
type: string
24+
enum:
25+
- UNKNOWN
26+
- HEALTHY
27+
- UNHEALTHY
28+
default: UNKNOWN
29+
example: HEALTHY
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
type: object
2+
properties:
3+
name:
4+
type: string
5+
example: sample_function
6+
functions_component_health_metrics:
7+
type: array
8+
items:
9+
type: object
10+
properties:
11+
metric_label:
12+
type: string
13+
example: activations_count
14+
metric_value:
15+
type: number
16+
format: double
17+
example: 100
18+
time_window:
19+
type: string
20+
example: 1h
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
type: object
2+
properties:
3+
components:
4+
type: array
5+
items:
6+
"$ref": app_component_health.yml
7+
functions_components:
8+
type: array
9+
items:
10+
"$ref": app_functions_component_health.yml
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
properties:
2+
app_health:
3+
"$ref": app_health.yml
4+
type: object
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
description: A JSON with key `app_health`
2+
3+
content:
4+
application/json:
5+
schema:
6+
$ref: ../models/app_health_response.yml
7+
examples:
8+
app_health:
9+
$ref: examples.yml#/app_health
10+
11+
headers:
12+
ratelimit-limit:
13+
$ref: ../../../shared/headers.yml#/ratelimit-limit
14+
ratelimit-remaining:
15+
$ref: ../../../shared/headers.yml#/ratelimit-remaining
16+
ratelimit-reset:
17+
$ref: ../../../shared/headers.yml#/ratelimit-reset

specification/resources/apps/responses/examples.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,3 +912,13 @@ app_bandwidth_usage_multiple:
912912
- app_id: c2a93513-8d9b-4223-9d61-5e7272c81cf5
913913
bandwidth_bytes: '254847'
914914
date: 2023-01-17T00:00:00Z
915+
916+
app_health:
917+
value:
918+
components:
919+
- name: sample-expressjs
920+
cpu_usage_percent: 5.555
921+
memory_usage_percent: 20.32
922+
replicas_desired: 1
923+
replicas_ready: 2
924+
state: HEALTHY

0 commit comments

Comments
 (0)