Managed Service for PostgreSQL API, gRPC: PerformanceDiagnosticsService.ListRawSessionStates
Retrieves raw statistics on sessions. Corresponds to the pg_stat_activity view
gRPC request
rpc ListRawSessionStates (ListRawSessionStatesRequest) returns (ListRawSessionStatesResponse)
ListRawSessionStatesRequest
{
"clusterId": "string",
"fromTime": "google.protobuf.Timestamp",
"toTime": "google.protobuf.Timestamp",
"pageSize": "int64",
"pageToken": "string"
}
Field |
Description |
clusterId |
string Required field. ID of a PostgreSQL cluster to request session statistics for. To get a PostgreSQL cluster ID, use the ClusterService.List request. |
fromTime |
Beginning of the period for which you need to request data (in the RFC3339 |
toTime |
End of the period for which you need to request data (in the RFC3339 |
pageSize |
int64 The maximum number of results per page to return. If the number of the results is larger than |
pageToken |
string Page token. To get the next page of results, set |
ListRawSessionStatesResponse
{
"sessionStates": [
{
"time": "google.protobuf.Timestamp",
"host": "string",
"pid": "int64",
"database": "string",
"user": "string",
"applicationName": "string",
"backendStart": "google.protobuf.Timestamp",
"xactStart": "google.protobuf.Timestamp",
"queryStart": "google.protobuf.Timestamp",
"stateChange": "google.protobuf.Timestamp",
"waitEventType": "string",
"waitEvent": "string",
"state": "string",
"query": "string",
"backendType": "string",
"clientAddr": "string",
"clientHostname": "string",
"clientPort": "int64",
"backendXid": "int64",
"backendXmin": "int64",
"blockingPids": "string",
"queryId": "string"
}
],
"nextPageToken": "string"
}
Field |
Description |
sessionStates[] |
List of PostgreSQL sessions. |
nextPageToken |
string This token allows you to get the next page of results when requesting the PostgreSQL session list. If the number of the results is larger than ListRawSessionStatesRequest.pageSize, use the |
SessionState
Field |
Description |
time |
Time of collecting statistics on sessions (in the RFC3339 |
host |
string Host of the connected client. |
pid |
int64 Server process ID. For client connections, this is a client connection ID. |
database |
string Database ID. |
user |
string User ID. |
applicationName |
string Application name on the connected client. |
backendStart |
Time when a given process was started. For client connections, this is the time when the client connected to the server. |
xactStart |
Time when a transaction of a given process was started. Returns [NULL] if no transaction is active. If the currently active query is the first of its transaction, the value of this parameter is equal to the value of the |
queryStart |
Time when the currently active query was started. If the |
stateChange |
Time when the |
waitEventType |
string Type of event for which the backend is waiting. Such an event is called a wait event. A backend refers to the process that maintains the client connection. For the list of wait events, see the PostgreSQL documentation |
waitEvent |
string Wait event name. For the list of such names, see the PostgreSQL documentation |
state |
string Current backend state. For the list of possible values, see the PostgreSQL documentation |
query |
string Text of the most recent query. If the |
backendType |
string Current backend type. For the list of possible values, see the PostgreSQL documentation |
clientAddr |
string IP address of the connected client. The parameter returns [NULL] in the following cases:
|
clientHostname |
string Host name of the connected client (relevant for IP connections). |
clientPort |
int64 TCP port number that the client is using for communication with the server. Returns [-1] if the client is connected via a Unix socket on the server. Returns [NULL] if a given process is internal (for example, autovacuum). |
backendXid |
int64 Top-level transaction ID, if any. |
backendXmin |
int64 Current [xmin horizon]. |
blockingPids |
string Process IDs that are blocking a given server process ID. |
queryId |
string Query ID. |