Skip to content

Commit 564cfd8

Browse files
Tactionmsfussellhhunter-ms
authored
Add placement table api doc (#3631)
* add placement table api doc Signed-off-by: zhangchao <zchao9100@gmail.com> * typo fix Signed-off-by: zhangchao <zchao9100@gmail.com> * fix review Signed-off-by: zhangchao <zchao9100@gmail.com> * fix example Signed-off-by: zhangchao <zchao9100@gmail.com> --------- Signed-off-by: zhangchao <zchao9100@gmail.com> Co-authored-by: Mark Fussell <markfussell@gmail.com> Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com>
1 parent 0f24ef1 commit 564cfd8

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

daprdocs/content/en/concepts/dapr-services/placement.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,72 @@ The placement service Docker container is started automatically as part of [`dap
1414
## Kubernetes mode
1515

1616
The placement service is deployed as part of `dapr init -k`, or via the Dapr Helm charts. For more information on running Dapr on Kubernetes, visit the [Kubernetes hosting page]({{< ref kubernetes >}}).
17+
18+
## Placement tables
19+
20+
There is an HTTP API `/placement/state` for placement service that exposes placement table information. The API is exposed on the sidecar on the same port as the healthz. This is an unauthenticated endpoint, and is disabled by default. You need to set `DAPR_PLACEMENT_METADATA_ENABLED` environment or `metadata-enabled` command line args to true to enable it. If you are using helm you just need to set `dapr_placement.metadataEnabled` to true.
21+
22+
### Usecase:
23+
The placement table API can be used for retrieving the current placement table, which contains all the actors registered. This can be helpful for debugging and allows tools to extract and present information about actors.
24+
25+
### HTTP Request
26+
27+
```
28+
GET http://localhost:<healthzPort>/placement/state
29+
```
30+
31+
### HTTP Response Codes
32+
33+
Code | Description
34+
---- | -----------
35+
200 | Placement tables information returned
36+
500 | Placement could not return the placement tables information
37+
38+
### HTTP Response Body
39+
40+
**Placement tables API Response Object**
41+
42+
Name | Type | Description
43+
---- | ---- | -----------
44+
tableVersion | int | The placement table version
45+
hostList | [Actor Host Info](#actorhostinfo)[] | A json array of registered actors host info.
46+
47+
<a id="actorhostinfo"></a>**Actor Host Info**
48+
49+
Name | Type | Description
50+
---- | ---- | -----------
51+
name | string | The host:port address of the actor.
52+
appId | string | app id.
53+
actorTypes | json string array | List of actor types it hosts.
54+
updatedAt | timestamp | Timestamp of the actor registered/updated.
55+
56+
### Examples
57+
58+
```shell
59+
curl localhost:8080/placement/state
60+
```
61+
62+
```json
63+
{
64+
"hostList": [{
65+
"name": "198.18.0.1:49347",
66+
"appId": "actor1",
67+
"actorTypes": ["testActorType1", "testActorType3"],
68+
"updatedAt": 1690274322325260000
69+
},
70+
{
71+
"name": "198.18.0.2:49347",
72+
"appId": "actor2",
73+
"actorTypes": ["testActorType2"],
74+
"updatedAt": 1690274322325260000
75+
},
76+
{
77+
"name": "198.18.0.3:49347",
78+
"appId": "actor2",
79+
"actorTypes": ["testActorType2"],
80+
"updatedAt": 1690274322325260000
81+
}
82+
],
83+
"tableVersion": 1
84+
}
85+
```

0 commit comments

Comments
 (0)