Show the number of open sessions on a spanner database

1k views Asked by At

Is there a way to display the number of currently open sessions on a database in google spanner?

The limit is mentioned here:

Sessions per database per node - 10,000

I have looked through the documentation on SQL functions and gcloud spanner command line tool, but neither mentioned a way to show how many were open.

2

There are 2 answers

0
onionjake On BEST ANSWER

There is now a command to list active sessions:

gcloud spanner databases sessions list --instance <your-spanner-instance> --database <your-database>

You can then parse this file or count the lines and figure out how many open sessions there are.

2
Dan McGrath On

Unfortunately, this isn't something exposed at this time. You can see a list of metrics available for Stackdriver in the docs:

List of Cloud Spanner metrics available in Stackdriver