RT clients observability
This API returns information about the publishers and subscribers connected to the RT.
To call the REST API, you can use:
Endpoint
The $ENDPOINT
variable below is defined as an IPC connection to the rest proxy.
bash-4.4$ cd /opt/kx/app/rt/replicator/clib/
bash-4,4$ ./rest_proxy --endpoint $ENDPOINT --target rt-clients
Endpoint
The $ENDPOINT
variable below is defined as an IPC connection to the rest process of any sequencer nodes.
bash-4.4$ curl http://$ENDPOINT/rt-clients
Note
This query can be called directly on a sequencer node.
bash-4.4$ curl http://0:6000/rt-clients
Response
The response includes a response header and a payload, where the payload members are:
group | member | type | description |
---|---|---|---|
node | string | The name of the sequencer node on which the query runs. | |
subscribers | |||
action | string | The reading/writing side of the replicator. | |
last_message | datetime | The datetime of the last received message. | |
publishers | |||
action | string | The reading/writing side to the replicator. | |
last_message | datetime | The datetime of the last received message. | |
target_dir | string | The target directory of the publisher log files. | |
transfer_rate | string | The data transfer speed in byte/sec format. |
Info
The member action
is a replicator related member and its value TRANSFER
means the reading side and APPEND
means the writing side of the replicator from the subscribers/publishers point of view.
Note
The transfer_rate
calculation based on the bytes transfered by a publisher during the last measured periodic time slot. Each periodic time slot is 5 seconds long and starts when a new leader is elected.
Example
Endpoint
An example of the $ENDPOINT
variable is kxi-mystream-1:5002
.
bash-4.4$ cd /opt/kx/app/rt/replicator/clib/
bash-4,4$ ./rest_proxy --endpoint $ENDPOINT --target rt-clients | jq .
{
"result": {
"node": "kxi-mystream-1",
"subscribers": {
"sub-0": {
"action": "TRANSFER",
"last_message": "2023-08-21T12:23:20.334z"
}
},
"publishers": {
"pub-b-0.kxi-mystream": {
"action": "APPEND",
"last_message": "2023-08-21T12:23:20.332z",
"target_dir": "/s/in/pub-b-0.kxi-mystream",
"transfer_rate": "7975.994 byte/s"
},
"pub-a-0.kxi-mystream": {
"action": "APPEND",
"last_message": "2023-08-21T12:23:19.691z",
"target_dir": "/s/in/pub-a-0.kxi-mystream",
"transfer_rate": "7966.994 byte/s"
}
}
}
}
Endpoint
An example of the $ENDPOINT
variable is kxi-mystream-1:6000
.
bash-4.4$ curl http://$ENDPOINT/rt-clients | jq .
{
"result": {
"node": "kxi-mystream-1",
"subscribers": {
"sub-0": {
"action": "TRANSFER",
"last_message": "2023-08-21T12:23:20.334z"
}
},
"publishers": {
"pub-b-0.kxi-mystream": {
"action": "APPEND",
"last_message": "2023-08-21T12:23:20.332z",
"target_dir": "/s/in/pub-b-0.kxi-mystream",
"transfer_rate": "7975.994 byte/s"
},
"pub-a-0.kxi-mystream": {
"action": "APPEND",
"last_message": "2023-08-21T12:23:19.691z",
"target_dir": "/s/in/pub-a-0.kxi-mystream",
"transfer_rate": "7966.994 byte/s"
}
}
}
}
Note
First, you must connect to a sequencer node.
bash-4.4$ curl http://0:6000/rt-clients | jq .
{
"result": {
"node": "kxi-mystream-1",
"subscribers": {
"sub-0": {
"action": "TRANSFER",
"last_message": "2023-08-21T12:23:20.334z"
}
},
"publishers": {
"pub-b-0.kxi-mystream": {
"action": "APPEND",
"last_message": "2023-08-21T12:23:20.332z",
"target_dir": "/s/in/pub-b-0.kxi-mystream",
"transfer_rate": "7975.994 byte/s"
},
"pub-a-0.kxi-mystream": {
"action": "APPEND",
"last_message": "2023-08-21T12:23:19.691z",
"target_dir": "/s/in/pub-a-0.kxi-mystream",
"transfer_rate": "7966.994 byte/s"
}
}
}
}