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
{
"cluster_id": "string",
"from_time": "google.protobuf.Timestamp",
"to_time": "google.protobuf.Timestamp",
"page_size": "int64",
"page_token": "string"
}
Field |
Description |
cluster_id |
string Required field. ID of a PostgreSQL cluster to request session statistics for. To get a PostgreSQL cluster ID, use the ClusterService.List request. |
from_time |
Beginning of the period for which you need to request data (in the RFC3339 |
to_time |
End of the period for which you need to request data (in the RFC3339 |
page_size |
int64 The maximum number of results per page to return. If the number of the results is larger than |
page_token |
string Page token. To get the next page of results, set |
ListRawSessionStatesResponse
{
"session_states": [
{
"time": "google.protobuf.Timestamp",
"host": "string",
"pid": "int64",
"database": "string",
"user": "string",
"application_name": "string",
"backend_start": "google.protobuf.Timestamp",
"xact_start": "google.protobuf.Timestamp",
"query_start": "google.protobuf.Timestamp",
"state_change": "google.protobuf.Timestamp",
"wait_event_type": "string",
"wait_event": "string",
"state": "string",
"query": "string",
"backend_type": "string",
"client_addr": "string",
"client_hostname": "string",
"client_port": "int64",
"backend_xid": "int64",
"backend_xmin": "int64",
"blocking_pids": "string",
"query_id": "string"
}
],
"next_page_token": "string"
}
Field |
Description |
session_states[] |
List of PostgreSQL sessions. |
next_page_token |
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.page_size, 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. |
application_name |
string Application name on the connected client. |
backend_start |
Time when a given process was started. For client connections, this is the time when the client connected to the server. |
xact_start |
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 |
query_start |
Time when the currently active query was started. If the |
state_change |
Time when the |
wait_event_type |
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 |
wait_event |
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 |
backend_type |
string Current backend type. For the list of possible values, see the PostgreSQL documentation |
client_addr |
string IP address of the connected client. The parameter returns [NULL] in the following cases:
|
client_hostname |
string Host name of the connected client (relevant for IP connections). |
client_port |
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). |
backend_xid |
int64 Top-level transaction ID, if any. |
backend_xmin |
int64 Current [xmin horizon]. |
blocking_pids |
string Process IDs that are blocking a given server process ID. |
query_id |
string Query ID. |