Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3a01559

Browse filesBrowse files
authored
Add bigtable regions (GoogleCloudPlatform#982)
* Add bigtable regions * fix lint
1 parent 88700c3 commit 3a01559
Copy full SHA for 3a01559

1 file changed

+4Lines changed: 4 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎bigtable/autoscaler/autoscaler.py‎

Copy file name to clipboardExpand all lines: bigtable/autoscaler/autoscaler.py
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ def get_cpu_load():
3030
Returns:
3131
float: The most recent Bigtable CPU usage metric
3232
"""
33+
# [START bigtable_cpu]
3334
client = monitoring.Client()
3435
query = client.query('bigtable.googleapis.com/cluster/cpu_load', minutes=5)
3536
time_series = list(query)
3637
recent_time_series = time_series[0]
3738
return recent_time_series.points[0].value
39+
# [END bigtable_cpu]
3840

3941

4042
def scale_bigtable(bigtable_instance, bigtable_cluster, scale_up):
@@ -50,6 +52,7 @@ def scale_bigtable(bigtable_instance, bigtable_cluster, scale_up):
5052
bigtable_cluster (str): Cloud Bigtable cluster id to scale
5153
scale_up (bool): If true, scale up, otherwise scale down
5254
"""
55+
# [START bigtable_scale]
5356
bigtable_client = bigtable.Client(admin=True)
5457
instance = bigtable_client.instance(bigtable_instance)
5558
instance.reload()
@@ -74,6 +77,7 @@ def scale_bigtable(bigtable_instance, bigtable_cluster, scale_up):
7477
cluster.update()
7578
print('Scaled from {} up to {} nodes.'.format(
7679
current_node_count, new_node_count))
80+
# [END bigtable_scale]
7781

7882

7983
def main(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.