diff --git a/specification/DigitalOcean-public.v2.yaml b/specification/DigitalOcean-public.v2.yaml index f990bba48..d1e440690 100644 --- a/specification/DigitalOcean-public.v2.yaml +++ b/specification/DigitalOcean-public.v2.yaml @@ -438,8 +438,9 @@ tags: The DigitalOcean Insights API provides observability resources for monitoring your infrastructure, including alert rules that evaluate metrics, notification channels that deliver alert events, read-only - alert instances that record when alert rules fire, and PromQL and logs - query interfaces. + alert instances that record when alert rules fire, PromQL, logs, spans, + and traces query interfaces, and per-resource enablement of the metrics, + logs, and traces signals. - name: Kubernetes description: |- @@ -2047,6 +2048,18 @@ paths: post: $ref: "resources/insights/insights_post_spansSearch.yml" + /v2/insights/resources: + get: + $ref: "resources/insights/insights_list_resources.yml" + + /v2/insights/resources/{resource_urn}: + get: + $ref: "resources/insights/insights_get_resource.yml" + + /v2/insights/resources/{resource_urn}/signals: + put: + $ref: "resources/insights/insights_update_resourceSignals.yml" + /v1/consent: get: $ref: "resources/signals/signals_list_consents.yml" diff --git a/specification/resources/insights/examples/curl/insights_get_resource.yml b/specification/resources/insights/examples/curl/insights_get_resource.yml new file mode 100644 index 000000000..97f8bd248 --- /dev/null +++ b/specification/resources/insights/examples/curl/insights_get_resource.yml @@ -0,0 +1,5 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/insights/resources/do:droplet:12345" diff --git a/specification/resources/insights/examples/curl/insights_list_resources.yml b/specification/resources/insights/examples/curl/insights_list_resources.yml new file mode 100644 index 000000000..3bdf80518 --- /dev/null +++ b/specification/resources/insights/examples/curl/insights_list_resources.yml @@ -0,0 +1,5 @@ +lang: cURL +source: |- + curl -X GET \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + "https://api.digitalocean.com/v2/insights/resources?filter.product_types=droplet&pagination.per_page=50" diff --git a/specification/resources/insights/examples/curl/insights_update_resourceSignals.yml b/specification/resources/insights/examples/curl/insights_update_resourceSignals.yml new file mode 100644 index 000000000..6cfdf943f --- /dev/null +++ b/specification/resources/insights/examples/curl/insights_update_resourceSignals.yml @@ -0,0 +1,7 @@ +lang: cURL +source: |- + curl -X PUT \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ + -d '{"region":"nyc3","metrics":true,"logs":true}' \ + "https://api.digitalocean.com/v2/insights/resources/do:droplet:12345/signals" diff --git a/specification/resources/insights/insights_get_resource.yml b/specification/resources/insights/insights_get_resource.yml new file mode 100644 index 000000000..b72c23749 --- /dev/null +++ b/specification/resources/insights/insights_get_resource.yml @@ -0,0 +1,46 @@ +operationId: insights_get_resource + +summary: Retrieve Resource Signal Enablement + +description: | + To retrieve the current metrics, logs, and traces signal enablement for a + single resource, send a GET request to + `/v2/insights/resources/{resource_urn}`. + + A `404` is returned when no signal enablement has been recorded for the + resource. + +tags: + - Insights + +parameters: + - $ref: 'parameters.yml#/resource_urn_path' + +responses: + '200': + $ref: 'responses/resource.yml' + + '400': + $ref: '../../shared/responses/bad_request.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '404': + $ref: '../../shared/responses/not_found.yml' + + '429': + $ref: '../../shared/responses/too_many_requests.yml' + + '500': + $ref: '../../shared/responses/server_error.yml' + + default: + $ref: '../../shared/responses/unexpected_error.yml' + +x-codeSamples: + - $ref: 'examples/curl/insights_get_resource.yml' + +security: + - bearer_auth: + - 'insights:read' diff --git a/specification/resources/insights/insights_list_resources.yml b/specification/resources/insights/insights_list_resources.yml new file mode 100644 index 000000000..6fdf730ea --- /dev/null +++ b/specification/resources/insights/insights_list_resources.yml @@ -0,0 +1,53 @@ +operationId: insights_list_resources + +summary: List Resource Signal Enablement + +description: | + To list the resources in your account that have telemetry signal enablement + recorded, along with the current state of their metrics, logs, and traces + signals, send a GET request to `/v2/insights/resources`. + + Results are paginated with `pagination.page` and `pagination.per_page` + (default `20`, maximum `200`) and can be sorted with `pagination.sort` and + `pagination.sort_direction`. Optionally filter by `filter.product_types` and + `filter.regions`. + + A signal is omitted from a resource when no explicit enablement has ever been + recorded for it. + +tags: + - Insights + +parameters: + - $ref: 'parameters.yml#/resources_product_types' + - $ref: 'parameters.yml#/resources_regions' + - $ref: 'parameters.yml#/resources_page' + - $ref: 'parameters.yml#/resources_per_page' + - $ref: 'parameters.yml#/resources_sort' + - $ref: 'parameters.yml#/resources_sort_direction' + +responses: + '200': + $ref: 'responses/list_resources.yml' + + '400': + $ref: '../../shared/responses/bad_request.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' + +x-codeSamples: + - $ref: 'examples/curl/insights_list_resources.yml' + +security: + - bearer_auth: + - 'insights:read' diff --git a/specification/resources/insights/insights_update_resourceSignals.yml b/specification/resources/insights/insights_update_resourceSignals.yml new file mode 100644 index 000000000..dab13fe75 --- /dev/null +++ b/specification/resources/insights/insights_update_resourceSignals.yml @@ -0,0 +1,64 @@ +operationId: insights_update_resourceSignals + +summary: Update Resource Signal Enablement + +description: | + To enable or disable telemetry signals for a resource, send a PUT request to + `/v2/insights/resources/{resource_urn}/signals`. + + This endpoint uses merge semantics. Set `metrics`, `logs`, or `traces` to + `true` or `false` to change that signal; omit a signal to leave it unchanged. + At least one signal must be set. + + `region` is only used when the resource has no existing enablement. On later + updates, omit it or send the stored value; changing the region is rejected + with a `400`. + + Requires both the `insights:update` and `insights:create` scopes. + +tags: + - Insights + +parameters: + - $ref: 'parameters.yml#/resource_urn_path' + +requestBody: + required: true + content: + application/json: + schema: + $ref: 'models/resource_signals_update_request.yml' + example: + region: nyc3 + metrics: true + logs: true + +responses: + '200': + $ref: 'responses/resource.yml' + + '400': + $ref: '../../shared/responses/bad_request.yml' + + '401': + $ref: '../../shared/responses/unauthorized.yml' + + '404': + $ref: '../../shared/responses/not_found.yml' + + '429': + $ref: '../../shared/responses/too_many_requests.yml' + + '500': + $ref: '../../shared/responses/server_error.yml' + + default: + $ref: '../../shared/responses/unexpected_error.yml' + +x-codeSamples: + - $ref: 'examples/curl/insights_update_resourceSignals.yml' + +security: + - bearer_auth: + - 'insights:update' + - 'insights:create' diff --git a/specification/resources/insights/models/enablement_resource.yml b/specification/resources/insights/models/enablement_resource.yml new file mode 100644 index 000000000..73204ad01 --- /dev/null +++ b/specification/resources/insights/models/enablement_resource.yml @@ -0,0 +1,24 @@ +type: object +description: The current telemetry signal enablement for a single resource. +required: + - resource_urn + - product_type +properties: + resource_urn: + type: string + description: The uniform resource name (URN) of the resource. + example: do:droplet:12345 + product_type: + type: string + description: The product type of the resource, for example `droplet` or `kubernetes`. + example: droplet + region: + type: string + description: The region slug for region-specific resources. Omitted when the resource has no region. + example: nyc3 + metrics: + $ref: 'resource_signal_state.yml' + logs: + $ref: 'resource_signal_state.yml' + traces: + $ref: 'resource_signal_state.yml' diff --git a/specification/resources/insights/models/list_resources_response.yml b/specification/resources/insights/models/list_resources_response.yml new file mode 100644 index 000000000..efa4a36e6 --- /dev/null +++ b/specification/resources/insights/models/list_resources_response.yml @@ -0,0 +1,10 @@ +type: object +description: Response body for listing resource signal enablement. +properties: + resources: + type: array + description: Resources with recorded signal enablement. Omitted when none match. + items: + $ref: 'enablement_resource.yml' + pagination: + $ref: 'resources_pagination_response.yml' diff --git a/specification/resources/insights/models/resource_response.yml b/specification/resources/insights/models/resource_response.yml new file mode 100644 index 000000000..344accd7b --- /dev/null +++ b/specification/resources/insights/models/resource_response.yml @@ -0,0 +1,7 @@ +type: object +description: Response body wrapping a single resource's signal enablement. +required: + - resource +properties: + resource: + $ref: 'enablement_resource.yml' diff --git a/specification/resources/insights/models/resource_signal_state.yml b/specification/resources/insights/models/resource_signal_state.yml new file mode 100644 index 000000000..1dad887a9 --- /dev/null +++ b/specification/resources/insights/models/resource_signal_state.yml @@ -0,0 +1,15 @@ +type: object +description: >- + The enablement state of a single telemetry signal (metrics, logs, or traces) + for a resource. A signal state is omitted from a resource when no explicit + enablement has ever been recorded for that signal. +properties: + enabled: + type: boolean + description: Whether the signal is enabled for the resource. + example: true + effective_at: + type: string + format: date-time + description: When this signal state last changed. + example: '2026-10-01T12:00:00Z' diff --git a/specification/resources/insights/models/resource_signals_update_request.yml b/specification/resources/insights/models/resource_signals_update_request.yml new file mode 100644 index 000000000..2d2909462 --- /dev/null +++ b/specification/resources/insights/models/resource_signals_update_request.yml @@ -0,0 +1,25 @@ +type: object +description: >- + Request body for updating a resource's signal enablement. At least one of + `metrics`, `logs`, or `traces` must be set. Signals that are omitted are left + unchanged. +properties: + region: + type: string + description: >- + The region slug for region-specific resources. Only used when the + resource has no existing enablement. On later updates, omit it or send the + stored value; changing the region is rejected. + example: nyc3 + metrics: + type: boolean + description: Enable or disable the metrics signal. Omit to leave unchanged. + example: true + logs: + type: boolean + description: Enable or disable the logs signal. Omit to leave unchanged. + example: true + traces: + type: boolean + description: Enable or disable the traces signal. Omit to leave unchanged. + example: false diff --git a/specification/resources/insights/models/resources_pagination_response.yml b/specification/resources/insights/models/resources_pagination_response.yml new file mode 100644 index 000000000..cbfbc55c7 --- /dev/null +++ b/specification/resources/insights/models/resources_pagination_response.yml @@ -0,0 +1,19 @@ +type: object +description: Page-based pagination metadata for a resources list. +properties: + page: + type: integer + description: The current page number. + example: 1 + pages: + type: integer + description: The total number of pages. + example: 3 + per_page: + type: integer + description: The number of items per page. + example: 20 + total: + type: integer + description: The total number of resources across all pages. + example: 42 diff --git a/specification/resources/insights/parameters.yml b/specification/resources/insights/parameters.yml index fb98ecc42..4ee943f1c 100644 --- a/specification/resources/insights/parameters.yml +++ b/specification/resources/insights/parameters.yml @@ -65,6 +65,94 @@ resource_urn: type: string example: do:droplet:12345 +resource_urn_path: + in: path + name: resource_urn + description: The uniform resource name (URN) of the resource, for example `do:droplet:12345`. + required: true + schema: + type: string + example: do:droplet:12345 + +resources_product_types: + in: query + name: filter.product_types + required: false + description: >- + Optional filter. When set, only resources of these product types are + returned. Repeat the parameter for multiple product types. + schema: + type: array + items: + type: string + style: form + explode: true + example: + - droplet + +resources_regions: + in: query + name: filter.regions + required: false + description: >- + Optional filter. When set, only resources in these regions are returned. + Repeat the parameter for multiple regions. + schema: + type: array + items: + type: string + style: form + explode: true + example: + - nyc3 + +resources_page: + in: query + name: pagination.page + required: false + description: Which 'page' of paginated results to return. + schema: + type: integer + minimum: 1 + default: 1 + example: 1 + +resources_per_page: + in: query + name: pagination.per_page + required: false + description: Number of items returned per page. + schema: + type: integer + minimum: 1 + maximum: 200 + default: 20 + example: 20 + +resources_sort: + in: query + name: pagination.sort + required: false + description: Field to sort by. Defaults to `resource_urn`. + schema: + type: string + enum: + - resource_urn + - effective_at + example: effective_at + +resources_sort_direction: + in: query + name: pagination.sort_direction + required: false + description: Sort direction. Defaults to `asc`. + schema: + type: string + enum: + - asc + - desc + example: desc + region: in: path name: region diff --git a/specification/resources/insights/responses/list_resources.yml b/specification/resources/insights/responses/list_resources.yml new file mode 100644 index 000000000..2f29f259d --- /dev/null +++ b/specification/resources/insights/responses/list_resources.yml @@ -0,0 +1,39 @@ +description: A paginated list of resources and their signal enablement. + +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/list_resources_response.yml' + example: + resources: + - resource_urn: do:droplet:12345 + product_type: droplet + region: nyc3 + metrics: + enabled: true + effective_at: '2026-10-01T12:00:00Z' + logs: + enabled: true + effective_at: '2026-10-01T12:00:00Z' + traces: + enabled: false + effective_at: '2026-10-03T08:30:00Z' + - resource_urn: do:kubernetes:8d91d5e0-1c2b-4f3a-9e7d-6a5b4c3d2e1f + product_type: kubernetes + region: sfo3 + metrics: + enabled: true + effective_at: '2026-09-20T09:15:00Z' + pagination: + page: 1 + pages: 1 + per_page: 20 + total: 2 diff --git a/specification/resources/insights/responses/resource.yml b/specification/resources/insights/responses/resource.yml new file mode 100644 index 000000000..3e960992a --- /dev/null +++ b/specification/resources/insights/responses/resource.yml @@ -0,0 +1,28 @@ +description: The resource's current signal enablement. + +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/resource_response.yml' + example: + resource: + resource_urn: do:droplet:12345 + product_type: droplet + region: nyc3 + metrics: + enabled: true + effective_at: '2026-10-01T12:00:00Z' + logs: + enabled: true + effective_at: '2026-10-01T12:00:00Z' + traces: + enabled: false + effective_at: '2026-10-03T08:30:00Z'