Skip to content

Commit 85c8902

Browse files
committed
docs: document new task endpoints
Updates `task-logs.md` document with usage examples for the new endpoints and adds a changelog entry for the new endpoints. PLAT-347
1 parent d214a41 commit 85c8902

File tree

2 files changed

+96
-3
lines changed

2 files changed

+96
-3
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kind: Added
2+
body: Added new API endpoints to interact with host-scoped tasks as well as an endpoint to list tasks across all scopes.
3+
time: 2026-01-14T16:29:46.619212-05:00

docs/using/tasks-logs.md

Lines changed: 93 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,49 @@ The pgEdge Control Plane provides tools to monitor asynchronous operations and a
44

55
## Tasks
66

7-
Every asynchronous database operation managed by the pgEdge Control Plane produces a *task* that you can use to track the progress of that operation.
7+
Every asynchronous operation managed by the pgEdge Control Plane produces a *task* that you can use to track the progress of that operation. Tasks are scoped to either a database or a host, depending on the type of operation.
88

9-
### Listing Tasks
9+
### Listing All Tasks
1010

11-
To list tasks for a database, submit a `GET` request to the
11+
To list all tasks across all scopes, submit a `GET` request to the `/v1/tasks` endpoint:
12+
13+
=== "curl"
14+
15+
```sh
16+
curl http://host-3:3000/v1/tasks
17+
```
18+
19+
You can filter tasks by scope (`database` or `host`) and entity ID:
20+
21+
=== "curl"
22+
23+
```sh
24+
# List only database tasks
25+
curl 'http://host-3:3000/v1/tasks?scope=database'
26+
27+
# List tasks for a specific database
28+
curl 'http://host-3:3000/v1/tasks?scope=database&entity_id=example'
29+
30+
# List only host tasks
31+
curl 'http://host-3:3000/v1/tasks?scope=host'
32+
33+
# List tasks for a specific host
34+
curl 'http://host-3:3000/v1/tasks?scope=host&entity_id=host-1'
35+
```
36+
37+
This endpoint also supports pagination and sorting:
38+
39+
=== "curl"
40+
41+
```sh
42+
curl 'http://host-3:3000/v1/tasks?limit=10&after_task_id=404ecbe0-5cda-11f0-900b-a74a79e3bdba&sort_order=asc'
43+
```
44+
45+
## Database Tasks
46+
47+
### Listing Database Tasks
48+
49+
To list tasks for a specific database, submit a `GET` request to the
1250
`/v1/databases/{database_id}/tasks` endpoint. For example:
1351

1452
=== "curl"
@@ -68,6 +106,58 @@ You can also limit your request to only the most recent log entries with the
68106
curl 'http://host-3:3000/v1/databases/example/tasks/d3cd2fab-4b1f-4eb9-b614-181c10b07acd/log?limit=10'
69107
```
70108

109+
## Host Tasks
110+
111+
Some operations, such as removing a host from the cluster, produce tasks scoped to a host rather than a database.
112+
113+
### Listing Host Tasks
114+
115+
To list tasks for a specific host, submit a `GET` request to the
116+
`/v1/hosts/{host_id}/tasks` endpoint:
117+
118+
=== "curl"
119+
120+
```sh
121+
curl http://host-3:3000/v1/hosts/host-1/tasks
122+
```
123+
124+
This endpoint supports the same pagination and sorting options as the database tasks endpoint:
125+
126+
=== "curl"
127+
128+
```sh
129+
curl 'http://host-3:3000/v1/hosts/host-1/tasks?limit=5&after_task_id=404ecbe0-5cda-11f0-900b-a74a79e3bdba&sort_order=asc'
130+
```
131+
132+
### Getting a Specific Host Task
133+
134+
To fetch details for a specific host task, submit a `GET` request to the `/v1/hosts/{host_id}/tasks/{task_id}` endpoint:
135+
136+
=== "curl"
137+
138+
```sh
139+
curl http://host-3:3000/v1/hosts/host-1/tasks/d3cd2fab-4b1f-4eb9-b614-181c10b07acd
140+
```
141+
142+
### Getting Host Task Logs
143+
144+
You can fetch log messages for a host task by submitting a `GET` request to the
145+
`/v1/hosts/{host_id}/tasks/{task_id}/logs` endpoint:
146+
147+
=== "curl"
148+
149+
```sh
150+
curl http://host-3:3000/v1/hosts/host-1/tasks/d3cd2fab-4b1f-4eb9-b614-181c10b07acd/logs
151+
```
152+
153+
The same pagination options (`after_entry_id` and `limit`) are supported:
154+
155+
=== "curl"
156+
157+
```sh
158+
curl 'http://host-3:3000/v1/hosts/host-1/tasks/d3cd2fab-4b1f-4eb9-b614-181c10b07acd/logs?limit=10'
159+
```
160+
71161
## Viewing Postgres Logs
72162

73163
By default, each database is configured to write log files to the following directory:

0 commit comments

Comments
 (0)