diff --git a/specification/DigitalOcean-public.v2.yaml b/specification/DigitalOcean-public.v2.yaml index 29d582b1..43556beb 100644 --- a/specification/DigitalOcean-public.v2.yaml +++ b/specification/DigitalOcean-public.v2.yaml @@ -1271,6 +1271,18 @@ paths: get: $ref: 'resources/monitoring/monitoring_get_dropletMemoryAvailableMetrics.yml' + /v2/monitoring/metrics/apps/memory_percentage: + get: + $ref: 'resources/monitoring/monitoring_get_appMemoryPercentageMetrics.yml' + + /v2/monitoring/metrics/apps/cpu_percentage: + get: + $ref: 'resources/monitoring/monitoring_get_appCPUPercentageMetrics.yml' + + /v2/monitoring/metrics/apps/restart_count: + get: + $ref: 'resources/monitoring/monitoring_get_appRestartCountMetrics.yml' + /v2/projects: get: $ref: 'resources/projects/projects_list.yml' diff --git a/specification/resources/monitoring/examples/curl/monitoring_get_appCPUPercentageMetrics.yml b/specification/resources/monitoring/examples/curl/monitoring_get_appCPUPercentageMetrics.yml new file mode 100644 index 00000000..8d841440 --- /dev/null +++ b/specification/resources/monitoring/examples/curl/monitoring_get_appCPUPercentageMetrics.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/monitoring/metrics/apps/cpu_percentage?app_id=2db3c021-15ad-4088-bfe8-99dc972b9cf6&component_id=sample-application&start=1636051668&end=1636051668" diff --git a/specification/resources/monitoring/examples/curl/monitoring_get_appMemoryPercentageMetrics.yml b/specification/resources/monitoring/examples/curl/monitoring_get_appMemoryPercentageMetrics.yml new file mode 100644 index 00000000..73b328c2 --- /dev/null +++ b/specification/resources/monitoring/examples/curl/monitoring_get_appMemoryPercentageMetrics.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/monitoring/metrics/apps/memory_percentage?app_id=2db3c021-15ad-4088-bfe8-99dc972b9cf6&component_id=sample-application&start=1636051668&end=1636051668" diff --git a/specification/resources/monitoring/examples/curl/monitoring_get_appRestartCountMetrics.yml b/specification/resources/monitoring/examples/curl/monitoring_get_appRestartCountMetrics.yml new file mode 100644 index 00000000..88474473 --- /dev/null +++ b/specification/resources/monitoring/examples/curl/monitoring_get_appRestartCountMetrics.yml @@ -0,0 +1,6 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/monitoring/metrics/apps/restart_count?app_id=2db3c021-15ad-4088-bfe8-99dc972b9cf6&component_id=sample-application&start=1636051668&end=1636051668" diff --git a/specification/resources/monitoring/monitoring_get_appCPUPercentageMetrics.yml b/specification/resources/monitoring/monitoring_get_appCPUPercentageMetrics.yml new file mode 100644 index 00000000..9b84611f --- /dev/null +++ b/specification/resources/monitoring/monitoring_get_appCPUPercentageMetrics.yml @@ -0,0 +1,39 @@ +operationId: monitoring_get_appCPUPercentageMetrics + +summary: Get App CPU Percentage Metrics + +description: >- + To retrieve cpu percentage metrics for a given app, send a GET request to `/v2/monitoring/metrics/apps/cpu_percentage`. +tags: + - Monitoring + +responses: + '200': + $ref: 'responses/app_metric_response.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '429': + $ref: '../../shared/responses/too_many_requests.yml' + + '500': + $ref: '../../shared/responses/server_error.yml' + + default: + $ref: '../../shared/responses/unexpected_error.yml' + + +parameters: + - $ref: 'parameters.yml#/app_id' + - $ref: 'parameters.yml#/component_id' + - $ref: 'parameters.yml#/metric_timestamp_start' + - $ref: 'parameters.yml#/metric_timestamp_end' + +x-codeSamples: + - $ref: 'examples/curl/monitoring_get_appCPUPercentageMetrics.yml' + +security: + - bearer_auth: + - 'read' + diff --git a/specification/resources/monitoring/monitoring_get_appMemoryPercentageMetrics.yml b/specification/resources/monitoring/monitoring_get_appMemoryPercentageMetrics.yml new file mode 100644 index 00000000..2be7a482 --- /dev/null +++ b/specification/resources/monitoring/monitoring_get_appMemoryPercentageMetrics.yml @@ -0,0 +1,39 @@ +operationId: monitoring_get_appMemoryPercentageMetrics + +summary: Get App Memory Percentage Metrics + +description: >- + To retrieve memory percentage metrics for a given app, send a GET request to `/v2/monitoring/metrics/apps/memory_percentage`. +tags: + - Monitoring + +responses: + '200': + $ref: 'responses/app_metric_response.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '429': + $ref: '../../shared/responses/too_many_requests.yml' + + '500': + $ref: '../../shared/responses/server_error.yml' + + default: + $ref: '../../shared/responses/unexpected_error.yml' + + +parameters: + - $ref: 'parameters.yml#/app_id' + - $ref: 'parameters.yml#/component_id' + - $ref: 'parameters.yml#/metric_timestamp_start' + - $ref: 'parameters.yml#/metric_timestamp_end' + +x-codeSamples: + - $ref: 'examples/curl/monitoring_get_appMemoryPercentageMetrics.yml' + +security: + - bearer_auth: + - 'read' + diff --git a/specification/resources/monitoring/monitoring_get_appRestartCountMetrics.yml b/specification/resources/monitoring/monitoring_get_appRestartCountMetrics.yml new file mode 100644 index 00000000..6c04bb77 --- /dev/null +++ b/specification/resources/monitoring/monitoring_get_appRestartCountMetrics.yml @@ -0,0 +1,39 @@ +operationId: monitoring_get_appRestartCountMetrics.yml + +summary: Get App Restart Count Metrics + +description: >- + To retrieve restart count metrics for a given app, send a GET request to `/v2/monitoring/metrics/apps/restart_count`. +tags: + - Monitoring + +responses: + '200': + $ref: 'responses/app_metric_response.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '429': + $ref: '../../shared/responses/too_many_requests.yml' + + '500': + $ref: '../../shared/responses/server_error.yml' + + default: + $ref: '../../shared/responses/unexpected_error.yml' + + +parameters: + - $ref: 'parameters.yml#/app_id' + - $ref: 'parameters.yml#/component_id' + - $ref: 'parameters.yml#/metric_timestamp_start' + - $ref: 'parameters.yml#/metric_timestamp_end' + +x-codeSamples: + - $ref: 'examples/curl/monitoring_get_appRestartCountMetrics.yml' + +security: + - bearer_auth: + - 'read' + diff --git a/specification/resources/monitoring/parameters.yml b/specification/resources/monitoring/parameters.yml index dad7b14b..ae378353 100644 --- a/specification/resources/monitoring/parameters.yml +++ b/specification/resources/monitoring/parameters.yml @@ -7,6 +7,24 @@ droplet_id: schema: type: string +app_id: + in: query + name: app_id + description: The App UUID. + example: "2db3c021-15ad-4088-bfe8-99dc972b9cf6" + required: true + schema: + type: string + +component_id: + in: query + name: component_id + description: The App's component ID. + example: "sample-application" + required: true + schema: + type: string + network_interface: in: query name: interface diff --git a/specification/resources/monitoring/responses/app_metric_response.yml b/specification/resources/monitoring/responses/app_metric_response.yml new file mode 100644 index 00000000..54dce10f --- /dev/null +++ b/specification/resources/monitoring/responses/app_metric_response.yml @@ -0,0 +1,19 @@ +description: The response will be a JSON object with a key called `data` and `status`. + +headers: + ratelimit-limit: + $ref: '../../../shared/headers.yml#/ratelimit-limit' + ratelimit-remaining: + $ref: '../../../shared/headers.yml#/ratelimit-remaining' + ratelimit-reset: + $ref: '../../../shared/headers.yml#/ratelimit-reset' + +content: + application/json: + schema: + $ref: '../models/metrics.yml' + + examples: + Memory: + $ref: './examples.yml#/app_memory_percentage' + diff --git a/specification/resources/monitoring/responses/examples.yml b/specification/resources/monitoring/responses/examples.yml index f1f22ad6..58f62df3 100644 --- a/specification/resources/monitoring/responses/examples.yml +++ b/specification/resources/monitoring/responses/examples.yml @@ -183,3 +183,23 @@ droplet_filesystem: - '25832407040' - - 1635387120 - '25832407040' + +app_memory_percentage: + value: + status: success + data: + resultType: matrix + result: + - metric: + app_component: sample-application + app_component_instance: sample-application-0 + app_uuid: 'db3c021-15ad-4088-bfe8-99dc972b9cf6' + values: + - - 1634052360 + - '5.016600450090265357' + - - 1634052480 + - '12.015085955677299055' + - - 1634052600 + - '8.014941163855322308' + - - 1634052720 + - '32.016214285714285712'